diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1970d26484..54e3c60eed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: ci -on: [push, pull_request] +on: push jobs: test: @@ -11,7 +11,6 @@ jobs: with: node-version: '20' - run: npm install - - run: npm test - run: npm run build - name: Get REV diff --git a/webpack.config.js b/webpack.config.js index b105d4212d..96a4e2ecf4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -224,88 +224,88 @@ function makeContentScript(name) { if (!DEV) fse.emptyDirSync(DST + ASSETS); module.exports = [ - mergeCfg({ - entry: Object.fromEntries(PAGES.map(p => [p, `/${p}/index`])), - output: { - filename: ASSETS + '[name].js', - chunkFilename: ASSETS + '[name].js', - }, - optimization: { - splitChunks: { - chunks: /^(?!.*[/\\]shim)/, - cacheGroups: { - codemirror: { - test: new RegExp(String.raw`(${anyPathSep([ - SRC + 'cm/', - String.raw`codemirror(/|-(?!factory))`, - ].join('|'))}).+\.js$`), - name: 'codemirror', - }, - ...Object.fromEntries([ - [2, 'common-ui', `^${SRC}(content/|js/(dom|localization|themer))`], - [1, 'common', `^${SRC}js/|/lz-string(-unsafe)?/`], - ].map(([priority, name, test]) => [name, { - test: new RegExp(String.raw`(${anyPathSep(test)})[^./\\]*\.js$`), - name, - priority, - }])), - }, - }, - }, - plugins: [ - defineVars({ - PAGE: true, - THEMES: THEME_NAMES, - }), - new MiniCssExtractPlugin({ - filename: ASSETS + '[name].css', - chunkFilename: ASSETS + '[name].css', - }), - ...PAGES.map(p => new HtmlWebpackPlugin({ - chunks: [p], - filename: p + '.html', - template: SRC + p + '.html', - templateParameters: (compilation, files, tags, options) => { - const {bodyTags, headTags} = tags; - // The main entry goes into BODY to improve performance (2x in manage.html) - headTags.push(...bodyTags.splice(0, bodyTags.length - 1)); - return { - compilation: compilation, - webpackConfig: compilation.options, - htmlWebpackPlugin: {tags, files, options}, - }; - }, - scriptLoading: 'blocking', - inject: false, - })), - new CopyPlugin({ - patterns: [ - {context: SRC + 'content', from: 'install*.js', to: DST + JS, info: {minimized: true}}, - {context: SRC + 'images', from: 'eyedropper/**', to: DST + ASSETS}, - {context: SRC + 'images', from: 'icon/**', to: DST + ASSETS}, - {context: SRC, from: 'manifest.json', to: DST}, - {context: SRC, from: '_locales/**', to: DST}, - {context: THEME_PATH, from: '*.css', to: DST + ASSETS_CM}, - ...[ - ['stylelint-bundle', 'stylelint.js'], - ['less/dist/less.min.js', 'less.js'], - ['stylus-lang-bundle/dist/stylus-renderer.min.js', 'stylus-lang.js'], - ].map(([npm, to]) => ({ - from: require.resolve(npm), - to: DST + JS + to, - info: {minimized: true}, - transform: stripSourceMap, - })), - ], - }), - ], - resolve: { - modules: [ - SHIM, - 'node_modules', - ], - }, - }), + // mergeCfg({ + // entry: Object.fromEntries(PAGES.map(p => [p, `/${p}/index`])), + // output: { + // filename: ASSETS + '[name].js', + // chunkFilename: ASSETS + '[name].js', + // }, + // optimization: { + // splitChunks: { + // chunks: /^(?!.*[/\\]shim)/, + // cacheGroups: { + // codemirror: { + // test: new RegExp(String.raw`(${anyPathSep([ + // SRC + 'cm/', + // String.raw`codemirror(/|-(?!factory))`, + // ].join('|'))}).+\.js$`), + // name: 'codemirror', + // }, + // ...Object.fromEntries([ + // [2, 'common-ui', `^${SRC}(content/|js/(dom|localization|themer))`], + // [1, 'common', `^${SRC}js/|/lz-string(-unsafe)?/`], + // ].map(([priority, name, test]) => [name, { + // test: new RegExp(String.raw`(${anyPathSep(test)})[^./\\]*\.js$`), + // name, + // priority, + // }])), + // }, + // }, + // }, + // plugins: [ + // defineVars({ + // PAGE: true, + // THEMES: THEME_NAMES, + // }), + // new MiniCssExtractPlugin({ + // filename: ASSETS + '[name].css', + // chunkFilename: ASSETS + '[name].css', + // }), + // ...PAGES.map(p => new HtmlWebpackPlugin({ + // chunks: [p], + // filename: p + '.html', + // template: SRC + p + '.html', + // templateParameters: (compilation, files, tags, options) => { + // const {bodyTags, headTags} = tags; + // // The main entry goes into BODY to improve performance (2x in manage.html) + // headTags.push(...bodyTags.splice(0, bodyTags.length - 1)); + // return { + // compilation: compilation, + // webpackConfig: compilation.options, + // htmlWebpackPlugin: {tags, files, options}, + // }; + // }, + // scriptLoading: 'blocking', + // inject: false, + // })), + // new CopyPlugin({ + // patterns: [ + // {context: SRC + 'content', from: 'install*.js', to: DST + JS, info: {minimized: true}}, + // {context: SRC + 'images', from: 'eyedropper/**', to: DST + ASSETS}, + // {context: SRC + 'images', from: 'icon/**', to: DST + ASSETS}, + // {context: SRC, from: 'manifest.json', to: DST}, + // {context: SRC, from: '_locales/**', to: DST}, + // {context: THEME_PATH, from: '*.css', to: DST + ASSETS_CM}, + // ...[ + // ['stylelint-bundle', 'stylelint.js'], + // ['less/dist/less.min.js', 'less.js'], + // ['stylus-lang-bundle/dist/stylus-renderer.min.js', 'stylus-lang.js'], + // ].map(([npm, to]) => ({ + // from: require.resolve(npm), + // to: DST + JS + to, + // info: {minimized: true}, + // transform: stripSourceMap, + // })), + // ], + // }), + // ], + // resolve: { + // modules: [ + // SHIM, + // 'node_modules', + // ], + // }, + // }), makeContentScript('apply.js'), makeLibrary([ '/background/background-worker.js',