From 1adc5aae08a561b97cff84f14fb4421409bfd4b6 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Tue, 2 Feb 2021 20:22:31 +0300 Subject: [PATCH 001/122] docs: update changelog --- CHANGELOG.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad016fcba6a..8f1b80d7b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,44 @@ +# [4.5.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.4.0...webpack-cli@4.5.0) (2021-02-02) + +### Notes + +- now you can use `webpack.config.mjs` and `webpack.config.js` with `{ "type": "module" }` in `package.json` +- you can avoid using the `cross-env` package: + +Before: + +```json +{ + "scripts": { + "build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js" + } +} +``` + +Now (you can remove the `cross-env` if you don't use it somewhere else): + +```json +{ + "scripts": { + "build": "webpack --node-env=production --config build/webpack.config.js" + } +} +``` + +- the `mode` option respect the `--node-env` option if you don't set the `mode` option explicit using CLI options or in configuration(s), i.e. `--node-env production` set `process.env.NODE_ENV` and `mode` to `production` + +### Bug Fixes + +- avoid deprecation message ([9d6dbda](https://github.com/webpack/webpack-cli/commit/9d6dbda93da167a1aaad03f599105a4fe7849dc3)) +- error message on invalid plugin options ([#2380](https://github.com/webpack/webpack-cli/issues/2380)) ([f9ce1d3](https://github.com/webpack/webpack-cli/commit/f9ce1d30b83bf0e0b4d91498d012c13c208e6e67)) +- improve description for 'configtest' command ([#2379](https://github.com/webpack/webpack-cli/issues/2379)) ([311bae3](https://github.com/webpack/webpack-cli/commit/311bae336d83424c800e553b6ef40242d967685c)) + +### Features + +- add the `--node-env` flag ([#2388](https://github.com/webpack/webpack-cli/issues/2388)) ([e5126f1](https://github.com/webpack/webpack-cli/commit/e5126f10b6622437c0541c25be2a610a82c1df04)) +- entries syntax ([#2369](https://github.com/webpack/webpack-cli/issues/2369)) ([6b31614](https://github.com/webpack/webpack-cli/commit/6b3161479578f572f803f579c7e71073eb797184)) +- support ES module configuration format ([#2381](https://github.com/webpack/webpack-cli/issues/2381)) ([aebdbbc](https://github.com/webpack/webpack-cli/commit/aebdbbc1f6e2761e7821cb3660bea686cce7b587)) + # [4.4.0](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.3.1...webpack-cli@4.4.0) (2021-01-19) ### Bug Fixes From f9dadef1577ec0df9ac89f6308ff8b4da19892e0 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Sat, 6 Feb 2021 19:43:39 +0530 Subject: [PATCH 002/122] chore: update webpack (#2416) --- OPTIONS.md | 12 +++++-- package.json | 2 +- test/build-errors/errors.test.js | 4 ++- test/build-warnings/warnings.test.js | 4 ++- test/colors/colors.test.js | 36 +++++++++---------- test/core-flags/context-flag.test.js | 3 +- test/core-flags/output-flags.test.js | 2 ++ test/core-flags/stats-flags.test.js | 2 +- test/defaults/output-defaults.test.js | 4 ++- .../defaults-empty/entry-single-arg.test.js | 3 +- test/entry/flag-entry/entry-with-flag.test.js | 3 +- .../mode-single-arg/mode-single-arg.test.js | 8 +++-- test/prefetch/prefetch.test.js | 5 ++- .../entry-absent/zero-config.test.js | 5 ++- yarn.lock | 9 +++-- 15 files changed, 64 insertions(+), 38 deletions(-) diff --git a/OPTIONS.md b/OPTIONS.md index 9cf47d8cec7..06a04206bfb 100644 --- a/OPTIONS.md +++ b/OPTIONS.md @@ -9,6 +9,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value -h, --hot Enables Hot Module Replacement --no-hot Disables Hot Module Replacement. --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. @@ -52,6 +53,9 @@ Options: --experiments-lazy-compilation-client A custom client. --experiments-lazy-compilation-entries Enable/disable lazy compilation for entries. --no-experiments-lazy-compilation-entries Negative 'experiments-lazy-compilation-entries' option. + --experiments-lazy-compilation-imports Enable/disable lazy compilation for import() modules. + --no-experiments-lazy-compilation-imports Negative 'experiments-lazy-compilation-imports' option. + --experiments-lazy-compilation-test Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name. --experiments-output-module Allow output javascript files as module source type. --no-experiments-output-module Negative 'experiments-output-module' option. --experiments-sync-web-assembly Support WebAssembly as synchronous EcmaScript Module (outdated). @@ -428,6 +432,11 @@ Options: --output-chunk-load-timeout Number of milliseconds before chunk request expires. --output-chunk-loading The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins). --output-chunk-loading-global The global variable used by webpack for loading of chunks. + --output-clean Clean the output directory before emit. + --no-output-clean Negative 'output-clean' option. + --output-clean-dry Log the assets that should be removed instead of deleting them. + --no-output-clean-dry Negative 'output-clean-dry' option. + --output-clean-keep Keep these assets. --output-compare-before-emit Check if to be emitted file already exists and have the same content before writing to output filesystem. --no-output-compare-before-emit Negative 'output-compare-before-emit' option. --output-cross-origin-loading This option enables cross-origin loading of chunks. @@ -686,8 +695,7 @@ Options: --stats-entrypoints Display the entry points with the corresponding bundles. --stats-env Add --env information. --no-stats-env Negative 'stats-env' option. - --stats-error-details Add details to errors (like resolving log). - --no-stats-error-details Negative 'stats-error-details' option. + --stats-error-details Add details to errors (like resolving log). --stats-error-stack Add internal stack trace to errors. --no-stats-error-stack Negative 'stats-error-stack' option. --stats-errors Add errors. diff --git a/package.json b/package.json index 6114c3636e1..64039a18326 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "ts-jest": "^26.4.3", "ts-node": "^9.1.1", "typescript": "^4.1.3", - "webpack": "^5.18.0", + "webpack": "^5.21.1", "webpack-bundle-analyzer": "^4.3.0", "webpack-dev-server": "^3.11.1", "yeoman-test": "^2.7.0" diff --git a/test/build-errors/errors.test.js b/test/build-errors/errors.test.js index 30fac63060d..3147000a8b3 100644 --- a/test/build-errors/errors.test.js +++ b/test/build-errors/errors.test.js @@ -1,4 +1,6 @@ 'use strict'; + +const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const { readFile } = require('fs'); const { resolve } = require('path'); @@ -10,7 +12,7 @@ describe('errors', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); expect(stdout).toMatch(/ERROR/); - expect(stdout).toMatch(/Error: Can't resolve/); + expect(stripAnsi(stdout)).toMatch(/Error: Can't resolve/); }); it('should output JSON with the "json" flag', () => { diff --git a/test/build-warnings/warnings.test.js b/test/build-warnings/warnings.test.js index 8bf676da732..c58d9b9fab8 100644 --- a/test/build-warnings/warnings.test.js +++ b/test/build-warnings/warnings.test.js @@ -1,4 +1,6 @@ 'use strict'; + +const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -10,7 +12,7 @@ describe('warnings', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toMatch(/WARNING/); - expect(stdout).toMatch(/Error: Can't resolve/); + expect(stripAnsi(stdout)).toMatch(/Error: Can't resolve/); }); it('should output JSON with the "json" flag', () => { diff --git a/test/colors/colors.test.js b/test/colors/colors.test.js index 52d842821b5..8e7348f8480 100644 --- a/test/colors/colors.test.js +++ b/test/colors/colors.test.js @@ -1,51 +1,49 @@ 'use strict'; + const { run, isWebpack5 } = require('../utils/test-utils'); const { resolve } = require('path'); -const { options: coloretteOptions } = require('colorette'); describe('colors related tests', () => { it('should output by default', () => { - const { exitCode, stderr, stdout } = run(__dirname, [], true, [], { FORCE_COLOR: true }); + const { exitCode, stderr, stdout } = run(__dirname, [], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from flags', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose'], true, [], { FORCE_COLOR: true }); + const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from flags and from configuration', () => { const { exitCode, stderr, stdout } = run( __dirname, ['--stats=verbose', `--config=${resolve(__dirname, './no-stats.webpack.config.js')}`], - true, - [], - { FORCE_COLOR: true }, + { env: { FORCE_COLOR: true } }, ); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from flags and from configuration #2', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose', '--config=stats-string.webpack.config.js'], true, [], { - FORCE_COLOR: true, + const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose', '--config=stats-string.webpack.config.js'], { + env: { FORCE_COLOR: true }, }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should disable colored output with --no-color', () => { @@ -68,30 +66,30 @@ describe('colors related tests', () => { }); it('should work with the "stats" option from the configuration', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--config=stats-string.webpack.config.js'], true, [], { FORCE_COLOR: true }); + const { exitCode, stderr, stdout } = run(__dirname, ['--config=stats-string.webpack.config.js'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #1', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--config=stats-boolean.webpack.config.js'], true, [], { FORCE_COLOR: true }); + const { exitCode, stderr, stdout } = run(__dirname, ['--config=stats-boolean.webpack.config.js'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #2', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--config=no-stats.webpack.config.js'], true, [], { FORCE_COLOR: true }); + const { exitCode, stderr, stdout } = run(__dirname, ['--config=no-stats.webpack.config.js'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #3', () => { @@ -100,7 +98,7 @@ describe('colors related tests', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(coloretteOptions.enabled ? `\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m` : output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); it('should work with the "stats" option from the configuration #4', () => { diff --git a/test/core-flags/context-flag.test.js b/test/core-flags/context-flag.test.js index df4050e94a7..20b4072f84e 100644 --- a/test/core-flags/context-flag.test.js +++ b/test/core-flags/context-flag.test.js @@ -1,5 +1,6 @@ 'use strict'; +const stripAnsi = require('strip-ansi'); const { resolve } = require('path'); const { run, isWindows } = require('../utils/test-utils'); @@ -23,6 +24,6 @@ describe('--context flag', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); - expect(stdout).toContain(`Module not found: Error: Can't resolve './src/main.js'`); + expect(stripAnsi(stdout)).toContain(`Module not found: Error: Can't resolve './src/main.js'`); }); }); diff --git a/test/core-flags/output-flags.test.js b/test/core-flags/output-flags.test.js index 3829a5e3a21..bd725deb68f 100644 --- a/test/core-flags/output-flags.test.js +++ b/test/core-flags/output-flags.test.js @@ -13,6 +13,8 @@ describe('output config related flag', () => { if (property.includes('environment-')) { property = property.split('environment-')[1]; + } else if (property.includes('clean-')) { + property = property.split('clean-')[1]; } const propName = hyphenToUpperCase(property); diff --git a/test/core-flags/stats-flags.test.js b/test/core-flags/stats-flags.test.js index 77d7ff11edd..d8c92acd093 100644 --- a/test/core-flags/stats-flags.test.js +++ b/test/core-flags/stats-flags.test.js @@ -71,7 +71,7 @@ describe('stats config related flag', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain('log'); - } else if (flag.name === 'stats-entrypoints') { + } else if (flag.name === 'stats-entrypoints' || flag.name === 'stats-error-details') { const { exitCode, stderr, stdout } = run(__dirname, [`--${flag.name}`, 'auto']); expect(exitCode).toBe(0); diff --git a/test/defaults/output-defaults.test.js b/test/defaults/output-defaults.test.js index bd4b4213a91..910419745a9 100644 --- a/test/defaults/output-defaults.test.js +++ b/test/defaults/output-defaults.test.js @@ -1,4 +1,6 @@ 'use strict'; + +const stripAnsi = require('strip-ansi'); const { existsSync } = require('fs'); const { resolve } = require('path'); const { run } = require('../utils/test-utils'); @@ -10,7 +12,7 @@ describe('output flag defaults', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); // Should print warning about config fallback - expect(stdout).toContain('option has not been set, webpack will fallback to'); + expect(stripAnsi(stdout)).toContain('option has not been set, webpack will fallback to'); expect(existsSync(resolve(__dirname, './binary/main.js'))).toBeTruthy(); }); diff --git a/test/entry/defaults-empty/entry-single-arg.test.js b/test/entry/defaults-empty/entry-single-arg.test.js index d6274bf2e8f..b4d6cf07f86 100644 --- a/test/entry/defaults-empty/entry-single-arg.test.js +++ b/test/entry/defaults-empty/entry-single-arg.test.js @@ -1,5 +1,6 @@ 'use strict'; +const stripAnsi = require('strip-ansi'); const { run } = require('../../utils/test-utils'); describe('single entry flag empty project', () => { @@ -8,6 +9,6 @@ describe('single entry flag empty project', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); - expect(stdout).toContain(`not found: Error: Can't resolve`); + expect(stripAnsi(stdout)).toContain(`not found: Error: Can't resolve`); }); }); diff --git a/test/entry/flag-entry/entry-with-flag.test.js b/test/entry/flag-entry/entry-with-flag.test.js index 90e465042ad..b2d02f9f3fd 100644 --- a/test/entry/flag-entry/entry-with-flag.test.js +++ b/test/entry/flag-entry/entry-with-flag.test.js @@ -1,5 +1,6 @@ 'use strict'; +const stripAnsi = require('strip-ansi'); const { run } = require('../../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -39,6 +40,6 @@ describe('entry flag', () => { expect(exitCode).toEqual(1); expect(stderr).toBeFalsy(); - expect(stdout).toContain("Module not found: Error: Can't resolve"); + expect(stripAnsi(stdout)).toContain("Module not found: Error: Can't resolve"); }); }); diff --git a/test/mode/mode-single-arg/mode-single-arg.test.js b/test/mode/mode-single-arg/mode-single-arg.test.js index 7816271878f..3d18ddb14e6 100644 --- a/test/mode/mode-single-arg/mode-single-arg.test.js +++ b/test/mode/mode-single-arg/mode-single-arg.test.js @@ -1,5 +1,6 @@ 'use strict'; +const stripAnsi = require('strip-ansi'); const { run, isWebpack5 } = require('../../utils/test-utils'); describe('mode flags', () => { @@ -8,8 +9,11 @@ describe('mode flags', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).not.toContain(`mode: 'production'`); - expect(stdout).toContain(`The 'mode' option has not been set, webpack will fallback to 'production' for this value.`); + + const pureStdout = stripAnsi(stdout); + + expect(pureStdout).not.toContain(`mode: 'production'`); + expect(pureStdout).toContain(`The 'mode' option has not been set, webpack will fallback to 'production' for this value.`); }); it('should load a development config when --mode=development is passed', () => { diff --git a/test/prefetch/prefetch.test.js b/test/prefetch/prefetch.test.js index 1e1a85ab8f7..cf7c60fe638 100644 --- a/test/prefetch/prefetch.test.js +++ b/test/prefetch/prefetch.test.js @@ -1,5 +1,8 @@ +'use strict'; + const fs = require('fs'); const { join } = require('path'); +const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const rimraf = require('rimraf'); @@ -26,7 +29,7 @@ describe('prefetch', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); // Should contain the error message - expect(stdout).toContain(`Error: Can't resolve './src/somefile.js'`); + expect(stripAnsi(stdout)).toContain(`Error: Can't resolve './src/somefile.js'`); }); it('should log error when flag value is not supplied', () => { diff --git a/test/zero-config/entry-absent/zero-config.test.js b/test/zero-config/entry-absent/zero-config.test.js index c55f05e049a..0ebba445d1a 100644 --- a/test/zero-config/entry-absent/zero-config.test.js +++ b/test/zero-config/entry-absent/zero-config.test.js @@ -1,3 +1,6 @@ +'use strict'; + +const stripAnsi = require('strip-ansi'); const { run } = require('../../utils/test-utils'); describe('Zero Config tests', () => { @@ -7,6 +10,6 @@ describe('Zero Config tests', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); // Entry file is absent, should log the Error from the compiler - expect(stdout).toContain("Error: Can't resolve './src'"); + expect(stripAnsi(stdout)).toContain("Error: Can't resolve './src'"); }); }); diff --git a/yarn.lock b/yarn.lock index 094afc705ea..5417978a1ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11074,10 +11074,10 @@ webpack-sources@^2.1.1: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@^5.18.0: - version "5.19.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.19.0.tgz#1a5fee84dd63557e68336b0774ac4a1c81aa2c73" - integrity sha512-egX19vAQ8fZ4cVYtA9Y941eqJtcZAK68mQq87MMv+GTXKZOc3TpKBBxdGX+HXUYlquPxiluNsJ1VHvwwklW7CQ== +webpack@^5.21.1: + version "5.21.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.1.tgz#a5a13965187deeaa674a0ecea219b61060a2c38f" + integrity sha512-H/fjQiDETEZDKoZm/LhvDBxOIKf9rfOdqb2pKTHRvBFMIRtwAwYlPCgBd0gc5xiDG5DqkxAiFZgAF/4H41wMuQ== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" @@ -11097,7 +11097,6 @@ webpack@^5.18.0: loader-runner "^4.2.0" mime-types "^2.1.27" neo-async "^2.6.2" - pkg-dir "^5.0.0" schema-utils "^3.0.0" tapable "^2.1.1" terser-webpack-plugin "^5.1.1" From e0b208d3cd7d22e64c88a9fa2fd3adf59219d94d Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Sat, 6 Feb 2021 19:45:32 +0530 Subject: [PATCH 003/122] build: do not install webpack 5 again (#2417) --- .github/workflows/nodejs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d2c0262b783..351cdbadfa1 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -85,6 +85,7 @@ jobs: yarn bootstrap - name: Install webpack ${{ matrix.webpack-version }} + if: matrix.webpack-version == 'webpack-4' run: yarn add -W webpack@${{ matrix.webpack-version }} - name: Build and Bootstrap From 2c2eacf6890111897e48001bcac09707fd99eaf3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 6 Feb 2021 19:18:23 +0300 Subject: [PATCH 004/122] chore(deps-dev): bump @types/prettier Bumps [@types/prettier](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prettier) from 2.1.6 to 2.2.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prettier) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5417978a1ac..5d06ceee46e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1956,9 +1956,9 @@ integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== "@types/prettier@^2.0.0", "@types/prettier@^2.1.5": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.6.tgz#f4b1efa784e8db479cdb8b14403e2144b1e9ff03" - integrity sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA== + version "2.2.0" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.0.tgz#a4e8205a4955690eef712a6d0394a1d2e121e721" + integrity sha512-O3SQC6+6AySHwrspYn2UvC6tjo6jCTMMmylxZUFhE1CulVu5l3AxU6ca9lrJDTQDVllF62LIxVSx5fuYL6LiZg== "@types/responselike@*", "@types/responselike@^1.0.0": version "1.0.0" From 5a4e792d76baf860b27338e05f5c42b2b9ec614f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 6 Feb 2021 20:12:07 +0300 Subject: [PATCH 005/122] chore(deps-dev): bump lint-staged from 10.5.3 to 10.5.4 (#2413) Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.3 to 10.5.4. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v10.5.3...v10.5.4) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5d06ceee46e..db877f81c5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7129,9 +7129,9 @@ lines-and-columns@^1.1.6: integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= lint-staged@^10.5.0: - version "10.5.3" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.5.3.tgz#c682838b3eadd4c864d1022da05daa0912fb1da5" - integrity sha512-TanwFfuqUBLufxCc3RUtFEkFraSPNR3WzWcGF39R3f2J7S9+iF9W0KTVLfSy09lYGmZS5NDCxjNvhGMSJyFCWg== + version "10.5.4" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.5.4.tgz#cd153b5f0987d2371fc1d2847a409a2fe705b665" + integrity sha512-EechC3DdFic/TdOPgj/RB3FicqE6932LTHCUm0Y2fsD9KGlLB+RwJl2q1IYBIvEsKzDOgn0D4gll+YxG5RsrKg== dependencies: chalk "^4.1.0" cli-truncate "^2.1.0" From 75eae34dbd2cd791df1e03b8a4d93ec412e1f337 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 6 Feb 2021 20:12:24 +0300 Subject: [PATCH 006/122] chore(deps-dev): bump @types/node Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.22 to 14.14.25. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index db877f81c5d..16425d5b928 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,9 +1941,9 @@ integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.6": - version "14.14.22" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.22.tgz#0d29f382472c4ccf3bd96ff0ce47daf5b7b84b18" - integrity sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw== + version "14.14.25" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.25.tgz#15967a7b577ff81383f9b888aa6705d43fbbae93" + integrity sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ== "@types/normalize-package-data@^2.4.0": version "2.4.0" From 62ef2e3902cf4c6da12538971b214ffb11ec565c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Feb 2021 13:16:40 +0300 Subject: [PATCH 007/122] chore(deps-dev): bump webpack from 5.21.1 to 5.21.2 (#2421) Bumps [webpack](https://github.com/webpack/webpack) from 5.21.1 to 5.21.2. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.21.1...v5.21.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 16425d5b928..4a634ff34ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11075,9 +11075,9 @@ webpack-sources@^2.1.1: source-map "^0.6.1" webpack@^5.21.1: - version "5.21.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.1.tgz#a5a13965187deeaa674a0ecea219b61060a2c38f" - integrity sha512-H/fjQiDETEZDKoZm/LhvDBxOIKf9rfOdqb2pKTHRvBFMIRtwAwYlPCgBd0gc5xiDG5DqkxAiFZgAF/4H41wMuQ== + version "5.21.2" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.2.tgz#647507e50d3637695be28af58a6a8246050394e7" + integrity sha512-xHflCenx+AM4uWKX71SWHhxml5aMXdy2tu/vdi4lClm7PADKxlyDAFFN1rEFzNV0MAoPpHtBeJnl/+K6F4QBPg== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" From dd0f1632217a40c04c19af973ef3d696cc595d21 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Mon, 8 Feb 2021 15:59:48 +0530 Subject: [PATCH 008/122] refactor: move init to generators (#2393) --- .eslintignore | 1 - .prettierignore | 1 - packages/generators/src/index.ts | 36 ++++++++++++- packages/init/CHANGELOG.md | 69 ------------------------- packages/init/README.md | 52 ------------------- packages/init/package.json | 22 -------- packages/init/src/index.ts | 38 -------------- packages/init/tsconfig.json | 9 ---- packages/webpack-cli/lib/webpack-cli.js | 2 +- packages/webpack-cli/package.json | 3 -- test/version/version.test.js | 15 +++--- tsconfig.json | 3 -- 12 files changed, 43 insertions(+), 208 deletions(-) delete mode 100644 packages/init/CHANGELOG.md delete mode 100644 packages/init/README.md delete mode 100644 packages/init/package.json delete mode 100644 packages/init/src/index.ts delete mode 100644 packages/init/tsconfig.json diff --git a/.eslintignore b/.eslintignore index b6038bd2368..671d7209437 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,7 +5,6 @@ dist packages/configtest/lib packages/generators/lib packages/info/lib -packages/init/lib packages/serve/lib test/**/dist/ test/**/bin/ diff --git a/.prettierignore b/.prettierignore index 877e50a1666..12de069ebb5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,7 +5,6 @@ dist packages/configtest/lib packages/generators/lib packages/info/lib -packages/init/lib packages/serve/lib test/**/dist/ test/**/bin/ diff --git a/packages/generators/src/index.ts b/packages/generators/src/index.ts index 8850c361123..8826052aa1d 100644 --- a/packages/generators/src/index.ts +++ b/packages/generators/src/index.ts @@ -4,10 +4,44 @@ import pluginGenerator from './plugin-generator'; import addonGenerator from './addon-generator'; import initGenerator from './init-generator'; +import { modifyHelperUtil } from './utils/modify-config-helper'; +import { npmPackagesExists } from './utils/npm-packages-exists'; + class GeneratorsCommand { async apply(cli): Promise { const { logger } = cli; + await cli.makeCommand( + { + name: 'init [scaffold...]', + alias: 'c', + description: 'Initialize a new webpack configuration.', + usage: '[scaffold...] [options]', + pkg: '@webpack-cli/generators', + }, + [ + { + name: 'auto', + type: Boolean, + description: 'To generate default config', + }, + { + name: 'generation-path', + type: String, + description: 'To scaffold in a specified path', + }, + ], + async (scaffold, options) => { + if (scaffold && scaffold.length > 0) { + await npmPackagesExists(scaffold); + + return; + } + + modifyHelperUtil(initGenerator, null, null, options.auto, options.generationPath); + }, + ); + await cli.makeCommand( { name: 'loader [output-path]', @@ -29,7 +63,7 @@ class GeneratorsCommand { }, ); - cli.makeCommand( + await cli.makeCommand( { name: 'plugin [output-path]', alias: 'p', diff --git a/packages/init/CHANGELOG.md b/packages/init/CHANGELOG.md deleted file mode 100644 index 890c797cfe5..00000000000 --- a/packages/init/CHANGELOG.md +++ /dev/null @@ -1,69 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.3](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.1.2...@webpack-cli/init@1.1.3) (2021-02-02) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.1.2](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.1.1...@webpack-cli/init@1.1.2) (2021-01-19) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.1.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.1.0...@webpack-cli/init@1.1.1) (2020-12-31) - -### Bug Fixes - -- the `--help` option is working without `webpack-dev-server` ([#2267](https://github.com/webpack/webpack-cli/issues/2267)) ([1dae54d](https://github.com/webpack/webpack-cli/commit/1dae54da94d3220437b9257efe512447023de1d3)) - -# [1.1.0](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.3...@webpack-cli/init@1.1.0) (2020-12-25) - -### Features - -- add `--generation-path` option ([#2050](https://github.com/webpack/webpack-cli/issues/2050)) ([413eb8c](https://github.com/webpack/webpack-cli/commit/413eb8cf2add4978763a4c9ee6b983582685768b)) - -## [1.0.3](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.2...@webpack-cli/init@1.0.3) (2020-11-04) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.2](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.1...@webpack-cli/init@1.0.2) (2020-10-19) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.1-rc.1...@webpack-cli/init@1.0.1) (2020-10-10) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.1-rc.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.1-alpha.5...@webpack-cli/init@1.0.1-rc.1) (2020-10-06) - -### Bug Fixes - -- **packages:** make packages have correct main paths to index ([#1366](https://github.com/webpack/webpack-cli/issues/1366)) ([5dd7bd6](https://github.com/webpack/webpack-cli/commit/5dd7bd62046568481996e48328b15a335557f8ae)) -- add necessary peerDependencies ([#1825](https://github.com/webpack/webpack-cli/issues/1825)) ([0f13ab5](https://github.com/webpack/webpack-cli/commit/0f13ab5ddd9e28e5e7095721d086a58aebaf98a5)) - -### Features - -- add flag to force config ([f61e7e0](https://github.com/webpack/webpack-cli/commit/f61e7e0d1b03284d7333c4f0f38294460209a25d)) - -## [1.0.1-alpha.5](https://github.com/ematipico/webpack-cli/compare/@webpack-cli/init@1.0.1-alpha.4...@webpack-cli/init@1.0.1-alpha.5) (2020-03-02) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.1-alpha.4](https://github.com/ematipico/webpack-cli/compare/@webpack-cli/init@1.0.1-alpha.3...@webpack-cli/init@1.0.1-alpha.4) (2020-02-29) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.1-alpha.3](https://github.com/ematipico/webpack-cli/compare/@webpack-cli/init@1.0.1-alpha.2...@webpack-cli/init@1.0.1-alpha.3) (2020-02-23) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.1-alpha.2](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.1-alpha.1...@webpack-cli/init@1.0.1-alpha.2) (2020-02-23) - -**Note:** Version bump only for package @webpack-cli/init - -## [1.0.1-alpha.1](https://github.com/webpack/webpack-cli/compare/@webpack-cli/init@1.0.1-alpha.0...@webpack-cli/init@1.0.1-alpha.1) (2020-02-23) - -### Bug Fixes - -- **init:** fix webpack config scaffold ([#1231](https://github.com/webpack/webpack-cli/issues/1231)) ([2dc495a](https://github.com/webpack/webpack-cli/commit/2dc495a8d050d28478c6c2533d7839e9ff78d76c)), closes [#1230](https://github.com/webpack/webpack-cli/issues/1230) diff --git a/packages/init/README.md b/packages/init/README.md deleted file mode 100644 index a1e392533cb..00000000000 --- a/packages/init/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# webpack-cli init - -[![NPM Downloads][downloads]][downloads-url] - -## Description - -This package contains the logic to create a new webpack configuration. - -## Installation - -```bash -npm i -D webpack-cli @webpack-cli/init -``` - -## Usage - -### CLI (via `webpack-cli`) - -**Via defaults** - -```bash -npx webpack-cli init -``` - -**To generate default configs** - -```bash -npx webpack-cli init --auto -``` - -**To scaffold in a specified path** - -```bash -npx webpack-cli init --generation-path [path] -``` - -**Via custom scaffold** - -1. Using package on `npm` - -```bash -npx webpack-cli init webpack-scaffold-[name] -``` - -2. Using path to a local directory - -```bash -npx webpack-cli init [path] -``` - -[downloads]: https://img.shields.io/npm/dm/@webpack-cli/init.svg -[downloads-url]: https://www.npmjs.com/package/@webpack-cli/init diff --git a/packages/init/package.json b/packages/init/package.json deleted file mode 100644 index 92ce11d2b7d..00000000000 --- a/packages/init/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@webpack-cli/init", - "version": "1.1.3", - "description": "init command for webpack-cli", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "files": [ - "lib" - ], - "dependencies": { - "@webpack-cli/generators": "^1.3.1" - }, - "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" - }, - "gitHead": "fb50f766851f500ca12867a2aa9de81fa6e368f9" -} diff --git a/packages/init/src/index.ts b/packages/init/src/index.ts deleted file mode 100644 index e75210408ce..00000000000 --- a/packages/init/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { initGenerator, modifyHelperUtil, npmPackagesExists } from '@webpack-cli/generators'; - -class InitCommand { - async apply(cli): Promise { - await cli.makeCommand( - { - name: 'init [scaffold...]', - alias: 'c', - description: 'Initialize a new webpack configuration.', - usage: '[scaffold...] [options]', - pkg: '@webpack-cli/init', - }, - [ - { - name: 'auto', - type: Boolean, - description: 'To generate default config', - }, - { - name: 'generation-path', - type: String, - description: 'To scaffold in a specified path', - }, - ], - async (scaffold, options) => { - if (scaffold && scaffold.length > 0) { - await npmPackagesExists(scaffold); - - return; - } - - modifyHelperUtil(initGenerator, null, null, options.auto, options.generationPath); - }, - ); - } -} - -export default InitCommand; diff --git a/packages/init/tsconfig.json b/packages/init/tsconfig.json deleted file mode 100644 index ba2474fb584..00000000000 --- a/packages/init/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./lib", - "rootDir": "./src" - }, - "include": ["./src"], - "references": [{ "path": "../generators" }] -} diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 15be68263dc..a95c28eebe1 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -480,7 +480,7 @@ class WebpackCLI { { name: 'init', alias: 'c', - pkg: '@webpack-cli/init', + pkg: '@webpack-cli/generators', }, { name: 'loader', diff --git a/packages/webpack-cli/package.json b/packages/webpack-cli/package.json index a81232c5aa6..ffa31882c8a 100644 --- a/packages/webpack-cli/package.json +++ b/packages/webpack-cli/package.json @@ -49,9 +49,6 @@ "@webpack-cli/generators": { "optional": true }, - "@webpack-cli/init": { - "optional": true - }, "@webpack-cli/migrate": { "optional": true }, diff --git a/test/version/version.test.js b/test/version/version.test.js index 1cc9fb69ce5..b0c7df26b81 100644 --- a/test/version/version.test.js +++ b/test/version/version.test.js @@ -4,7 +4,6 @@ const webpack = require('webpack'); const { run } = require('../utils/test-utils'); const pkgJSON = require('../../packages/webpack-cli/package.json'); -const initPkgJSON = require('../../packages/init/package.json'); const servePkgJSON = require('../../packages/serve/package.json'); const infoPkgJSON = require('../../packages/info/package.json'); const generatorsPkgJSON = require('../../packages/generators/package.json'); @@ -162,7 +161,7 @@ describe('single version flag', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(`@webpack-cli/init ${initPkgJSON.version}`); + expect(stdout).toContain(`@webpack-cli/generators ${generatorsPkgJSON.version}`); expect(stdout).toContain(`webpack-cli ${pkgJSON.version}`); expect(stdout).toContain(`webpack ${webpack.version}`); expect(stdout).toContain(`webpack-dev-server ${webpackDevServerPkgJSON.version}`); @@ -190,11 +189,11 @@ describe('single version flag', () => { }); it('outputs version with the alias c for init', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['i', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['c', '--version'], false); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stdout).toContain(`@webpack-cli/info ${infoPkgJSON.version}`); + expect(stdout).toContain(`@webpack-cli/generators ${generatorsPkgJSON.version}`); expect(stdout).toContain(`webpack-cli ${pkgJSON.version}`); expect(stdout).toContain(`webpack ${webpack.version}`); expect(stdout).toContain(`webpack-dev-server ${webpackDevServerPkgJSON.version}`); @@ -253,21 +252,21 @@ describe('single version flag', () => { }); it('should log version for known command and log error for unknown command using the "--version" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['init', 'abc', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['serve', 'abc', '--version'], false); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); - expect(stdout).toContain(`@webpack-cli/init ${initPkgJSON.version}`); + expect(stdout).toContain(`@webpack-cli/serve ${servePkgJSON.version}`); }); it('should log version for known command and log error for unknown command using the "-v" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['init', 'abc', '-v'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['serve', 'abc', '-v'], false); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); - expect(stdout).toContain(`@webpack-cli/init ${initPkgJSON.version}`); + expect(stdout).toContain(`@webpack-cli/serve ${servePkgJSON.version}`); }); it('should not output version with help dashed', () => { diff --git a/tsconfig.json b/tsconfig.json index ad41a0d6d32..d5d1c44c8f5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,9 +26,6 @@ { "path": "packages/info" }, - { - "path": "packages/init" - }, { "path": "packages/serve" }, From 78e2fa7036e123beefe2010e0a6cc10697d14c4d Mon Sep 17 00:00:00 2001 From: James George Date: Mon, 8 Feb 2021 18:00:46 +0530 Subject: [PATCH 009/122] fix: add serve script if opted for WDS with init (#2424) * fix: add start script if opted for WDS * chore: rename to serve --- packages/generators/init-template/package.json.js | 6 +++--- packages/generators/src/init-generator.ts | 8 ++++++-- test/init/auto/init-auto.test.js | 2 ++ test/init/generation-path/init-generation-path.test.js | 4 ++++ test/init/generator/init-inquirer.test.js | 2 ++ test/init/language/css/init-language-css.test.js | 2 ++ test/init/language/js/init-language-js.test.js | 2 ++ test/init/multipleEntries/init-multipleEntries.test.js | 2 ++ 8 files changed, 23 insertions(+), 5 deletions(-) diff --git a/packages/generators/init-template/package.json.js b/packages/generators/init-template/package.json.js index effe0ca439d..b5c6ee60ebb 100644 --- a/packages/generators/init-template/package.json.js +++ b/packages/generators/init-template/package.json.js @@ -1,9 +1,9 @@ -module.exports = (usingDefaults) => { +module.exports = (isUsingDevServer) => { const scripts = { build: 'webpack', }; - if (usingDefaults) { - scripts.start = 'webpack-dev-server'; + if (isUsingDevServer) { + scripts.serve = 'webpack serve'; } return { diff --git a/packages/generators/src/init-generator.ts b/packages/generators/src/init-generator.ts index 40bb3b5db41..022768b9596 100644 --- a/packages/generators/src/init-generator.ts +++ b/packages/generators/src/init-generator.ts @@ -244,9 +244,13 @@ export default class InitGenerator extends CustomGenerator { public writing(): void { this.config.set('configuration', this.configuration); + const isUsingDevServer = this.dependencies.includes('webpack-dev-server'); const packageJsonTemplatePath = '../init-template/package.json.js'; - // eslint-disable-next-line @typescript-eslint/no-var-requires - this.fs.extendJSON(this.destinationPath('package.json'), require(packageJsonTemplatePath)(this.autoGenerateConfig)); + this.fs.extendJSON( + this.destinationPath('package.json'), + // eslint-disable-next-line @typescript-eslint/no-var-requires + require(packageJsonTemplatePath)(isUsingDevServer), + ); const generateEntryFile = (entryPath: string, name: string): void => { entryPath = entryPath.replace(/'/g, ''); diff --git a/test/init/auto/init-auto.test.js b/test/init/auto/init-auto.test.js index 05a58085830..c29df7cf5c1 100644 --- a/test/init/auto/init-auto.test.js +++ b/test/init/auto/init-auto.test.js @@ -51,7 +51,9 @@ describe('init auto flag', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); diff --git a/test/init/generation-path/init-generation-path.test.js b/test/init/generation-path/init-generation-path.test.js index e4211b18732..b4b614536da 100644 --- a/test/init/generation-path/init-generation-path.test.js +++ b/test/init/generation-path/init-generation-path.test.js @@ -42,7 +42,9 @@ describe('init generate-path flag', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); }); @@ -78,7 +80,9 @@ describe('init generate-path flag', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); }); diff --git a/test/init/generator/init-inquirer.test.js b/test/init/generator/init-inquirer.test.js index 9cb3f794761..677535adf9f 100644 --- a/test/init/generator/init-inquirer.test.js +++ b/test/init/generator/init-inquirer.test.js @@ -46,7 +46,9 @@ describe('init', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); diff --git a/test/init/language/css/init-language-css.test.js b/test/init/language/css/init-language-css.test.js index c36648b7aa2..5a4cb27b925 100644 --- a/test/init/language/css/init-language-css.test.js +++ b/test/init/language/css/init-language-css.test.js @@ -72,9 +72,11 @@ describe('init with SCSS', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['devDependencies']['node-sass']).toBeTruthy(); expect(pkgJson['devDependencies']['mini-css-extract-plugin']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); }); diff --git a/test/init/language/js/init-language-js.test.js b/test/init/language/js/init-language-js.test.js index 17094f65a87..bbb76d132e5 100644 --- a/test/init/language/js/init-language-js.test.js +++ b/test/init/language/js/init-language-js.test.js @@ -56,9 +56,11 @@ describe('init with Typescript', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['devDependencies']['typescript']).toBeTruthy(); expect(pkgJson['devDependencies']['ts-loader']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); }); diff --git a/test/init/multipleEntries/init-multipleEntries.test.js b/test/init/multipleEntries/init-multipleEntries.test.js index 6f1db08984a..518003a1799 100644 --- a/test/init/multipleEntries/init-multipleEntries.test.js +++ b/test/init/multipleEntries/init-multipleEntries.test.js @@ -51,8 +51,10 @@ describe('init with multiple entries', () => { expect(pkgJson).toBeTruthy(); expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); + expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); expect(pkgJson['devDependencies']['terser-webpack-plugin']).toBeTruthy(); expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] == 'webpack-dev-server').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); }); From f5fc3023121f4d952a166879a46b2653c20b6349 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 8 Feb 2021 18:57:29 +0530 Subject: [PATCH 010/122] fix: show '--node-env' in minimum help output (#2411) --- OPTIONS.md | 2 +- packages/webpack-cli/README.md | 1 + packages/webpack-cli/lib/webpack-cli.js | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OPTIONS.md b/OPTIONS.md index 06a04206bfb..ad5e4473f34 100644 --- a/OPTIONS.md +++ b/OPTIONS.md @@ -9,7 +9,7 @@ Options: --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value + --node-env Sets process.env.NODE_ENV to the specified value. -h, --hot Enables Hot Module Replacement --no-hot Disables Hot Module Replacement. --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. diff --git a/packages/webpack-cli/README.md b/packages/webpack-cli/README.md index a7248a715c6..86941f9f47a 100644 --- a/packages/webpack-cli/README.md +++ b/packages/webpack-cli/README.md @@ -85,6 +85,7 @@ npx webpack-cli --help verbose --config-name Name of the configuration to use. -m, --merge Merge two or more configurations using 'webpack-merge'. --env Environment passed to the configuration when it is a function. + --node-env Sets process.env.NODE_ENV to the specified value. --progress [value] Print compilation progress during build. -j, --json [value] Prints result as JSON or store it in a file. -d, --devtool Determine source maps to use. diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index a95c28eebe1..6e049c5b19d 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -241,6 +241,7 @@ class WebpackCLI { 'json', 'name', 'output-path', + 'node-env', ]; const builtInFlags = [ @@ -299,7 +300,7 @@ class WebpackCLI { name: 'node-env', type: String, multiple: false, - description: 'Sets process.env.NODE_ENV to the specified value', + description: 'Sets process.env.NODE_ENV to the specified value.', }, // Adding more plugins From 217012c96f8f3586b58a9be0c52686f6fd361f1e Mon Sep 17 00:00:00 2001 From: James George Date: Mon, 8 Feb 2021 19:39:43 +0530 Subject: [PATCH 011/122] chore: update types (#2425) --- packages/generators/src/types/index.ts | 1 - packages/generators/src/utils/modify-config-helper.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/generators/src/types/index.ts b/packages/generators/src/types/index.ts index bcd09727b2f..00cc32f4ea8 100644 --- a/packages/generators/src/types/index.ts +++ b/packages/generators/src/types/index.ts @@ -243,7 +243,6 @@ export class CustomGenerator extends Generator { topScope?: string[]; webpackOptions?: WebpackOptions; }; - usingDefaults?: boolean; }; public isProd: boolean; public dependencies: string[]; diff --git a/packages/generators/src/utils/modify-config-helper.ts b/packages/generators/src/utils/modify-config-helper.ts index 8dede3af614..3357e7cccee 100644 --- a/packages/generators/src/utils/modify-config-helper.ts +++ b/packages/generators/src/utils/modify-config-helper.ts @@ -29,7 +29,6 @@ export interface WebpackScaffoldObject extends Object { topScope?: string[]; webpackOptions?: object; }; - usingDefaults?: boolean; } const DEFAULT_WEBPACK_CONFIG_FILENAME = 'webpack.config.js'; From 81a9c60a94dcc3125a3f60a43ce0d73cc0abddee Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 8 Feb 2021 20:14:53 +0530 Subject: [PATCH 012/122] docs: update commands (#2402) --- README.md | 17 +++++++++++------ packages/configtest/README.md | 27 +++++++++++++++++++++++++++ packages/info/README.md | 2 +- 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 packages/configtest/README.md diff --git a/README.md b/README.md index f0eed545f74..365a6b4f262 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,17 @@ We organize webpack CLI as a multi-package repository using [lerna](https://gith Supporting developers is an important task for webpack CLI. Thus, webpack CLI provides different commands for many common tasks. -- [`webpack-cli init`](./packages/init/README.md#webpack-cli-init) - Create a new webpack configuration. -- [`webpack-cli info`](./packages/info/README.md#webpack-cli-info) - Returns information related to the local environment. -- [`webpack-cli migrate`](https://www.npmjs.com/package/@webpack-cli/migrate) - Migrate project from one version to another. -- [`webpack-cli plugin`](./packages/generators#generators) - Initiate new plugin project. -- [`webpack-cli loader`](./packages/generators#generators) - Initiate new loader project. -- [`webpack-cli serve`](./packages/serve/README.md#webpack-cli-serve) - Use webpack with a development server that provides live reloading. +- `build|bundle|b [entries...] [options]` - Run webpack (default command, can be omitted). +- [`configtest|t [config-path]`](./packages/configtest/README.md#webpack-cli-configtest) - Validate a webpack configuration. +- `help|h [command] [option]` - Display help for commands and options. +- [`init|c [scaffold...] [options]`](./packages/init/README.md#webpack-cli-init) - Create a new webpack configuration. +- [`info|i [options]`](./packages/info/README.md#webpack-cli-info) - Returns information related to the local environment. +- [`migrate|m [new-config-path]`](https://www.npmjs.com/package/@webpack-cli/migrate) - Migrate project from one version to another. +- [`plugin|p [output-path]`](./packages/generators#generators) - Initiate new plugin project. +- [`loader|l [output-path]`](./packages/generators#generators) - Initiate new loader project. +- [`serve|s [entries...] [options]`](./packages/serve/README.md#webpack-cli-serve) - Use webpack with a development server that provides live reloading. +- `version|v [commands...]` - Output the version number of `webpack`, `webpack-cli`, `webpack-dev-server`, and commands +- `watch|w [entries...] [options]` - Run webpack and watch for files changes. ### Utilities diff --git a/packages/configtest/README.md b/packages/configtest/README.md new file mode 100644 index 00000000000..07f991f33df --- /dev/null +++ b/packages/configtest/README.md @@ -0,0 +1,27 @@ +# webpack-cli configtest + +[![NPM Downloads][downloads]][downloads-url] + +## Description + +This package validates a webpack configuration. + +## Installation + +```bash +#npm +npm i -D @webpack-cli/configtest + +#yarn +yarn add -D @webpack-cli/configtest + +``` + +## Usage + +```bash +npx webpack configtest [config-path] +``` + +[downloads]: https://img.shields.io/npm/dm/@webpack-cli/configtest.svg +[downloads-url]: https://www.npmjs.com/package/@webpack-cli/configtest diff --git a/packages/info/README.md b/packages/info/README.md index ed1603fc691..4c77be70812 100644 --- a/packages/info/README.md +++ b/packages/info/README.md @@ -13,7 +13,7 @@ This package returns a set of information related to the local environment. npm i -D @webpack-cli/info #yarn -yarn add @webpack-cli/info -D +yarn add -D @webpack-cli/info ``` From 6ae73ec7fb230a31efb70604101267d261da15ad Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Mon, 8 Feb 2021 21:00:14 +0530 Subject: [PATCH 013/122] refactor: use error validation from cli (#2423) --- packages/configtest/src/index.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/packages/configtest/src/index.ts b/packages/configtest/src/index.ts index 50e4a3d9205..15161d85f79 100644 --- a/packages/configtest/src/index.ts +++ b/packages/configtest/src/index.ts @@ -44,17 +44,7 @@ class ConfigTestCommand { throw new webpack.WebpackOptionsValidationError(error); } } catch (error) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const isValidationError = (error: any): boolean => { - // https://github.com/webpack/webpack/blob/master/lib/index.js#L267 - // https://github.com/webpack/webpack/blob/v4.44.2/lib/webpack.js#L90 - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const ValidationError = (webpack.ValidationError || webpack.WebpackOptionsValidationError) as any; - - return error instanceof ValidationError; - }; - - if (isValidationError(error)) { + if (cli.isValidationError(error)) { logger.error(error.message); } else { logger.error(error); From 21a1a30c687cd800396a1c13abefc57bf42886f3 Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Mon, 8 Feb 2021 23:10:30 +0530 Subject: [PATCH 014/122] fix: improve prettier message (#2419) --- .../generators/src/utils/__tests__/run-prettier.test.ts | 4 ++-- packages/generators/src/utils/run-prettier.ts | 6 ++---- packages/generators/src/utils/scaffold.ts | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/generators/src/utils/__tests__/run-prettier.test.ts b/packages/generators/src/utils/__tests__/run-prettier.test.ts index 2f579917a79..e8508520e74 100644 --- a/packages/generators/src/utils/__tests__/run-prettier.test.ts +++ b/packages/generators/src/utils/__tests__/run-prettier.test.ts @@ -20,7 +20,7 @@ describe('runPrettier', () => { }); it('should run prettier on JS string and write file', () => { - runPrettier(outputFile, 'console.log("1");console.log("2");'); + runPrettier(outputFile, 'console.log("1");console.log("2");', 'webpack.config.js'); expect(fs.existsSync(outputFile)).toBeTruthy(); @@ -31,7 +31,7 @@ describe('runPrettier', () => { }); it('prettier should fail on invalid JS, with file still written', () => { - runPrettier(outputFile, '"'); + runPrettier(outputFile, '"', 'webpack.config.js'); expect(fs.existsSync(outputFile)).toBeTruthy(); diff --git a/packages/generators/src/utils/run-prettier.ts b/packages/generators/src/utils/run-prettier.ts index a4c8b06b0fd..734f37f5d40 100644 --- a/packages/generators/src/utils/run-prettier.ts +++ b/packages/generators/src/utils/run-prettier.ts @@ -12,7 +12,7 @@ const { logger } = utils; * @returns {void} Writes a file at given location */ -export function runPrettier(outputPath: string, source: string): void { +export function runPrettier(outputPath: string, source: string, fileName: string): void { let prettySource: string = source; let prettier; @@ -21,9 +21,7 @@ export function runPrettier(outputPath: string, source: string): void { // eslint-disable-next-line node/no-extraneous-require prettier = require('prettier'); } catch (err) { - logger.warn( - "File is not properly formatted because you don't have prettier installed, you can either install it or format it manually", - ); + logger.warn(`${fileName} is not formatted because prettier is not installed locally.`); return fs.writeFileSync(outputPath, source, 'utf8'); } diff --git a/packages/generators/src/utils/scaffold.ts b/packages/generators/src/utils/scaffold.ts index ec38c2278bd..b078eacb2d6 100644 --- a/packages/generators/src/utils/scaffold.ts +++ b/packages/generators/src/utils/scaffold.ts @@ -86,7 +86,7 @@ export function runTransform(transformConfig: TransformConfig, action: string, g const source: string = ast.toSource({ quote: 'single', }); - runPrettier(outputPath, source); + runPrettier(outputPath, source, configurationName); }) .catch((err: Error): void => { logger.error(err); From b8deb52f903cd758d0222ad378e71364aeead994 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 9 Feb 2021 16:20:59 +0300 Subject: [PATCH 015/122] chore(deps-dev): bump ts-jest from 26.5.0 to 26.5.1 (#2427) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 26.5.0 to 26.5.1. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v26.5.0...v26.5.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 4a634ff34ad..92e8c7d967c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10572,9 +10572,9 @@ trim-off-newlines@^1.0.0: integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= ts-jest@^26.4.3: - version "26.5.0" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.0.tgz#3e3417d91bc40178a6716d7dacc5b0505835aa21" - integrity sha512-Ya4IQgvIFNa2Mgq52KaO8yBw2W8tWp61Ecl66VjF0f5JaV8u50nGoptHVILOPGoI7SDnShmEqnYQEmyHdQ+56g== + version "26.5.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.1.tgz#4d53ee4481552f57c1624f0bd3425c8b17996150" + integrity sha512-G7Rmo3OJMvlqE79amJX8VJKDiRcd7/r61wh9fnvvG8cAjhA9edklGw/dCxRSQmfZ/z8NDums5srSVgwZos1qfg== dependencies: "@types/jest" "26.x" bs-logger "0.x" From f5c9b6b5d3485301cbba199beaa5d3595301ee6a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 10 Feb 2021 00:44:32 +0300 Subject: [PATCH 016/122] chore(deps-dev): bump typescript from 4.1.3 to 4.1.4 (#2428) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.3 to 4.1.4. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.1.3...v4.1.4) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 92e8c7d967c..49586cd4c36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10694,9 +10694,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" - integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== + version "4.1.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.4.tgz#f058636e2f4f83f94ddaae07b20fd5e14598432f" + integrity sha512-+Uru0t8qIRgjuCpiSPpfGuhHecMllk5Zsazj5LZvVsEStEjmIRRBZe+jHjGQvsgS7M1wONy2PQXd67EMyV6acg== uglify-js@^3.1.4: version "3.11.4" From 4f559fe69bd7d44c607fb35ce87a46812da7b697 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 11 Feb 2021 14:12:01 +0300 Subject: [PATCH 017/122] chore(deps-dev): bump typescript from 4.1.4 to 4.1.5 (#2433) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.4 to 4.1.5. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.1.4...v4.1.5) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 49586cd4c36..d7e27007095 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10694,9 +10694,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^4.1.3: - version "4.1.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.4.tgz#f058636e2f4f83f94ddaae07b20fd5e14598432f" - integrity sha512-+Uru0t8qIRgjuCpiSPpfGuhHecMllk5Zsazj5LZvVsEStEjmIRRBZe+jHjGQvsgS7M1wONy2PQXd67EMyV6acg== + version "4.1.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" + integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== uglify-js@^3.1.4: version "3.11.4" From f8406e1c5253849fad741eb45f1ece23a7c603f4 Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Thu, 11 Feb 2021 22:04:15 +0530 Subject: [PATCH 018/122] feat: display used config path when logging level=log (#2431) --- .github/workflows/nodejs.yml | 30 +++++++------------ package.json | 1 - .../__tests__/applyCLIPlugin.test.js | 4 +-- packages/webpack-cli/lib/plugins/CLIPlugin.js | 26 ++++++++++++---- packages/webpack-cli/lib/webpack-cli.js | 2 +- test/build/basic/basic.test.js | 16 ++++++++++ test/build/basic/log.config.js | 6 ++++ .../core-flags/infrastructure-logging.test.js | 4 +-- test/json/json.test.js | 15 ++++++---- test/serve/basic/log.config.js | 6 ++++ test/serve/basic/serve-basic.test.js | 10 +++++++ test/watch/basic/basic.test.js | 22 ++++++++++++++ test/watch/basic/log.config.js | 6 ++++ 13 files changed, 113 insertions(+), 35 deletions(-) create mode 100644 test/build/basic/log.config.js create mode 100644 test/serve/basic/log.config.js create mode 100644 test/watch/basic/log.config.js diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 351cdbadfa1..837f99b1ac1 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -35,12 +35,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install dependencies - run: | - yarn - yarn bootstrap - - - name: Install webpack ${{ matrix.webpack-version }} - run: yarn add -W webpack@${{ matrix.webpack-version }} + run: yarn - name: Build run: yarn build @@ -57,7 +52,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] node-version: [10.x, 12.x, 14.x] - webpack-version: [webpack-4, latest] + webpack-version: [4, latest] steps: - uses: actions/checkout@v2 @@ -76,27 +71,24 @@ jobs: path: | node_modules */*/node_modules - key: ${{ runner.os }}-${{ matrix.webpack-version }}-${{ hashFiles('**/yarn.lock', './yarn.lock') }} + key: ${{ runner.os }}-${{ matrix.webpack-version }}-yarn-${{ hashFiles('**/yarn.lock', './yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.webpack-version }}-yarn- - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: | - yarn - yarn bootstrap + run: yarn - name: Install webpack ${{ matrix.webpack-version }} - if: matrix.webpack-version == 'webpack-4' + if: matrix.webpack-version == '4' run: yarn add -W webpack@${{ matrix.webpack-version }} - - name: Build and Bootstrap - run: | - yarn build:ci - yarn run lerna bootstrap + - name: Prepare environment for tests + run: yarn build:ci - - name: Run Smoketests + - name: Run smoketests run: yarn test:smoketests - - name: Test and Generate Coverage + - name: Run tests and generate coverage run: | yarn prepsuite yarn test:coverage diff --git a/package.json b/package.json index 64039a18326..368f125a321 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "./packages/*" ], "scripts": { - "bootstrap": "lerna bootstrap", "clean": "del-cli \"*.tsbuildinfo\" \"packages/**/*.tsbuildinfo\" \"packages/!(webpack-cli)/lib/!(*.tpl)\" \"**/.yo-rc.json\"", "prebuild": "yarn clean", "prebuild:ci": "yarn clean && node ./scripts/setupBuild.js", diff --git a/packages/webpack-cli/__tests__/applyCLIPlugin.test.js b/packages/webpack-cli/__tests__/applyCLIPlugin.test.js index 7c90277c5a1..7889a7af624 100644 --- a/packages/webpack-cli/__tests__/applyCLIPlugin.test.js +++ b/packages/webpack-cli/__tests__/applyCLIPlugin.test.js @@ -5,7 +5,7 @@ const applyCLIPlugin = new webpackCLI().applyCLIPlugin; describe('CLIPluginResolver', () => { it('should add CLI plugin to single compiler object', async () => { - const result = await applyCLIPlugin({ options: {} }, { hot: true, prefetch: true }); + const result = await applyCLIPlugin({ options: {}, path: new WeakMap() }, { hot: true, prefetch: true }); expect(result.options.plugins[0] instanceof CLIPlugin).toBeTruthy(); expect(result.options.plugins[0].options).toEqual({ configPath: undefined, @@ -18,7 +18,7 @@ describe('CLIPluginResolver', () => { }); it('should add CLI plugin to multi compiler object', async () => { - const result = await applyCLIPlugin({ options: [{}, {}] }, { hot: true, prefetch: true }); + const result = await applyCLIPlugin({ options: [{}, {}], path: new WeakMap() }, { hot: true, prefetch: true }); expect(result.options[0].plugins[0] instanceof CLIPlugin).toBeTruthy(); expect(result.options[1].plugins[0] instanceof CLIPlugin).toBeTruthy(); expect(result.options).toEqual([ diff --git a/packages/webpack-cli/lib/plugins/CLIPlugin.js b/packages/webpack-cli/lib/plugins/CLIPlugin.js index 350ee33e573..363221e3fd6 100644 --- a/packages/webpack-cli/lib/plugins/CLIPlugin.js +++ b/packages/webpack-cli/lib/plugins/CLIPlugin.js @@ -39,10 +39,18 @@ class CLIPlugin { setupHelpfulOutput(compiler) { const pluginName = 'webpack-cli'; - const getCompilationName = () => (compiler.name ? ` '${compiler.name}'` : ''); + const getCompilationName = () => (compiler.name ? `'${compiler.name}'` : ''); + + const { configPath } = this.options; compiler.hooks.run.tap(pluginName, () => { - this.logger.log(`Compilation${getCompilationName()} starting...`); + const name = getCompilationName(); + + this.logger.log(`Compiler${name ? ` ${name}` : ''} starting...`); + + if (configPath) { + this.logger.log(`Compiler${name ? ` ${name}` : ''} is using config: '${configPath}'`); + } }); compiler.hooks.watchRun.tap(pluginName, (compiler) => { @@ -52,7 +60,13 @@ class CLIPlugin { this.logger.warn('You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.'); } - this.logger.log(`Compilation${getCompilationName()} starting...`); + const name = getCompilationName(); + + this.logger.log(`Compiler${name ? ` ${name}` : ''} starting...`); + + if (configPath) { + this.logger.log(`Compiler${name ? ` ${name}` : ''} is using config: '${configPath}'`); + } }); compiler.hooks.invalid.tap(pluginName, (filename, changeTime) => { @@ -63,11 +77,13 @@ class CLIPlugin { }); (compiler.webpack ? compiler.hooks.afterDone : compiler.hooks.done).tap(pluginName, () => { - this.logger.log(`Compilation${getCompilationName()} finished`); + const name = getCompilationName(); + + this.logger.log(`Compiler${name ? ` ${name}` : ''} finished`); process.nextTick(() => { if (compiler.watchMode) { - this.logger.log(`Compiler${getCompilationName()} is watching files for updates...`); + this.logger.log(`Compiler${name ? `${name}` : ''} is watching files for updates...`); } }); }); diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 6e049c5b19d..4ce7ad3254f 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -1631,7 +1631,7 @@ class WebpackCLI { configOptions.plugins.unshift( new CLIPlugin({ - configPath: config.path, + configPath: config.path.get(configOptions), helpfulOutput: !cliOptions.json, hot: cliOptions.hot, progress: cliOptions.progress, diff --git a/test/build/basic/basic.test.js b/test/build/basic/basic.test.js index 01481187f45..1b559e77599 100644 --- a/test/build/basic/basic.test.js +++ b/test/build/basic/basic.test.js @@ -1,5 +1,7 @@ 'use strict'; +const stripAnsi = require('strip-ansi'); +const { resolve } = require('path'); const { run } = require('../../utils/test-utils'); describe('bundle command', () => { @@ -140,4 +142,18 @@ describe('bundle command', () => { expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); expect(stdout).toBeFalsy(); }); + + it('should log supplied config when logging level is log', () => { + const { exitCode, stderr, stdout } = run(__dirname, ['--config', './log.config.js']); + const configPath = resolve(__dirname, './log.config.js'); + + expect(exitCode).toBe(0); + + const pureStderr = stripAnsi(stderr); + + expect(pureStderr).toContain('Compiler starting...'); + expect(pureStderr).toContain(`Compiler is using config: '${configPath}'`); + expect(pureStderr).toContain('Compiler finished'); + expect(stdout).toBeTruthy(); + }); }); diff --git a/test/build/basic/log.config.js b/test/build/basic/log.config.js new file mode 100644 index 00000000000..70619a29563 --- /dev/null +++ b/test/build/basic/log.config.js @@ -0,0 +1,6 @@ +module.exports = { + mode: 'development', + infrastructureLogging: { + level: 'log', + }, +}; diff --git a/test/core-flags/infrastructure-logging.test.js b/test/core-flags/infrastructure-logging.test.js index 9e408f2d46b..8c2f8645169 100644 --- a/test/core-flags/infrastructure-logging.test.js +++ b/test/core-flags/infrastructure-logging.test.js @@ -23,8 +23,8 @@ describe('infrastructure logging related flag', () => { const { exitCode, stderr, stdout } = run(__dirname, ['--infrastructure-logging-level', 'log']); expect(exitCode).toBe(0); - expect(stderr).toContain("Compilation 'compiler' starting..."); - expect(stderr).toContain("Compilation 'compiler' finished"); + expect(stderr).toContain("Compiler 'compiler' starting..."); + expect(stderr).toContain("Compiler 'compiler' finished"); expect(stdout).toContain(`level: 'log'`); }); }); diff --git a/test/json/json.test.js b/test/json/json.test.js index 64441e4504a..49022409705 100644 --- a/test/json/json.test.js +++ b/test/json/json.test.js @@ -1,4 +1,6 @@ 'use strict'; + +const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -111,8 +113,8 @@ describe('json', () => { const { exitCode, stderr, stdout } = run(__dirname, ['--json', '--config', 'logging.config.js']); expect(exitCode).toBe(0); - expect(stderr).toContain('Compilation starting'); - expect(stderr).toContain('Compilation finished'); + expect(stderr).toContain('Compiler starting...'); + expect(stderr).toContain('Compiler finished'); expect(() => JSON.parse(stdout)).not.toThrow(); expect(JSON.parse(stdout)['hash']).toBeDefined(); }); @@ -121,9 +123,12 @@ describe('json', () => { const { exitCode, stderr, stdout } = run(__dirname, ['--json', 'stats.json', '--config', 'logging.config.js']); expect(exitCode).toBe(0); - expect(stderr).toContain('Compilation starting'); - expect(stderr).toContain('Compilation finished'); - expect(stderr).toContain(successMessage); + + const pureStderr = stripAnsi(stderr); + + expect(stderr).toContain('Compiler starting...'); + expect(pureStderr).toContain('Compiler finished'); + expect(pureStderr).toContain(successMessage); expect(stdout).toBeFalsy(); expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); diff --git a/test/serve/basic/log.config.js b/test/serve/basic/log.config.js new file mode 100644 index 00000000000..70619a29563 --- /dev/null +++ b/test/serve/basic/log.config.js @@ -0,0 +1,6 @@ +module.exports = { + mode: 'development', + infrastructureLogging: { + level: 'log', + }, +}; diff --git a/test/serve/basic/serve-basic.test.js b/test/serve/basic/serve-basic.test.js index d215cea596e..e5b1335bb60 100644 --- a/test/serve/basic/serve-basic.test.js +++ b/test/serve/basic/serve-basic.test.js @@ -306,6 +306,16 @@ describe('basic serve usage', () => { expect(stdout.match(/HotModuleReplacementPlugin/g)).toBeNull(); }); + it('should log used supplied config with serve', async () => { + const { stderr, stdout } = await runServe(__dirname, ['--config', 'log.config.js', '--port', port]); + const configPath = path.resolve(__dirname, './log.config.js'); + + expect(stderr).toContain('Compiler starting...'); + expect(stderr).toContain(`Compiler is using config: '${configPath}'`); + expect(stderr).toContain('Compiler finished'); + expect(stdout).toBeTruthy(); + }); + it("should log error on using '--watch' flag with serve", async () => { const { stdout, stderr } = await runServe(testPath, ['--watch']); diff --git a/test/watch/basic/basic.test.js b/test/watch/basic/basic.test.js index 29013daeff3..bced22c1988 100644 --- a/test/watch/basic/basic.test.js +++ b/test/watch/basic/basic.test.js @@ -159,6 +159,28 @@ describe('basic', () => { }); }); + it('should log supplied config with watch', (done) => { + const proc = runAndGetWatchProc(__dirname, ['watch', '--config', 'log.config.js']); + const configPath = resolve(__dirname, './log.config.js'); + + let stderr = ''; + + proc.stderr.on('data', (chunk) => { + const data = stripAnsi(chunk.toString()); + + stderr += stripAnsi(data); + + if (/Compiler finished/.test(data)) { + expect(stderr).toContain('Compiler starting...'); + expect(stderr).toContain(`Compiler is using config: '${configPath}'`); + expect(stderr).toContain('Compiler finished'); + + proc.kill(); + done(); + } + }); + }); + it('should recompile upon file change using the `command` option and the `--watch` option and log warning', async () => { const { exitCode, stderr, stdout } = await run(__dirname, ['watch', '--watch', '--mode', 'development']); diff --git a/test/watch/basic/log.config.js b/test/watch/basic/log.config.js new file mode 100644 index 00000000000..70619a29563 --- /dev/null +++ b/test/watch/basic/log.config.js @@ -0,0 +1,6 @@ +module.exports = { + mode: 'development', + infrastructureLogging: { + level: 'log', + }, +}; From 4fd643207bee9219613c58685f5217f128430c2c Mon Sep 17 00:00:00 2001 From: James George Date: Fri, 12 Feb 2021 16:11:41 +0530 Subject: [PATCH 019/122] docs: remove reference to init package (#2432) --- README.md | 2 +- packages/README.md | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 365a6b4f262..5c3717d8a69 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Thus, webpack CLI provides different commands for many common tasks. - `build|bundle|b [entries...] [options]` - Run webpack (default command, can be omitted). - [`configtest|t [config-path]`](./packages/configtest/README.md#webpack-cli-configtest) - Validate a webpack configuration. - `help|h [command] [option]` - Display help for commands and options. -- [`init|c [scaffold...] [options]`](./packages/init/README.md#webpack-cli-init) - Create a new webpack configuration. +- [`init|c [scaffold...] [options]`](./INIT.md#webpack-cli-init) - Create a new webpack configuration. - [`info|i [options]`](./packages/info/README.md#webpack-cli-info) - Returns information related to the local environment. - [`migrate|m [new-config-path]`](https://www.npmjs.com/package/@webpack-cli/migrate) - Migrate project from one version to another. - [`plugin|p [output-path]`](./packages/generators#generators) - Initiate new plugin project. diff --git a/packages/README.md b/packages/README.md index ea522074275..680f46c8ff0 100644 --- a/packages/README.md +++ b/packages/README.md @@ -16,10 +16,9 @@ This folder is the collection of those packages. 1. [configtest](https://github.com/webpack/webpack-cli/tree/master/packages/configtest) 2. [generators](https://github.com/webpack/webpack-cli/tree/master/packages/generators) 3. [info](https://github.com/webpack/webpack-cli/tree/master/packages/info) -4. [init](https://github.com/webpack/webpack-cli/tree/master/packages/init) -5. [migrate](https://www.npmjs.com/package/@webpack-cli/migrate) -6. [serve](https://github.com/webpack/webpack-cli/tree/master/packages/serve) -7. [webpack-cli](https://github.com/webpack/webpack-cli/tree/master/packages/webpack-cli) +4. [migrate](https://www.npmjs.com/package/@webpack-cli/migrate) +5. [serve](https://github.com/webpack/webpack-cli/tree/master/packages/serve) +6. [webpack-cli](https://github.com/webpack/webpack-cli/tree/master/packages/webpack-cli) ## Generic Installation From 2968b491d8f350dfee618f2645495e1438275f53 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 13 Feb 2021 18:40:26 +0300 Subject: [PATCH 020/122] chore(deps-dev): bump eslint from 7.19.0 to 7.20.0 (#2436) Bumps [eslint](https://github.com/eslint/eslint) from 7.19.0 to 7.20.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.19.0...v7.20.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index d7e27007095..048cbaf4ff9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== +"@babel/code-frame@7.12.11", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" @@ -4417,11 +4417,11 @@ eslint-visitor-keys@^2.0.0: integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== eslint@^7.12.1: - version "7.19.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.19.0.tgz#6719621b196b5fad72e43387981314e5d0dc3f41" - integrity sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg== + version "7.20.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.20.0.tgz#db07c4ca4eda2e2316e7aa57ac7fc91ec550bdc7" + integrity sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw== dependencies: - "@babel/code-frame" "^7.0.0" + "@babel/code-frame" "7.12.11" "@eslint/eslintrc" "^0.3.0" ajv "^6.10.0" chalk "^4.0.0" @@ -4433,7 +4433,7 @@ eslint@^7.12.1: eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" espree "^7.3.1" - esquery "^1.2.0" + esquery "^1.4.0" esutils "^2.0.2" file-entry-cache "^6.0.0" functional-red-black-tree "^1.0.1" @@ -4473,10 +4473,10 @@ esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" - integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" From 2f9383619f12142ecd99dd3a8ff2eb2c550aea9e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 13 Feb 2021 18:40:42 +0300 Subject: [PATCH 021/122] chore(deps-dev): bump @types/prettier Bumps [@types/prettier](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prettier) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prettier) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 048cbaf4ff9..d78cce28f4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1956,9 +1956,9 @@ integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== "@types/prettier@^2.0.0", "@types/prettier@^2.1.5": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.0.tgz#a4e8205a4955690eef712a6d0394a1d2e121e721" - integrity sha512-O3SQC6+6AySHwrspYn2UvC6tjo6jCTMMmylxZUFhE1CulVu5l3AxU6ca9lrJDTQDVllF62LIxVSx5fuYL6LiZg== + version "2.2.1" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.1.tgz#374e31645d58cb18a07b3ecd8e9dede4deb2cccd" + integrity sha512-DxZZbyMAM9GWEzXL+BMZROWz9oo6A9EilwwOMET2UVu2uZTqMWS5S69KVtuVKaRjCUpcrOXRalet86/OpG4kqw== "@types/responselike@*", "@types/responselike@^1.0.0": version "1.0.0" From 27201fb7a5701b0c8658bcf55b9ae542a4b69632 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:45:06 +0300 Subject: [PATCH 022/122] chore(deps-dev): bump @types/node Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.25 to 14.14.27. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index d78cce28f4d..38acf71dd3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,9 +1941,9 @@ integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.6": - version "14.14.25" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.25.tgz#15967a7b577ff81383f9b888aa6705d43fbbae93" - integrity sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ== + version "14.14.27" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.27.tgz#c7127f8da0498993e13b1a42faf1303d3110d2f2" + integrity sha512-Ecfmo4YDQPwuqTCl1yBxLV5ihKfRlkBmzUEDcfIRvDxOTGQEeikr317Ln7Gcv0tjA8dVgKI3rniqW2G1OyKDng== "@types/normalize-package-data@^2.4.0": version "2.4.0" From 09bb615eba303dd4a3b371c7e33948532e9f5678 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Feb 2021 14:06:20 +0300 Subject: [PATCH 023/122] chore(deps): bump commander from 7.0.0 to 7.1.0 (#2440) Bumps [commander](https://github.com/tj/commander.js) from 7.0.0 to 7.1.0. - [Release notes](https://github.com/tj/commander.js/releases) - [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/tj/commander.js/compare/v7.0.0...v7.1.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 38acf71dd3c..cf6a0971a4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3388,9 +3388,9 @@ commander@^6.2.0: integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== commander@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-7.0.0.tgz#3e2bbfd8bb6724760980988fb5b22b7ee6b71ab2" - integrity sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA== + version "7.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-7.1.0.tgz#f2eaecf131f10e36e07d894698226e36ae0eb5ff" + integrity sha512-pRxBna3MJe6HKnBGsDyMv8ETbptw3axEdYHoqNh7gu5oDcew8fs0xnivZGm06Ogk8zGAJ9VX+OPEr2GXEQK4dg== commitlint@^11.0.0: version "11.0.0" From 358391101f5a463f1c0528b7e132e66d936e1f4a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Feb 2021 14:11:03 +0300 Subject: [PATCH 024/122] chore(deps-dev): bump @types/node Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.27 to 14.14.28. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index cf6a0971a4b..f1278f110ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,9 +1941,9 @@ integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.6": - version "14.14.27" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.27.tgz#c7127f8da0498993e13b1a42faf1303d3110d2f2" - integrity sha512-Ecfmo4YDQPwuqTCl1yBxLV5ihKfRlkBmzUEDcfIRvDxOTGQEeikr317Ln7Gcv0tjA8dVgKI3rniqW2G1OyKDng== + version "14.14.28" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.28.tgz#cade4b64f8438f588951a6b35843ce536853f25b" + integrity sha512-lg55ArB+ZiHHbBBttLpzD07akz0QPrZgUODNakeC09i62dnrywr9mFErHuaPlB6I7z+sEbK+IYmplahvplCj2g== "@types/normalize-package-data@^2.4.0": version "2.4.0" From ff3dcda254216eff182e6d48629c2db8240eabb3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 15 Feb 2021 16:08:33 +0300 Subject: [PATCH 025/122] chore(deps-dev): bump webpack from 5.21.2 to 5.22.0 (#2441) Bumps [webpack](https://github.com/webpack/webpack) from 5.21.2 to 5.22.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.21.2...v5.22.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f1278f110ee..8a1422527ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11075,9 +11075,9 @@ webpack-sources@^2.1.1: source-map "^0.6.1" webpack@^5.21.1: - version "5.21.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.2.tgz#647507e50d3637695be28af58a6a8246050394e7" - integrity sha512-xHflCenx+AM4uWKX71SWHhxml5aMXdy2tu/vdi4lClm7PADKxlyDAFFN1rEFzNV0MAoPpHtBeJnl/+K6F4QBPg== + version "5.22.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.22.0.tgz#8505158bc52dcbbdb01ac94796a8aed61badf11a" + integrity sha512-xqlb6r9RUXda/d9iA6P7YRTP1ChWeP50TEESKMMNIg0u8/Rb66zN9YJJO7oYgJTRyFyYi43NVC5feG45FSO1vQ== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" From 4c786e39f342414948c9620f128f67f8b1e821e2 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 15 Feb 2021 21:56:05 +0530 Subject: [PATCH 026/122] test: disable colors on CI by default (#2404) --- setupTest.js | 6 + .../webpack-dev-server.test.js | 2 + smoketests/missing-packages/webpack.test.js | 2 + test/analyze/analyze-flag.test.js | 5 +- test/build-errors/errors.test.js | 3 +- test/build-warnings/warnings.test.js | 3 +- test/build/basic/basic.test.js | 10 +- test/colors/colors.test.js | 18 +- test/config/multiple/multiple-config.test.js | 8 +- test/core-flags/context-flag.test.js | 3 +- test/defaults/output-defaults.test.js | 3 +- .../defaults-empty/entry-single-arg.test.js | 3 +- test/entry/flag-entry/entry-with-flag.test.js | 3 +- test/help/help.test.js | 357 ++++++++---------- test/init/auto/init-auto.test.js | 3 +- test/init/generator/init-inquirer.test.js | 7 +- test/json/json.test.js | 10 +- test/loader/loader.test.js | 11 +- .../mode-single-arg/mode-single-arg.test.js | 8 +- test/plugin/plugin.test.js | 11 +- test/prefetch/prefetch.test.js | 3 +- test/serve/basic/serve-basic.test.js | 5 +- test/serve/help/serve-help.test.js | 43 --- test/stats/watch/stats-and-watch.test.js | 6 +- test/unknown/unknown.test.js | 17 +- test/utils/test-utils.js | 6 +- test/version/version.test.js | 86 ++--- test/watch/basic/basic.test.js | 15 +- .../watch-variable/watch-variable.test.js | 5 +- .../entry-absent/zero-config.test.js | 3 +- 30 files changed, 287 insertions(+), 378 deletions(-) delete mode 100644 test/serve/help/serve-help.test.js diff --git a/setupTest.js b/setupTest.js index 43e2888a655..6234cd7fd26 100644 --- a/setupTest.js +++ b/setupTest.js @@ -1 +1,7 @@ +/*global jasmine*/ + jest.setTimeout(240000); + +if (!jasmine.testPath.includes('colors.test.js')) { + process.env.NO_COLOR = true; +} diff --git a/smoketests/missing-packages/webpack-dev-server.test.js b/smoketests/missing-packages/webpack-dev-server.test.js index b0ae710b83d..b5ec3f57a53 100644 --- a/smoketests/missing-packages/webpack-dev-server.test.js +++ b/smoketests/missing-packages/webpack-dev-server.test.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); const execa = require('execa'); const { renameSync } = require('fs'); diff --git a/smoketests/missing-packages/webpack.test.js b/smoketests/missing-packages/webpack.test.js index 31a500ae380..0be70358b7f 100644 --- a/smoketests/missing-packages/webpack.test.js +++ b/smoketests/missing-packages/webpack.test.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); const execa = require('execa'); const { renameSync } = require('fs'); diff --git a/test/analyze/analyze-flag.test.js b/test/analyze/analyze-flag.test.js index 9f86a3dc3c8..972a00223eb 100644 --- a/test/analyze/analyze-flag.test.js +++ b/test/analyze/analyze-flag.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run, runAndGetWatchProc } = require('../utils/test-utils'); describe('--analyze flag', () => { @@ -24,7 +23,7 @@ describe('--analyze flag', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain('Webpack Bundle Analyzer saved report to'); - expect(stripAnsi(stdout).match(/Webpack Bundle Analyzer saved report to/g)).toHaveLength(1); + expect(stdout).toContain('Webpack Bundle Analyzer saved report to'); + expect(stdout.match(/Webpack Bundle Analyzer saved report to/g)).toHaveLength(1); }); }); diff --git a/test/build-errors/errors.test.js b/test/build-errors/errors.test.js index 3147000a8b3..c64b439e2f8 100644 --- a/test/build-errors/errors.test.js +++ b/test/build-errors/errors.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const { readFile } = require('fs'); const { resolve } = require('path'); @@ -12,7 +11,7 @@ describe('errors', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); expect(stdout).toMatch(/ERROR/); - expect(stripAnsi(stdout)).toMatch(/Error: Can't resolve/); + expect(stdout).toMatch(/Error: Can't resolve/); }); it('should output JSON with the "json" flag', () => { diff --git a/test/build-warnings/warnings.test.js b/test/build-warnings/warnings.test.js index c58d9b9fab8..65971088470 100644 --- a/test/build-warnings/warnings.test.js +++ b/test/build-warnings/warnings.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -12,7 +11,7 @@ describe('warnings', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toMatch(/WARNING/); - expect(stripAnsi(stdout)).toMatch(/Error: Can't resolve/); + expect(stdout).toMatch(/Error: Can't resolve/); }); it('should output JSON with the "json" flag', () => { diff --git a/test/build/basic/basic.test.js b/test/build/basic/basic.test.js index 1b559e77599..11b49da017d 100644 --- a/test/build/basic/basic.test.js +++ b/test/build/basic/basic.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { resolve } = require('path'); const { run } = require('../../utils/test-utils'); @@ -148,12 +147,9 @@ describe('bundle command', () => { const configPath = resolve(__dirname, './log.config.js'); expect(exitCode).toBe(0); - - const pureStderr = stripAnsi(stderr); - - expect(pureStderr).toContain('Compiler starting...'); - expect(pureStderr).toContain(`Compiler is using config: '${configPath}'`); - expect(pureStderr).toContain('Compiler finished'); + expect(stderr).toContain('Compiler starting...'); + expect(stderr).toContain(`Compiler is using config: '${configPath}'`); + expect(stderr).toContain('Compiler finished'); expect(stdout).toBeTruthy(); }); }); diff --git a/test/colors/colors.test.js b/test/colors/colors.test.js index 8e7348f8480..af302374c93 100644 --- a/test/colors/colors.test.js +++ b/test/colors/colors.test.js @@ -3,7 +3,7 @@ const { run, isWebpack5 } = require('../utils/test-utils'); const { resolve } = require('path'); -describe('colors related tests', () => { +describe('colors', () => { it('should output by default', () => { const { exitCode, stderr, stdout } = run(__dirname, [], { env: { FORCE_COLOR: true } }); @@ -46,23 +46,23 @@ describe('colors related tests', () => { expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); - it('should disable colored output with --no-color', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose', '--no-color']); + it('should work with the "stats" option and --color flags', () => { + const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose', '--color']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); - expect(stdout).toContain(output); + expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); - it('should work with the "stats" option and --color flags', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose', '--color']); + it('should disable colored output with --no-color', () => { + const { exitCode, stderr, stdout } = run(__dirname, ['--stats=verbose', '--no-color']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); const output = isWebpack5 ? 'successfully' : 'main.js'; - expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); + expect(stdout).not.toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); + expect(stdout).toContain(output); }); it('should work with the "stats" option from the configuration', () => { @@ -120,7 +120,7 @@ describe('colors related tests', () => { expect(stdout).toContain(`\u001b[1m\u001b[32m${output}\u001b[39m\u001b[22m`); }); - it('should prioratize --no-color over colors in config', () => { + it('should prioritize --no-color over colors in config', () => { const { exitCode, stderr, stdout } = run(__dirname, ['--config=colors-true.webpack.config.js', '--no-color']); expect(exitCode).toBe(0); diff --git a/test/config/multiple/multiple-config.test.js b/test/config/multiple/multiple-config.test.js index feee98f7bda..ea36be69ad9 100644 --- a/test/config/multiple/multiple-config.test.js +++ b/test/config/multiple/multiple-config.test.js @@ -1,16 +1,16 @@ -const stripAnsi = require('strip-ansi'); +'use strict'; const { run } = require('../../utils/test-utils'); describe('Multiple config flag: ', () => { it('spawns multiple compilers for multiple configs', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['-c', 'webpack1.config.js', '-c', 'webpack2.config.js'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['--config', 'webpack1.config.js', '--config', 'webpack2.config.js'], false); // Should contain the correct exit code expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); // Should spawn multiple compilers - expect(stripAnsi(stdout)).toContain('amd:'); - expect(stripAnsi(stdout)).toContain('commonjs:'); + expect(stdout).toContain('amd:'); + expect(stdout).toContain('commonjs:'); }); }); diff --git a/test/core-flags/context-flag.test.js b/test/core-flags/context-flag.test.js index 20b4072f84e..df4050e94a7 100644 --- a/test/core-flags/context-flag.test.js +++ b/test/core-flags/context-flag.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { resolve } = require('path'); const { run, isWindows } = require('../utils/test-utils'); @@ -24,6 +23,6 @@ describe('--context flag', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain(`Module not found: Error: Can't resolve './src/main.js'`); + expect(stdout).toContain(`Module not found: Error: Can't resolve './src/main.js'`); }); }); diff --git a/test/defaults/output-defaults.test.js b/test/defaults/output-defaults.test.js index 910419745a9..70c73359f7b 100644 --- a/test/defaults/output-defaults.test.js +++ b/test/defaults/output-defaults.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { existsSync } = require('fs'); const { resolve } = require('path'); const { run } = require('../utils/test-utils'); @@ -12,7 +11,7 @@ describe('output flag defaults', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); // Should print warning about config fallback - expect(stripAnsi(stdout)).toContain('option has not been set, webpack will fallback to'); + expect(stdout).toContain('option has not been set, webpack will fallback to'); expect(existsSync(resolve(__dirname, './binary/main.js'))).toBeTruthy(); }); diff --git a/test/entry/defaults-empty/entry-single-arg.test.js b/test/entry/defaults-empty/entry-single-arg.test.js index b4d6cf07f86..d6274bf2e8f 100644 --- a/test/entry/defaults-empty/entry-single-arg.test.js +++ b/test/entry/defaults-empty/entry-single-arg.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run } = require('../../utils/test-utils'); describe('single entry flag empty project', () => { @@ -9,6 +8,6 @@ describe('single entry flag empty project', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain(`not found: Error: Can't resolve`); + expect(stdout).toContain(`not found: Error: Can't resolve`); }); }); diff --git a/test/entry/flag-entry/entry-with-flag.test.js b/test/entry/flag-entry/entry-with-flag.test.js index b2d02f9f3fd..90e465042ad 100644 --- a/test/entry/flag-entry/entry-with-flag.test.js +++ b/test/entry/flag-entry/entry-with-flag.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run } = require('../../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -40,6 +39,6 @@ describe('entry flag', () => { expect(exitCode).toEqual(1); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain("Module not found: Error: Can't resolve"); + expect(stdout).toContain("Module not found: Error: Can't resolve"); }); }); diff --git a/test/help/help.test.js b/test/help/help.test.js index 4f1b703ede1..c99062b81d0 100644 --- a/test/help/help.test.js +++ b/test/help/help.test.js @@ -1,7 +1,6 @@ 'use strict'; const stripAnsi = require('strip-ansi'); -const { bold, enabled: coloretteEnabled } = require('colorette'); const { run, isWebpack5 } = require('../utils/test-utils'); const helpDefaultHeader = 'The build tool for modern web applications.'; @@ -13,30 +12,28 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack [entries...] [options]'); - expect(pureStdout).toContain('webpack [command] [options]'); - expect(pureStdout).toContain(helpDefaultHeader); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--merge'); // minimum - expect(pureStdout).not.toContain('--cache-type'); // verbose - expect(pureStdout).toContain('Global options:'); - expect(pureStdout).toContain('Commands:'); - expect(pureStdout.match(/build\|bundle\|b/g)).toHaveLength(1); - expect(pureStdout.match(/watch\|w/g)).toHaveLength(1); - expect(pureStdout.match(/version\|v/g)).toHaveLength(1); - expect(pureStdout.match(/help\|h/g)).toHaveLength(1); - expect(pureStdout.match(/serve\|s/g)).toHaveLength(1); - expect(pureStdout.match(/info\|i/g)).toHaveLength(1); - expect(pureStdout.match(/init\|c/g)).toHaveLength(1); - expect(pureStdout.match(/loader\|l/g)).toHaveLength(1); - expect(pureStdout.match(/plugin\|p/g)).toHaveLength(1); - expect(pureStdout.match(/migrate\|m/g)).toHaveLength(1); - expect(pureStdout.match(/configtest\|t/g)).toHaveLength(1); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - expect(pureStdout).toContain('Made with ♥ by the webpack team.'); + expect(stdout).toContain('webpack [entries...] [options]'); + expect(stdout).toContain('webpack [command] [options]'); + expect(stdout).toContain(helpDefaultHeader); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--merge'); // minimum + expect(stdout).not.toContain('--cache-type'); // verbose + expect(stdout).toContain('Global options:'); + expect(stdout).toContain('Commands:'); + expect(stdout.match(/build\|bundle\|b/g)).toHaveLength(1); + expect(stdout.match(/watch\|w/g)).toHaveLength(1); + expect(stdout.match(/version\|v/g)).toHaveLength(1); + expect(stdout.match(/help\|h/g)).toHaveLength(1); + expect(stdout.match(/serve\|s/g)).toHaveLength(1); + expect(stdout.match(/info\|i/g)).toHaveLength(1); + expect(stdout.match(/init\|c/g)).toHaveLength(1); + expect(stdout.match(/loader\|l/g)).toHaveLength(1); + expect(stdout.match(/plugin\|p/g)).toHaveLength(1); + expect(stdout.match(/migrate\|m/g)).toHaveLength(1); + expect(stdout.match(/configtest\|t/g)).toHaveLength(1); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it.skip('should show help information using the "--help" option with the "verbose" value', () => { @@ -44,34 +41,31 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack [entries...] [options]'); - expect(pureStdout).toContain('webpack [command] [options]'); - expect(pureStdout).toContain(helpDefaultHeader); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--merge'); // minimum + expect(stdout).toContain('webpack [entries...] [options]'); + expect(stdout).toContain('webpack [command] [options]'); + expect(stdout).toContain(helpDefaultHeader); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--merge'); // minimum if (isWebpack5) { - expect(pureStdout).toContain('--cache-type'); // verbose + expect(stdout).toContain('--cache-type'); // verbose } - expect(pureStdout).toContain('Global options:'); - expect(pureStdout).toContain('Commands:'); - expect(pureStdout.match(/build\|bundle\|b/g)).toHaveLength(1); - expect(pureStdout.match(/watch\|w/g)).toHaveLength(1); - expect(pureStdout.match(/version\|v/g)).toHaveLength(1); - expect(pureStdout.match(/help\|h/g)).toHaveLength(1); - expect(pureStdout.match(/serve\|s/g)).toHaveLength(1); - expect(pureStdout.match(/info\|i/g)).toHaveLength(1); - expect(pureStdout.match(/init\|c/g)).toHaveLength(1); - expect(pureStdout.match(/loader\|l/g)).toHaveLength(1); - expect(pureStdout.match(/plugin\|p/g)).toHaveLength(1); - expect(pureStdout.match(/migrate\|m/g)).toHaveLength(1); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - expect(pureStdout).toContain('Made with ♥ by the webpack team.'); + expect(stdout).toContain('Global options:'); + expect(stdout).toContain('Commands:'); + expect(stdout.match(/build\|bundle\|b/g)).toHaveLength(1); + expect(stdout.match(/watch\|w/g)).toHaveLength(1); + expect(stdout.match(/version\|v/g)).toHaveLength(1); + expect(stdout.match(/help\|h/g)).toHaveLength(1); + expect(stdout.match(/serve\|s/g)).toHaveLength(1); + expect(stdout.match(/info\|i/g)).toHaveLength(1); + expect(stdout.match(/init\|c/g)).toHaveLength(1); + expect(stdout.match(/loader\|l/g)).toHaveLength(1); + expect(stdout.match(/plugin\|p/g)).toHaveLength(1); + expect(stdout.match(/migrate\|m/g)).toHaveLength(1); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it.skip('should show help information using the "--help" option with the "verbose" value #2', () => { @@ -79,24 +73,21 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack [entries...] [options]'); - expect(pureStdout).toContain('webpack [command] [options]'); - expect(pureStdout).toContain(helpDefaultHeader); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--merge'); // minimum + expect(stdout).toContain('webpack [entries...] [options]'); + expect(stdout).toContain('webpack [command] [options]'); + expect(stdout).toContain(helpDefaultHeader); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--merge'); // minimum if (isWebpack5) { - expect(pureStdout).toContain('--cache-type'); // verbose + expect(stdout).toContain('--cache-type'); // verbose } - expect(pureStdout).toContain('Global options:'); - expect(pureStdout).toContain('Commands:'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - expect(coloretteEnabled ? stripAnsi(stdout) : stdout).toContain('Made with ♥ by the webpack team.'); + expect(stdout).toContain('Global options:'); + expect(stdout).toContain('Commands:'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using command syntax', () => { @@ -104,21 +95,17 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack [entries...] [options]'); - expect(pureStdout).toContain('webpack [command] [options]'); - expect(pureStdout).toContain(helpDefaultHeader); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--merge'); // minimum - expect(pureStdout).not.toContain('--cache-type'); // verbose - expect(pureStdout).toContain('Global options:'); - expect(pureStdout).toContain('Commands:'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - // TODO buggy on windows - // expect(coloretteEnabled ? stripAnsi(stdout) : stdout).toContain('Made with ♥ by the webpack team.'); + expect(stdout).toContain('webpack [entries...] [options]'); + expect(stdout).toContain('webpack [command] [options]'); + expect(stdout).toContain(helpDefaultHeader); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--merge'); // minimum + expect(stdout).not.toContain('--cache-type'); // verbose + expect(stdout).toContain('Global options:'); + expect(stdout).toContain('Commands:'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show the same information using the "--help" option and command syntax', () => { @@ -135,10 +122,11 @@ describe('help', () => { }); it('should show help information and respect the "--color" flag using the "--help" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--help', '--color']); + const { exitCode, stderr, stdout } = run(__dirname, ['--help', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); + expect(stdout).toContain('\x1b[1m'); const pureStdout = stripAnsi(stdout); @@ -152,30 +140,26 @@ describe('help', () => { expect(pureStdout).toContain('Commands:'); expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - expect(pureStdout).toContain(coloretteEnabled ? bold('Made with ♥ by the webpack team') : 'Made with ♥ by the webpack team'); + expect(pureStdout).toContain('Made with ♥ by the webpack team'); }); it('should show help information and respect the "--no-color" flag using the "--help" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--help', '--no-color']); + const { exitCode, stderr, stdout } = run(__dirname, ['--help', '--no-color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack [entries...] [options]'); - expect(pureStdout).toContain('webpack [command] [options]'); - expect(pureStdout).toContain(helpDefaultHeader); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--merge'); // minimum - expect(pureStdout).not.toContain('--cache-type'); // verbose - expect(pureStdout).toContain('Global options:'); - expect(pureStdout).toContain('Commands:'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - // TODO bug in tests - // expect(stdout).not.toContain(bold('Made with ♥ by the webpack team')); - expect(pureStdout).toContain('Made with ♥ by the webpack team'); + expect(stdout).not.toContain('\x1b[1m'); + expect(stdout).toContain('webpack [entries...] [options]'); + expect(stdout).toContain('webpack [command] [options]'); + expect(stdout).toContain(helpDefaultHeader); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--merge'); // minimum + expect(stdout).not.toContain('--cache-type'); // verbose + expect(stdout).toContain('Global options:'); + expect(stdout).toContain('Commands:'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team'); }); const commands = [ @@ -209,6 +193,14 @@ describe('help', () => { expect(stdout).toContain(`webpack ${command === 'build' || command === 'bundle' || command === 'b' ? '' : command}`); }); + it(`should show help information for '${command}' command using the "--help verbose" option`, () => { + const { exitCode, stderr, stdout } = run(__dirname, [command, '--help', 'verbose']); + + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toContain(`webpack ${command === 'build' || command === 'bundle' || command === 'b' ? '' : command}`); + }); + it(`should show help information for '${command}' command using command syntax`, () => { const { exitCode, stderr, stdout } = run(__dirname, ['help', command]); @@ -218,22 +210,22 @@ describe('help', () => { }); it('should show help information and respect the "--color" flag using the "--help" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, [command, '--help', '--color']); + const { exitCode, stderr, stdout } = run(__dirname, [command, '--help', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); + expect(stdout).toContain('\x1b[1m'); expect(stdout).toContain(`webpack ${command === 'build' || command === 'bundle' || command === 'b' ? '' : command}`); - expect(stdout).toContain(coloretteEnabled ? bold('Made with ♥ by the webpack team') : 'Made with ♥ by the webpack team'); + expect(stdout).toContain('Made with ♥ by the webpack team'); }); it('should show help information and respect the "--no-color" flag using the "--help" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, [command, '--help', '--no-color']); + const { exitCode, stderr, stdout } = run(__dirname, [command, '--help', '--no-color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); + expect(stdout).not.toContain('\x1b[1m'); expect(stdout).toContain(`webpack ${command === 'build' || command === 'bundle' || command === 'b' ? '' : command}`); - // TODO bug in tests - // expect(stdout).not.toContain(bold('Made with ♥ by the webpack team')); expect(stdout).toContain('Made with ♥ by the webpack team'); }); }); @@ -243,15 +235,12 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack info|i [options]'); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--output '); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - expect(pureStdout).toContain('Made with ♥ by the webpack team'); + expect(stdout).toContain('webpack info|i [options]'); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--output '); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team'); }); it('should show help information and taking precedence when "--help" and "--version" option using together', () => { @@ -259,21 +248,17 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('webpack [entries...] [options]'); - expect(pureStdout).toContain('webpack [command] [options]'); - expect(pureStdout).toContain(helpDefaultHeader); - expect(pureStdout).toContain('Options:'); - expect(pureStdout).toContain('--merge'); // minimum - expect(pureStdout).not.toContain('--cache-type'); // verbose - expect(pureStdout).toContain('Global options:'); - expect(pureStdout).toContain('Commands:'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); - // TODO buggy on windows - // expect(coloretteEnabled ? stripAnsi(stdout) : stdout).toContain('Made with ♥ by the webpack team.'); + expect(stdout).toContain('webpack [entries...] [options]'); + expect(stdout).toContain('webpack [command] [options]'); + expect(stdout).toContain(helpDefaultHeader); + expect(stdout).toContain('Options:'); + expect(stdout).toContain('--merge'); // minimum + expect(stdout).not.toContain('--cache-type'); // verbose + expect(stdout).toContain('Global options:'); + expect(stdout).toContain('Commands:'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help --mode" option', () => { @@ -281,13 +266,11 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --mode '); - expect(pureStdout).toContain('Description: Defines the mode to pass to webpack.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Usage: webpack --mode '); + expect(stdout).toContain('Description: Defines the mode to pass to webpack.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help --target" option', () => { @@ -296,19 +279,18 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - const pureStdout = stripAnsi(stdout); - if (isWebpack5) { - expect(pureStdout).toContain('Usage: webpack --target '); - expect(pureStdout).toContain('Short: webpack -t '); + expect(stdout).toContain('Usage: webpack --target '); + expect(stdout).toContain('Short: webpack -t '); } else { - expect(pureStdout).toContain('Usage: webpack --target '); - expect(pureStdout).toContain('Short: webpack -t '); + expect(stdout).toContain('Usage: webpack --target '); + expect(stdout).toContain('Short: webpack -t '); } - expect(pureStdout).toContain('Description: Sets the build target e.g. node.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Description: Sets the build target e.g. node.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help --stats" option', () => { @@ -316,13 +298,11 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --stats [value]'); - expect(pureStdout).toContain('Description: It instructs webpack on how to treat the stats e.g. verbose.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Usage: webpack --stats [value]'); + expect(stdout).toContain('Description: It instructs webpack on how to treat the stats e.g. verbose.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help --no-stats" option', () => { @@ -330,13 +310,11 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --no-stats'); - expect(pureStdout).toContain('Description: Disable stats output.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Usage: webpack --no-stats'); + expect(stdout).toContain('Description: Disable stats output.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help --mode" option', () => { @@ -344,13 +322,11 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --mode '); - expect(pureStdout).toContain('Description: Defines the mode to pass to webpack.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Usage: webpack --mode '); + expect(stdout).toContain('Description: Defines the mode to pass to webpack.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help serve --mode" option', () => { @@ -358,20 +334,19 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack serve --mode '); - expect(pureStdout).toContain('Description: Defines the mode to pass to webpack.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Usage: webpack serve --mode '); + expect(stdout).toContain('Description: Defines the mode to pass to webpack.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('Made with ♥ by the webpack team.'); }); it('should show help information using the "help --color" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['help', '--color']); + const { exitCode, stderr, stdout } = run(__dirname, ['help', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); + expect(stdout).toContain('\x1b[1m'); const pureStdout = stripAnsi(stdout); @@ -382,24 +357,23 @@ describe('help', () => { }); it('should show help information using the "help --no-color" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['help', '--no-color']); + const { exitCode, stderr, stdout } = run(__dirname, ['help', '--no-color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --no-color'); - expect(pureStdout).toContain('Description: Disable colors on console.'); - expect(pureStdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).not.toContain('\x1b[1m'); + expect(stdout).toContain('Usage: webpack --no-color'); + expect(stdout).toContain('Description: Disable colors on console.'); + expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); }); it('should show help information using the "help serve --color" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['help', 'serve', '--color']); + const { exitCode, stderr, stdout } = run(__dirname, ['help', 'serve', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); + expect(stdout).toContain('\x1b[1m'); const pureStdout = stripAnsi(stdout); @@ -414,6 +388,7 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); + expect(stdout).not.toContain('\x1b[1m'); expect(stdout).toContain('Usage: webpack serve --no-color'); expect(stdout).toContain('Description: Disable colors on console.'); expect(stdout).toContain("To see list of all supported commands and options run 'webpack --help=verbose'."); @@ -425,15 +400,12 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --version'); - expect(pureStdout).toContain('Short: webpack -v'); - expect(pureStdout).toContain( + expect(stdout).toContain('Usage: webpack --version'); + expect(stdout).toContain('Short: webpack -v'); + expect(stdout).toContain( "Description: Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", ); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); }); it('should show help information using the "help -v" option', () => { @@ -441,15 +413,12 @@ describe('help', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).toContain('Usage: webpack --version'); - expect(pureStdout).toContain('Short: webpack -v'); - expect(pureStdout).toContain( + expect(stdout).toContain('Usage: webpack --version'); + expect(stdout).toContain('Short: webpack -v'); + expect(stdout).toContain( "Description: Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", ); - expect(pureStdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); + expect(stdout).toContain('CLI documentation: https://webpack.js.org/api/cli/.'); }); it('should log error for invalid command using the "--help" option', () => { diff --git a/test/init/auto/init-auto.test.js b/test/init/auto/init-auto.test.js index c29df7cf5c1..a5e15e8912f 100644 --- a/test/init/auto/init-auto.test.js +++ b/test/init/auto/init-auto.test.js @@ -1,4 +1,3 @@ -const { green } = require('colorette'); const fs = require('fs'); const path = require('path'); const rimraf = require('rimraf'); @@ -8,7 +7,7 @@ const { run } = require('../../utils/test-utils'); const genPath = path.resolve(__dirname, './test-assets'); const firstPrompt = 'Will your application have multiple bundles?'; -const successLog = `You can now run ${green('yarn build')} to bundle your application!`; +const successLog = `You can now run 'yarn build' to bundle your application!`; describe('init auto flag', () => { beforeAll(() => { diff --git a/test/init/generator/init-inquirer.test.js b/test/init/generator/init-inquirer.test.js index 677535adf9f..2d4932530e0 100644 --- a/test/init/generator/init-inquirer.test.js +++ b/test/init/generator/init-inquirer.test.js @@ -1,6 +1,5 @@ 'use strict'; -const { green } = require('colorette'); const fs = require('fs'); const { join, resolve } = require('path'); const rimraf = require('rimraf'); @@ -10,7 +9,7 @@ const firstPrompt = 'Will your application have multiple bundles?'; const ENTER = '\x0D'; const genPath = join(__dirname, 'test-assets'); -const successLog = `You can now run ${green('yarn build')} to bundle your application!`; +const successLog = `You can now run 'yarn build' to bundle your application!`; describe('init', () => { beforeAll(() => { @@ -47,8 +46,8 @@ describe('init', () => { expect(pkgJson['devDependencies']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack']).toBeTruthy(); expect(pkgJson['devDependencies']['webpack-dev-server']).toBeTruthy(); - expect(pkgJson['scripts']['build'] == 'webpack').toBeTruthy(); - expect(pkgJson['scripts']['serve'] == 'webpack serve').toBeTruthy(); + expect(pkgJson['scripts']['build'] === 'webpack').toBeTruthy(); + expect(pkgJson['scripts']['serve'] === 'webpack serve').toBeTruthy(); }; expect(pkgJsonTests).not.toThrow(); diff --git a/test/json/json.test.js b/test/json/json.test.js index 49022409705..0efe8ecb27c 100644 --- a/test/json/json.test.js +++ b/test/json/json.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -36,7 +35,7 @@ describe('json', () => { }); it('should work and store json to a file and respect --color flag', (done) => { - const { exitCode, stderr, stdout } = run(__dirname, ['--json', 'stats.json', '--color']); + const { exitCode, stderr, stdout } = run(__dirname, ['--json', 'stats.json', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toContain(`\u001b[32m${successMessage}`); @@ -123,12 +122,9 @@ describe('json', () => { const { exitCode, stderr, stdout } = run(__dirname, ['--json', 'stats.json', '--config', 'logging.config.js']); expect(exitCode).toBe(0); - - const pureStderr = stripAnsi(stderr); - expect(stderr).toContain('Compiler starting...'); - expect(pureStderr).toContain('Compiler finished'); - expect(pureStderr).toContain(successMessage); + expect(stderr).toContain('Compiler finished'); + expect(stderr).toContain(successMessage); expect(stdout).toBeFalsy(); expect(existsSync(resolve(__dirname, './stats.json'))).toBeTruthy(); diff --git a/test/loader/loader.test.js b/test/loader/loader.test.js index 6ee115a8853..a1e7db13b04 100644 --- a/test/loader/loader.test.js +++ b/test/loader/loader.test.js @@ -3,7 +3,6 @@ const { existsSync, mkdirSync } = require('fs'); const { join, resolve } = require('path'); const rimraf = require('rimraf'); -const stripAnsi = require('strip-ansi'); const { run, runPromptWithAnswers } = require('../utils/test-utils'); const firstPrompt = '? Loader name (my-loader)'; @@ -25,13 +24,13 @@ describe('loader command', () => { const { stdout, stderr } = run(__dirname, ['loader'], false); expect(stdout).toBeTruthy(); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); }); it('should scaffold loader with default name if no loader name provided', async () => { let { stdout } = await runPromptWithAnswers(__dirname, ['loader'], [`${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Skip test in case installation fails if (!existsSync(resolve(defaultLoaderPath, './yarn.lock'))) { @@ -57,7 +56,7 @@ describe('loader command', () => { it('should scaffold loader template with a given name', async () => { let { stdout } = await runPromptWithAnswers(__dirname, ['loader'], [`${loaderName}${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Skip test in case installation fails if (!existsSync(resolve(loaderPath, './yarn.lock'))) { @@ -83,7 +82,7 @@ describe('loader command', () => { it('should scaffold loader template in the specified path', async () => { let { stdout } = await runPromptWithAnswers(__dirname, ['loader', 'test-assets'], [`${loaderName}${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Skip test in case installation fails if (!existsSync(resolve(customLoaderPath, './yarn.lock'))) { @@ -112,7 +111,7 @@ describe('loader command', () => { let { stdout } = await runPromptWithAnswers(genPath, ['loader', './'], [`${loaderName}${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Skip test in case installation fails if (!existsSync(resolve(customLoaderPath, './yarn.lock'))) { diff --git a/test/mode/mode-single-arg/mode-single-arg.test.js b/test/mode/mode-single-arg/mode-single-arg.test.js index 3d18ddb14e6..7816271878f 100644 --- a/test/mode/mode-single-arg/mode-single-arg.test.js +++ b/test/mode/mode-single-arg/mode-single-arg.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run, isWebpack5 } = require('../../utils/test-utils'); describe('mode flags', () => { @@ -9,11 +8,8 @@ describe('mode flags', () => { expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); - - const pureStdout = stripAnsi(stdout); - - expect(pureStdout).not.toContain(`mode: 'production'`); - expect(pureStdout).toContain(`The 'mode' option has not been set, webpack will fallback to 'production' for this value.`); + expect(stdout).not.toContain(`mode: 'production'`); + expect(stdout).toContain(`The 'mode' option has not been set, webpack will fallback to 'production' for this value.`); }); it('should load a development config when --mode=development is passed', () => { diff --git a/test/plugin/plugin.test.js b/test/plugin/plugin.test.js index bad234e7a83..dc900238ae1 100644 --- a/test/plugin/plugin.test.js +++ b/test/plugin/plugin.test.js @@ -1,7 +1,6 @@ const { existsSync, mkdirSync } = require('fs'); const { join, resolve } = require('path'); const rimraf = require('rimraf'); -const stripAnsi = require('strip-ansi'); const { run, runPromptWithAnswers } = require('../utils/test-utils'); const ENTER = '\x0D'; @@ -25,13 +24,13 @@ describe('plugin command', () => { const { stdout, stderr } = run(__dirname, ['plugin'], false); expect(stdout).toBeTruthy(); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); }); it('should scaffold plugin with default name if no plugin name provided', async () => { let { stdout } = await runPromptWithAnswers(__dirname, ['plugin'], [`${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Check if the output directory exists with the appropriate plugin name expect(existsSync(defaultPluginPath)).toBeTruthy(); @@ -56,7 +55,7 @@ describe('plugin command', () => { it('should scaffold plugin template with a given name', async () => { let { stdout } = await runPromptWithAnswers(__dirname, ['plugin'], [`${pluginName}${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Check if the output directory exists with the appropriate plugin name expect(existsSync(pluginPath)).toBeTruthy(); @@ -81,7 +80,7 @@ describe('plugin command', () => { it('should scaffold plugin template in the specified path', async () => { let { stdout } = await runPromptWithAnswers(__dirname, ['plugin', 'test-assets'], [`${pluginName}${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Check if the output directory exists with the appropriate plugin name expect(existsSync(customPluginPath)).toBeTruthy(); @@ -109,7 +108,7 @@ describe('plugin command', () => { let { stdout } = await runPromptWithAnswers(genPath, ['plugin', './'], [`${pluginName}${ENTER}`]); - expect(stripAnsi(stdout)).toContain(firstPrompt); + expect(stdout).toContain(firstPrompt); // Check if the output directory exists with the appropriate plugin name expect(existsSync(customPluginPath)).toBeTruthy(); diff --git a/test/prefetch/prefetch.test.js b/test/prefetch/prefetch.test.js index cf7c60fe638..010b04769da 100644 --- a/test/prefetch/prefetch.test.js +++ b/test/prefetch/prefetch.test.js @@ -2,7 +2,6 @@ const fs = require('fs'); const { join } = require('path'); -const stripAnsi = require('strip-ansi'); const { run } = require('../utils/test-utils'); const rimraf = require('rimraf'); @@ -29,7 +28,7 @@ describe('prefetch', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); // Should contain the error message - expect(stripAnsi(stdout)).toContain(`Error: Can't resolve './src/somefile.js'`); + expect(stdout).toContain(`Error: Can't resolve './src/somefile.js'`); }); it('should log error when flag value is not supplied', () => { diff --git a/test/serve/basic/serve-basic.test.js b/test/serve/basic/serve-basic.test.js index e5b1335bb60..cf508855b3d 100644 --- a/test/serve/basic/serve-basic.test.js +++ b/test/serve/basic/serve-basic.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const path = require('path'); const getPort = require('get-port'); const { runServe, isWebpack5, isDevServer4 } = require('../../utils/test-utils'); @@ -112,7 +111,7 @@ describe('basic serve usage', () => { const { stderr, stdout } = await runServe(__dirname, ['--stats']); expect(stderr).toBeFalsy(); - expect(stripAnsi(stdout)).toContain(isWebpack5 ? 'compiled successfully' : 'Version: webpack'); + expect(stdout).toContain(isWebpack5 ? 'compiled successfully' : 'Version: webpack'); expect(stdout.match(/HotModuleReplacementPlugin/g)).toBeNull(); }); @@ -219,7 +218,7 @@ describe('basic serve usage', () => { expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); - expect(stripAnsi(stdout)).toContain('from /'); + expect(stdout).toContain('from /'); expect(stdout.match(/HotModuleReplacementPlugin/g)).toBeNull(); }); diff --git a/test/serve/help/serve-help.test.js b/test/serve/help/serve-help.test.js deleted file mode 100644 index eb8cabef807..00000000000 --- a/test/serve/help/serve-help.test.js +++ /dev/null @@ -1,43 +0,0 @@ -const { runServe, isWebpack5 } = require('../../utils/test-utils'); - -const usageText = 'webpack serve|s [entries...] [options]'; -const descriptionText = 'Run the webpack dev server'; - -describe('serve help', () => { - it('should log help information', async () => { - const { stderr, stdout, exitCode } = await runServe(__dirname, ['--help']); - - expect(stderr).toBeFalsy(); - expect(exitCode).toBe(0); - expect(stdout).toContain(descriptionText); - expect(stdout).toContain(usageText); - expect(stdout).toContain('Global options:'); - expect(stdout).toContain('Options:'); - // Serve flags are rendered - expect(stdout).toContain('--liveReload'); - expect(stdout).toContain('--https'); - expect(stdout).toContain('--open [value]'); - }); - - it('should log help information using "verbose"', async () => { - const { stderr, stdout, exitCode } = await runServe(__dirname, ['--help', 'verbose']); - - expect(stderr).toBeFalsy(); - expect(exitCode).toBe(0); - expect(stdout).toContain(descriptionText); - expect(stdout).toContain(usageText); - expect(stdout).toContain('Options:'); - - if (isWebpack5) { - expect(stdout).toContain('--cache-type'); - } - }); - - it('should log help information and respect the "--no-color" option', async () => { - const { stdout, stderr } = await runServe(__dirname, ['--help', '--no-color']); - - expect(stderr).toBeFalsy(); - expect(stdout).toContain(usageText); - expect(stdout).toContain(descriptionText); - }); -}); diff --git a/test/stats/watch/stats-and-watch.test.js b/test/stats/watch/stats-and-watch.test.js index e180b31741e..278c69a4a62 100644 --- a/test/stats/watch/stats-and-watch.test.js +++ b/test/stats/watch/stats-and-watch.test.js @@ -4,21 +4,21 @@ const { runWatch } = require('../../utils/test-utils'); describe('stats and watch', () => { it('should not log stats with the "none" value from the configuration', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--color']); + const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js'], true); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should not log stats with the "none" value from the configuration and multi compiler mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './multi-webpack.config.js', '--color']); + const { stderr, stdout } = await runWatch(__dirname, ['-c', './multi-webpack.config.js'], true); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should log stats with the "normal" value in arguments', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--stats', 'normal', '--color']); + const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--stats', 'normal'], true); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); diff --git a/test/unknown/unknown.test.js b/test/unknown/unknown.test.js index c87fbd5bcd2..80b10c6b163 100644 --- a/test/unknown/unknown.test.js +++ b/test/unknown/unknown.test.js @@ -1,4 +1,5 @@ -const stripAnsi = require('strip-ansi'); +'use strict'; + const { run, isWebpack5 } = require('../utils/test-utils'); describe('unknown behaviour', () => { @@ -102,7 +103,7 @@ describe('unknown behaviour', () => { }); it('should log error and respect --color flag', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--unknown', '--color']); + const { exitCode, stderr, stdout } = run(__dirname, ['--unknown', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Unknown option '--unknown'"); @@ -111,7 +112,7 @@ describe('unknown behaviour', () => { }); it('should log error for unknown flag and respect --no-color', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--unknown', '--no-color']); + const { exitCode, stderr, stdout } = run(__dirname, ['--unknown', '--no-color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(2); expect(stderr).not.toContain(`\u001b[31mError: Unknown option '--unknown'`); @@ -203,8 +204,8 @@ describe('unknown behaviour', () => { const { exitCode, stderr, stdout } = run(__dirname, ['qqq'], true, [], { TERM_PROGRAM: false }); expect(exitCode).toBe(2); - expect(stripAnsi(stderr)).toContain("Unknown command or entry 'qqq'"); - expect(stripAnsi(stderr)).toContain("Run 'webpack --help' to see available commands and options"); + expect(stderr).toContain("Unknown command or entry 'qqq'"); + expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); expect(stdout).toBeFalsy(); }); @@ -212,9 +213,9 @@ describe('unknown behaviour', () => { const { exitCode, stderr, stdout } = run(__dirname, ['server'], true, [], { TERM_PROGRAM: false }); expect(exitCode).toBe(2); - expect(stripAnsi(stderr)).toContain("Unknown command or entry 'server'"); - expect(stripAnsi(stderr)).toContain("Did you mean 'serve' (alias 's')?"); - expect(stripAnsi(stderr)).toContain("Run 'webpack --help' to see available commands and options"); + expect(stderr).toContain("Unknown command or entry 'server'"); + expect(stderr).toContain("Did you mean 'serve' (alias 's')?"); + expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); expect(stdout).toBeFalsy(); }); }); diff --git a/test/utils/test-utils.js b/test/utils/test-utils.js index f78f155d558..9d036a9a086 100644 --- a/test/utils/test-utils.js +++ b/test/utils/test-utils.js @@ -7,7 +7,6 @@ const { sync: spawnSync, node: execaNode } = execa; const { Writable } = require('readable-stream'); const concat = require('concat-stream'); const { version } = require('webpack'); -const stripAnsi = require('strip-ansi'); const isWebpack5 = version.startsWith('5'); @@ -59,7 +58,7 @@ const run = (testCase, args = [], options = {}) => { return result; }; -const runWatch = (testCase, args = [], setOutput = true, outputKillStr = /webpack \d+\.\d+\.\d/) => { +const runWatch = (testCase, args = [], setOutput = true, outputKillStr = /webpack \d+\.\d+\.\d/, options = {}) => { const cwd = path.resolve(testCase); const outputPath = path.resolve(testCase, 'bin'); @@ -70,12 +69,13 @@ const runWatch = (testCase, args = [], setOutput = true, outputKillStr = /webpac cwd, reject: false, stdio: 'pipe', + ...options, }); proc.stdout.pipe( new Writable({ write(chunk, encoding, callback) { - const output = stripAnsi(chunk.toString('utf8')); + const output = chunk.toString('utf8'); if (outputKillStr.test(output)) { if (isWindows) { diff --git a/test/version/version.test.js b/test/version/version.test.js index b0c7df26b81..36be704bd27 100644 --- a/test/version/version.test.js +++ b/test/version/version.test.js @@ -11,7 +11,7 @@ const webpackDevServerPkgJSON = require('webpack-dev-server/package.json'); describe('single version flag', () => { it('outputs versions with command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -21,7 +21,7 @@ describe('single version flag', () => { }); it('outputs versions with dashed syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -31,7 +31,7 @@ describe('single version flag', () => { }); it('outputs versions with alias syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['-v'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['-v']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -41,7 +41,7 @@ describe('single version flag', () => { }); it('outputs version with info', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['info', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['info', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -52,7 +52,7 @@ describe('single version flag', () => { }); it('outputs version with info using option alias', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['info', '-v'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['info', '-v']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -63,7 +63,7 @@ describe('single version flag', () => { }); it('outputs version with info using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -74,7 +74,7 @@ describe('single version flag', () => { }); it('outputs version with info using command alias', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['v', 'info'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['v', 'info']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -85,7 +85,7 @@ describe('single version flag', () => { }); it('outputs version with build', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['build', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['build', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -95,7 +95,7 @@ describe('single version flag', () => { }); it('outputs version with bundle', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['bundle', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['bundle', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -105,7 +105,7 @@ describe('single version flag', () => { }); it('outputs version with b', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['b', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['b', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -115,7 +115,7 @@ describe('single version flag', () => { }); it('outputs version with watch', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['watch', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['watch', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -125,7 +125,7 @@ describe('single version flag', () => { }); it('outputs version with w', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['w', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['w', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -135,7 +135,7 @@ describe('single version flag', () => { }); it('outputs version with plugin', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['plugin', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['plugin', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -146,7 +146,7 @@ describe('single version flag', () => { }); it('outputs version with loader', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['loader', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['loader', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -157,7 +157,7 @@ describe('single version flag', () => { }); it('outputs version with init', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['init', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['init', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -168,7 +168,7 @@ describe('single version flag', () => { }); it('outputs version with serve', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['serve', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['serve', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -179,7 +179,7 @@ describe('single version flag', () => { }); it('outputs version with migrate', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['migrate', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['migrate', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain(`webpack-cli ${pkgJSON.version}`); @@ -189,7 +189,7 @@ describe('single version flag', () => { }); it('outputs version with the alias c for init', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['c', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['c', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -200,7 +200,7 @@ describe('single version flag', () => { }); it('should log error when unknown command using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'unknown'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'unknown']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'unknown'"); @@ -209,7 +209,7 @@ describe('single version flag', () => { }); it('should log version for known command and log error for unknown command using command syntax with multi commands', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', 'unknown'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', 'unknown']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'unknown'"); @@ -218,7 +218,7 @@ describe('single version flag', () => { }); it('should work for multiple commands', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['info', 'serve', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['info', 'serve', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -230,7 +230,7 @@ describe('single version flag', () => { }); it('should output versions for multiple commands using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', 'serve'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', 'serve']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -242,7 +242,7 @@ describe('single version flag', () => { }); it('should output versions with help command using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'help'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'help']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -252,7 +252,7 @@ describe('single version flag', () => { }); it('should log version for known command and log error for unknown command using the "--version" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['serve', 'abc', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['serve', 'abc', '--version']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); @@ -261,7 +261,7 @@ describe('single version flag', () => { }); it('should log version for known command and log error for unknown command using the "-v" option', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['serve', 'abc', '-v'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['serve', 'abc', '-v']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); @@ -270,15 +270,15 @@ describe('single version flag', () => { }); it('should not output version with help dashed', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', '--help'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', '--help']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toContain('webpack version|v [commands...]'); }); - it('outputs versions with --color using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--version', '--color'], false); + it('outputs versions with --color using option syntax', () => { + const { exitCode, stderr, stdout } = run(__dirname, ['--version', '--color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -287,8 +287,8 @@ describe('single version flag', () => { expect(stdout).toContain(`webpack-dev-server ${webpackDevServerPkgJSON.version}`); }); - it('outputs versions with --no-color using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--version', '--no-color'], false); + it('outputs versions with --no-color using option syntax', () => { + const { exitCode, stderr, stdout } = run(__dirname, ['--version', '--no-color'], { env: { FORCE_COLOR: true } }); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -298,7 +298,7 @@ describe('single version flag', () => { }); it('outputs versions with --color using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', '--color'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', '--color']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -308,7 +308,7 @@ describe('single version flag', () => { }); it('outputs versions with --no-color using command syntax', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', '--no-color'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', '--no-color']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -318,7 +318,7 @@ describe('single version flag', () => { }); it('should log error when unknown command used', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'abc'], false, []); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'abc']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); @@ -327,7 +327,7 @@ describe('single version flag', () => { }); it('throws error if invalid option is passed with version command', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', '--abc'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', '--abc']); expect(exitCode).toBe(2); expect(stderr).toContain(`Unknown option '--abc`); @@ -336,7 +336,7 @@ describe('single version flag', () => { }); it('should log error when unknown command used with --version flag', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--version', 'abc'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['--version', 'abc']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); @@ -345,7 +345,7 @@ describe('single version flag', () => { }); it('throws error if invalid option is passed with --version flag', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['--version', '--abc'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['--version', '--abc']); expect(exitCode).toBe(2); expect(stderr).toContain(`Unknown option '--abc'`); @@ -354,7 +354,7 @@ describe('single version flag', () => { }); it('should log error when unknown command used with -v alias', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['-v', 'abc'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['-v', 'abc']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown command 'abc'"); @@ -363,7 +363,7 @@ describe('single version flag', () => { }); it('throws error if invalid option is passed with -v alias', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['-v', '--abc'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['-v', '--abc']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown option '--abc'"); @@ -372,7 +372,7 @@ describe('single version flag', () => { }); it('should work using command syntax with the "version" value', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -382,7 +382,7 @@ describe('single version flag', () => { }); it('should work using command syntax and the "--version" argument', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', '--version'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', '--version']); expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); @@ -392,7 +392,7 @@ describe('single version flag', () => { }); it('should log an error using command syntax with unknown argument', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', '--unknown'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', '--unknown']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown option '--unknown'"); @@ -401,7 +401,7 @@ describe('single version flag', () => { }); it('should log an error using command syntax with unknown argument #2', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', '--unknown'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', '--unknown']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown option '--unknown'"); @@ -410,7 +410,7 @@ describe('single version flag', () => { }); it('should log an error using command syntax with multiple commands with unknown argument', () => { - const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', 'serve', '--unknown'], false); + const { exitCode, stderr, stdout } = run(__dirname, ['version', 'info', 'serve', '--unknown']); expect(exitCode).toBe(2); expect(stderr).toContain("Unknown option '--unknown'"); diff --git a/test/watch/basic/basic.test.js b/test/watch/basic/basic.test.js index bced22c1988..7fc2921e1af 100644 --- a/test/watch/basic/basic.test.js +++ b/test/watch/basic/basic.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run, runAndGetWatchProc, isWebpack5 } = require('../../utils/test-utils'); const { writeFileSync } = require('fs'); const { resolve } = require('path'); @@ -23,7 +22,7 @@ describe('basic', () => { let modified = false; proc.stdout.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); if (data.includes('index.js')) { if (isWebpack5) { @@ -56,7 +55,7 @@ describe('basic', () => { let modified = false; proc.stdout.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); if (data.includes('index.js')) { if (isWebpack5) { @@ -91,7 +90,7 @@ describe('basic', () => { const wordsInStatsv5Entries = ['asset', 'entry.js', 'compiled successfully']; proc.stdout.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); if (data.includes('entry.js')) { if (isWebpack5) { @@ -124,7 +123,7 @@ describe('basic', () => { let modified = false; proc.stdout.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); if (data.includes('index.js')) { if (isWebpack5) { @@ -151,7 +150,7 @@ describe('basic', () => { }); proc.stderr.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); expect(data).toContain( "No need to use the 'watch' command together with '{ watch: true }' configuration, it does not make sense.", @@ -166,9 +165,9 @@ describe('basic', () => { let stderr = ''; proc.stderr.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); - stderr += stripAnsi(data); + stderr += data; if (/Compiler finished/.test(data)) { expect(stderr).toContain('Compiler starting...'); diff --git a/test/watch/watch-variable/watch-variable.test.js b/test/watch/watch-variable/watch-variable.test.js index 0f5cc994ed6..0ab866c9997 100644 --- a/test/watch/watch-variable/watch-variable.test.js +++ b/test/watch/watch-variable/watch-variable.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { runAndGetWatchProc, isWebpack5 } = require('../../utils/test-utils'); const { writeFileSync } = require('fs'); const { resolve } = require('path'); @@ -15,7 +14,7 @@ describe('watch variable', () => { let modified = false; proc.stdout.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); expect(data).not.toContain('FAIL'); @@ -50,7 +49,7 @@ describe('watch variable', () => { let modified = false; proc.stdout.on('data', (chunk) => { - const data = stripAnsi(chunk.toString()); + const data = chunk.toString(); expect(data).not.toContain('FAIL'); diff --git a/test/zero-config/entry-absent/zero-config.test.js b/test/zero-config/entry-absent/zero-config.test.js index 0ebba445d1a..3309c19683e 100644 --- a/test/zero-config/entry-absent/zero-config.test.js +++ b/test/zero-config/entry-absent/zero-config.test.js @@ -1,6 +1,5 @@ 'use strict'; -const stripAnsi = require('strip-ansi'); const { run } = require('../../utils/test-utils'); describe('Zero Config tests', () => { @@ -10,6 +9,6 @@ describe('Zero Config tests', () => { expect(exitCode).toBe(1); expect(stderr).toBeFalsy(); // Entry file is absent, should log the Error from the compiler - expect(stripAnsi(stdout)).toContain("Error: Can't resolve './src'"); + expect(stdout).toContain("Error: Can't resolve './src'"); }); }); From 139695afa4160ce49e9847e677d247455db9ba2c Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Wed, 17 Feb 2021 15:00:34 +0300 Subject: [PATCH 027/122] test: refactor --- test/bail/bail.test.js | 2 +- test/serve/basic/serve-basic.test.js | 76 ++++++++++--------- test/serve/serve-variable/serve-basic.test.js | 4 +- .../serve-custom-config.test.js | 10 +-- test/stats/watch/stats-and-watch.test.js | 6 +- test/utils/test-utils.js | 26 ++++--- 6 files changed, 67 insertions(+), 57 deletions(-) diff --git a/test/bail/bail.test.js b/test/bail/bail.test.js index 51f0121fc40..af801b197fd 100644 --- a/test/bail/bail.test.js +++ b/test/bail/bail.test.js @@ -55,7 +55,7 @@ describe('bail and watch warning', () => { }); it('should log warning in case of multiple compilers', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', 'multi-webpack.config.js'], true); + const { stderr, stdout } = await runWatch(__dirname, ['-c', 'multi-webpack.config.js']); expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`); expect(stdout).toBeTruthy(); diff --git a/test/serve/basic/serve-basic.test.js b/test/serve/basic/serve-basic.test.js index cf508855b3d..8eb1f8e6afd 100644 --- a/test/serve/basic/serve-basic.test.js +++ b/test/serve/basic/serve-basic.test.js @@ -2,7 +2,7 @@ const path = require('path'); const getPort = require('get-port'); -const { runServe, isWebpack5, isDevServer4 } = require('../../utils/test-utils'); +const { runWatch, isWebpack5, isDevServer4 } = require('../../utils/test-utils'); const testPath = path.resolve(__dirname); @@ -24,7 +24,7 @@ describe('basic serve usage', () => { } it('should work', async () => { - const { stderr, stdout } = await runServe(__dirname, []); + const { stderr, stdout } = await runWatch(__dirname, ['serve']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -32,7 +32,7 @@ describe('basic serve usage', () => { }); it('should work with the "--config" option', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'serve.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'serve.config.js', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('development'); @@ -40,7 +40,8 @@ describe('basic serve usage', () => { }); it('should work with the "--config" and "--env" options', async () => { - const { stderr, stdout } = await runServe(__dirname, [ + const { stderr, stdout } = await runWatch(__dirname, [ + 'serve', '--config', 'function-with-env.config.js', '--env', @@ -57,7 +58,8 @@ describe('basic serve usage', () => { }); it('should work with the "--config" and "--env" options and expose dev server options', async () => { - const { stderr, stdout } = await runServe(__dirname, [ + const { stderr, stdout } = await runWatch(__dirname, [ + 'serve', '--config', 'function-with-argv.config.js', '--env', @@ -76,7 +78,7 @@ describe('basic serve usage', () => { }); it('should work in multi compiler mode', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'multi.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'multi.config.js', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('one'); @@ -88,7 +90,7 @@ describe('basic serve usage', () => { // TODO need fix in future, edge case it.skip('should work in multi compiler mode with multiple dev servers', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'multi-dev-server.config.js']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'multi-dev-server.config.js']); expect(stderr).toBeFalsy(); expect(stdout).toContain('one'); @@ -99,7 +101,7 @@ describe('basic serve usage', () => { }); it('should work with the "--mode" option', async () => { - const { stderr, stdout } = await runServe(__dirname, []); + const { stderr, stdout } = await runWatch(__dirname, ['serve']); expect(stderr).toBeFalsy(); expect(stdout).toContain('development'); @@ -108,7 +110,7 @@ describe('basic serve usage', () => { }); it('should work with the "--stats" option', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--stats']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--stats']); expect(stderr).toBeFalsy(); expect(stdout).toContain(isWebpack5 ? 'compiled successfully' : 'Version: webpack'); @@ -116,7 +118,7 @@ describe('basic serve usage', () => { }); it('should work with the "--stats verbose" option', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--stats', 'verbose']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--stats', 'verbose']); expect(stderr).toBeFalsy(); expect(stdout).toContain(isWebpack5 ? 'from webpack.Compiler' : 'webpack.buildChunkGraph.visitModules'); @@ -124,7 +126,7 @@ describe('basic serve usage', () => { }); it('should work with the "--mode" option #2', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--mode', 'production']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--mode', 'production']); expect(stderr).toBeFalsy(); expect(stdout).toContain('production'); @@ -133,7 +135,7 @@ describe('basic serve usage', () => { }); it('should work with the "--mode" option #3', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--mode', 'development']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--mode', 'development']); expect(stderr).toBeFalsy(); expect(stdout).toContain('development'); @@ -142,7 +144,7 @@ describe('basic serve usage', () => { }); it('should work with the "--progress" option', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--progress']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--progress']); expect(stderr).toContain('webpack.Progress'); expect(stdout).toContain('main.js'); @@ -150,7 +152,7 @@ describe('basic serve usage', () => { }); it('should work with the "--progress" option using the "profile" value', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--progress', 'profile']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--progress', 'profile']); expect(stderr).toContain('webpack.Progress'); expect(stdout).toContain('main.js'); @@ -158,7 +160,7 @@ describe('basic serve usage', () => { }); it('should work with the "--client-log-level" option', async () => { - const { stdout, stderr } = await runServe(testPath, ['--client-log-level', 'info']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--client-log-level', 'info']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -166,7 +168,7 @@ describe('basic serve usage', () => { }); it('should work with the "--port" option', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port]); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -174,7 +176,7 @@ describe('basic serve usage', () => { }); it('should work with the "--hot" option', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--hot']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--hot']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -182,7 +184,7 @@ describe('basic serve usage', () => { }); it('should work with the "--no-hot" option', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port, '--no-hot']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--no-hot']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -190,7 +192,7 @@ describe('basic serve usage', () => { }); it('should work with the "--hot" option using the "only" value', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port, isDevServer4 ? '--hot only' : '--hot-only']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, isDevServer4 ? '--hot only' : '--hot-only']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -198,7 +200,7 @@ describe('basic serve usage', () => { }); it('should work with "--hot" and "--port" options', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port, '--hot']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--hot']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -206,7 +208,7 @@ describe('basic serve usage', () => { }); it('should work with the "--hot" and "--progress" options', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port, '--hot', '--progress']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--hot', '--progress']); expect(stderr).toContain('webpack.Progress'); expect(stdout).toContain('main.js'); @@ -214,7 +216,7 @@ describe('basic serve usage', () => { }); it('should work with the default "publicPath" option', async () => { - const { stderr, stdout } = await runServe(__dirname, []); + const { stderr, stdout } = await runWatch(__dirname, ['serve']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -223,7 +225,7 @@ describe('basic serve usage', () => { }); it('should work with the "--output-public-path" option', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--output-public-path', '/my-public-path/']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--output-public-path', '/my-public-path/']); if (isWebpack5) { expect(stderr).toBeFalsy(); @@ -237,7 +239,7 @@ describe('basic serve usage', () => { }); it('should respect the "publicPath" option from configuration', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'output-public-path.config.js']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'output-public-path.config.js']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -246,7 +248,7 @@ describe('basic serve usage', () => { }); it('should respect the "publicPath" option from configuration using multi compiler mode', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'multi-output-public-path.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'multi-output-public-path.config.js', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('one'); @@ -258,7 +260,7 @@ describe('basic serve usage', () => { }); it('should respect the "publicPath" option from configuration (from the "devServer" options)', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'dev-server-output-public-path.config.js']); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'dev-server-output-public-path.config.js']); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -267,7 +269,7 @@ describe('basic serve usage', () => { }); it('should work with the "--open" option', async () => { - const { stdout, stderr } = await runServe(testPath, ['--open', '--port', port]); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--open', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); @@ -275,7 +277,13 @@ describe('basic serve usage', () => { }); it('should respect the "publicPath" option from configuration using multi compiler mode (from the "devServer" options)', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'multi-dev-server-output-public-path.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, [ + 'serve', + '--config', + 'multi-dev-server-output-public-path.config.js', + '--port', + port, + ]); expect(stderr).toBeFalsy(); expect(stderr).toBeFalsy(); @@ -288,7 +296,7 @@ describe('basic serve usage', () => { }); it('should work with entries syntax', async () => { - const { stderr, stdout } = await runServe(__dirname, ['./src/entry.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, ['serve', './src/entry.js', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('development'); @@ -296,7 +304,7 @@ describe('basic serve usage', () => { }); it('should work and log warning on the `watch option in a configuration', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', './watch.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', './watch.config.js', '--port', port]); expect(stderr).toContain( "No need to use the 'serve' command together with '{ watch: true }' configuration, it does not make sense.", @@ -306,7 +314,7 @@ describe('basic serve usage', () => { }); it('should log used supplied config with serve', async () => { - const { stderr, stdout } = await runServe(__dirname, ['--config', 'log.config.js', '--port', port]); + const { stderr, stdout } = await runWatch(__dirname, ['serve', '--config', 'log.config.js', '--port', port]); const configPath = path.resolve(__dirname, './log.config.js'); expect(stderr).toContain('Compiler starting...'); @@ -316,7 +324,7 @@ describe('basic serve usage', () => { }); it("should log error on using '--watch' flag with serve", async () => { - const { stdout, stderr } = await runServe(testPath, ['--watch']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--watch']); expect(stderr).toContain("Error: Unknown option '--watch'"); expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); @@ -324,7 +332,7 @@ describe('basic serve usage', () => { }); it("should log error on using '-w' alias with serve", async () => { - const { stdout, stderr } = await runServe(testPath, ['-w']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '-w']); expect(stderr).toContain("Error: Unknown option '-w'"); expect(stderr).toContain("Run 'webpack --help' to see available commands and options"); @@ -332,7 +340,7 @@ describe('basic serve usage', () => { }); it('should log an error on unknown flag', async () => { - const { exitCode, stdout, stderr } = await runServe(testPath, ['--port', port, '--unknown-flag']); + const { exitCode, stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--unknown-flag']); expect(exitCode).toBe(2); expect(stderr).toContain("Error: Unknown option '--unknown-flag'"); diff --git a/test/serve/serve-variable/serve-basic.test.js b/test/serve/serve-variable/serve-basic.test.js index 065f471d17b..84002d52596 100644 --- a/test/serve/serve-variable/serve-basic.test.js +++ b/test/serve/serve-variable/serve-basic.test.js @@ -2,7 +2,7 @@ const path = require('path'); const getPort = require('get-port'); -const { runServe } = require('../../utils/test-utils'); +const { runWatch } = require('../../utils/test-utils'); const testPath = path.resolve(__dirname); @@ -24,7 +24,7 @@ describe('serve variable', () => { } it('compiles without flags and export variable', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port]); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port]); expect(stderr).toBeFalsy(); expect(stdout).toContain('main.js'); diff --git a/test/serve/with-custom-port/serve-custom-config.test.js b/test/serve/with-custom-port/serve-custom-config.test.js index ded0f9aef99..cad1dea9064 100644 --- a/test/serve/with-custom-port/serve-custom-config.test.js +++ b/test/serve/with-custom-port/serve-custom-config.test.js @@ -2,7 +2,7 @@ const path = require('path'); const getPort = require('get-port'); -const { runServe } = require('../../utils/test-utils'); +const { runWatch } = require('../../utils/test-utils'); const testPath = path.resolve(__dirname); @@ -24,7 +24,7 @@ describe('serve with devServer in config', () => { } it('Should pick up the host and port from config', async () => { - const { stdout, stderr } = await runServe(testPath, []); + const { stdout, stderr } = await runWatch(testPath, ['serve']); expect(stderr).toBeFalsy(); // Should output the correct bundle file @@ -35,7 +35,7 @@ describe('serve with devServer in config', () => { }); it('Port flag should override the config port', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port]); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port]); expect(stderr).toBeFalsy(); // Should output the correct bundle file @@ -46,7 +46,7 @@ describe('serve with devServer in config', () => { }); it('Passing hot flag works alongside other server config', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port, '--hot']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--hot']); expect(stderr).toBeFalsy(); // Should output the correct bundle file @@ -58,7 +58,7 @@ describe('serve with devServer in config', () => { }); it('works fine when no-hot flag is passed alongside other server config', async () => { - const { stdout, stderr } = await runServe(testPath, ['--port', port, '--no-hot']); + const { stdout, stderr } = await runWatch(testPath, ['serve', '--port', port, '--no-hot']); expect(stderr).toBeFalsy(); // Should output the correct bundle file diff --git a/test/stats/watch/stats-and-watch.test.js b/test/stats/watch/stats-and-watch.test.js index 278c69a4a62..6b34d69ef6f 100644 --- a/test/stats/watch/stats-and-watch.test.js +++ b/test/stats/watch/stats-and-watch.test.js @@ -4,21 +4,21 @@ const { runWatch } = require('../../utils/test-utils'); describe('stats and watch', () => { it('should not log stats with the "none" value from the configuration', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js'], true); + const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js']); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should not log stats with the "none" value from the configuration and multi compiler mode', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './multi-webpack.config.js'], true); + const { stderr, stdout } = await runWatch(__dirname, ['-c', './multi-webpack.config.js']); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); }); it('should log stats with the "normal" value in arguments', async () => { - const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--stats', 'normal'], true); + const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--stats', 'normal']); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); diff --git a/test/utils/test-utils.js b/test/utils/test-utils.js index 9d036a9a086..34b66286b89 100644 --- a/test/utils/test-utils.js +++ b/test/utils/test-utils.js @@ -39,8 +39,7 @@ const hyphenToUpperCase = (name) => { * * @param {String} testCase The path to folder that contains the webpack.config.js * @param {Array} args Array of arguments to pass to webpack - * @param {Array} nodeOptions Boolean that decides if a default output path will be set or not - * @param {Record} env Boolean that decides if a default output path will be set or not + * @param {Object} options Boolean that decides if a default output path will be set or not * @returns {Object} The webpack output or Promise when nodeOptions are present */ const run = (testCase, args = [], options = {}) => { @@ -58,14 +57,20 @@ const run = (testCase, args = [], options = {}) => { return result; }; -const runWatch = (testCase, args = [], setOutput = true, outputKillStr = /webpack \d+\.\d+\.\d/, options = {}) => { +/** + * Run the webpack CLI in watch mode for a test case. + * + * @param {String} testCase The path to folder that contains the webpack.config.js + * @param {Array} args Array of arguments to pass to webpack + * @param {Object} options Boolean that decides if a default output path will be set or not + * @param {string} outputKillStr String to kill + * @returns {Object} The webpack output or Promise when nodeOptions are present + */ +const runWatch = (testCase, args = [], options, outputKillStr = /webpack \d+\.\d+\.\d/) => { const cwd = path.resolve(testCase); - const outputPath = path.resolve(testCase, 'bin'); - const argsWithOutput = setOutput ? args.concat('--output-path', outputPath) : args; - return new Promise((resolve, reject) => { - const proc = execa(WEBPACK_PATH, argsWithOutput, { + const proc = execa(WEBPACK_PATH, args, { cwd, reject: false, stdio: 'pipe', @@ -128,10 +133,12 @@ const runAndGetWatchProc = (testCase, args = [], setOutput = true, input = '', f */ const runPromptWithAnswers = (location, args, answers, waitForOutput = true) => { const runner = runAndGetWatchProc(location, args, false, '', true); + runner.stdin.setDefaultEncoding('utf-8'); const delay = 2000; let outputTimeout; + if (waitForOutput) { let currentAnswer = 0; const writeAnswer = () => { @@ -248,14 +255,9 @@ const runInstall = async (cwd) => { }); }; -const runServe = (testPath, args) => { - return runWatch(testPath, ['serve'].concat(args), false); -}; - module.exports = { run, runWatch, - runServe, runAndGetWatchProc, runPromptWithAnswers, appendDataIfFileExists, From f2e935e8acf6c37e4ff777a80342b5991c1f7485 Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Wed, 17 Feb 2021 21:08:33 +0530 Subject: [PATCH 028/122] chore: upgrade eslint plugins (#2443) --- package.json | 4 +- packages/configtest/src/index.ts | 5 +- .../__tests__/addon-generator.test.ts | 3 +- .../__tests__/utils/scaffold-utils.test.ts | 1 - packages/generators/src/addon-generator.ts | 5 +- packages/generators/src/index.ts | 3 +- packages/generators/src/init-generator.ts | 7 +- packages/generators/src/loader-generator.ts | 2 +- packages/generators/src/plugin-generator.ts | 2 +- packages/generators/src/types/index.ts | 103 ++++++++--------- .../__tests__/npm-packages-exists.test.ts | 3 +- .../recursive-parser.test.ts.snap | 2 +- .../recursive-parser/recursive-parser.test.ts | 2 +- .../utils/__tests__/resolve-packages.test.ts | 4 - packages/generators/src/utils/ast-utils.ts | 2 +- packages/generators/src/utils/copy-utils.ts | 12 +- packages/generators/src/utils/defineTest.ts | 20 ++-- packages/generators/src/utils/entry.ts | 8 +- .../src/utils/modify-config-helper.ts | 8 +- .../src/utils/npm-packages-exists.ts | 2 +- .../generators/src/utils/resolve-packages.ts | 6 +- .../generators/src/utils/scaffold-utils.ts | 2 +- packages/generators/src/utils/types/Config.ts | 2 +- .../generators/src/utils/types/NodePath.ts | 10 +- packages/info/src/index.ts | 3 +- packages/serve/src/index.ts | 3 +- packages/serve/src/startDevServer.ts | 11 +- packages/serve/src/types.ts | 28 ++--- test/entry/scss/webpack.config.js | 2 +- test/stats/flags/webpack.config.js | 1 - test/utils/test-utils.js | 1 - yarn.lock | 107 +++++++++++++----- 32 files changed, 219 insertions(+), 155 deletions(-) diff --git a/package.json b/package.json index 368f125a321..ffb7b57f470 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "@commitlint/config-conventional": "^11.0.0", "@types/jest": "^26.0.15", "@types/node": "^14.14.6", - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^2.34.0", + "@typescript-eslint/eslint-plugin": "^4.14.1", + "@typescript-eslint/parser": "^4.14.1", "@webpack-cli/migrate": "^1.1.2", "coffeescript": "^2.5.1", "colorette": "^1.2.1", diff --git a/packages/configtest/src/index.ts b/packages/configtest/src/index.ts index 15161d85f79..caa31de3f49 100644 --- a/packages/configtest/src/index.ts +++ b/packages/configtest/src/index.ts @@ -1,5 +1,6 @@ class ConfigTestCommand { - async apply(cli): Promise { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + async apply(cli: any): Promise { const { logger, webpack } = cli; await cli.makeCommand( @@ -39,8 +40,6 @@ class ConfigTestCommand { // TODO remove this after drop webpack@4 if (error && error.length > 0) { - // eslint-disable-next-line @typescript-eslint/ban-ts-ignore - // @ts-ignore throw new webpack.WebpackOptionsValidationError(error); } } catch (error) { diff --git a/packages/generators/__tests__/addon-generator.test.ts b/packages/generators/__tests__/addon-generator.test.ts index 5d6bc2f9d0f..16322b95e99 100644 --- a/packages/generators/__tests__/addon-generator.test.ts +++ b/packages/generators/__tests__/addon-generator.test.ts @@ -23,8 +23,7 @@ describe('addon generator', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - const Gen = addonGenerator([], '', [], [], () => {}); + const Gen = addonGenerator([], '', [], [], () => ({})); gen = new Gen(null, null); gen.props = { diff --git a/packages/generators/__tests__/utils/scaffold-utils.test.ts b/packages/generators/__tests__/utils/scaffold-utils.test.ts index 2fd303e5dd1..c92e63b4143 100755 --- a/packages/generators/__tests__/utils/scaffold-utils.test.ts +++ b/packages/generators/__tests__/utils/scaffold-utils.test.ts @@ -5,7 +5,6 @@ describe('utils', () => { beforeEach(() => { mockSelf = { - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type prompt: (arg) => { return arg[0]; }, diff --git a/packages/generators/src/addon-generator.ts b/packages/generators/src/addon-generator.ts index fcc7ebfa9ba..dee481dceec 100644 --- a/packages/generators/src/addon-generator.ts +++ b/packages/generators/src/addon-generator.ts @@ -33,14 +33,15 @@ const addonGenerator = ( templateDir: string, copyFiles: string[], copyTemplateFiles: string[], - templateFn: Function, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + templateFn: (instance: any) => Record, ): Generator.GeneratorConstructor => { return class extends Generator { public props: Generator.Question; public copy: (value: string, index: number, array: string[]) => void; public copyTpl: (value: string, index: number, array: string[]) => void; - public prompting(): Promise { + public prompting(): Promise { return this.prompt(prompts).then((props: Generator.Question): void => { this.props = props; }); diff --git a/packages/generators/src/index.ts b/packages/generators/src/index.ts index 8826052aa1d..66ebc7926e3 100644 --- a/packages/generators/src/index.ts +++ b/packages/generators/src/index.ts @@ -8,7 +8,8 @@ import { modifyHelperUtil } from './utils/modify-config-helper'; import { npmPackagesExists } from './utils/npm-packages-exists'; class GeneratorsCommand { - async apply(cli): Promise { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + async apply(cli: any): Promise { const { logger } = cli; await cli.makeCommand( diff --git a/packages/generators/src/init-generator.ts b/packages/generators/src/init-generator.ts index 022768b9596..4269fcda362 100644 --- a/packages/generators/src/init-generator.ts +++ b/packages/generators/src/init-generator.ts @@ -23,7 +23,8 @@ export default class InitGenerator extends CustomGenerator { public generationPath: string; private langType: string; - public constructor(args, opts) { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + public constructor(args: any, opts: any) { super(args, opts); this.autoGenerateConfig = opts.autoSetDefaults; @@ -54,7 +55,7 @@ export default class InitGenerator extends CustomGenerator { (this.configuration.config.webpackOptions.plugins as string[]).push('new webpack.ProgressPlugin()'); } - public async prompting(): Promise { + public async prompting(): Promise { // eslint-disable-next-line @typescript-eslint/no-this-alias const self: this = this; @@ -73,7 +74,7 @@ export default class InitGenerator extends CustomGenerator { this.autoGenerateConfig, ); - const entryOption: string | object = await entryQuestions(self, multiEntries, this.autoGenerateConfig); + const entryOption: string | Record = await entryQuestions(self, multiEntries, this.autoGenerateConfig); if (typeof entryOption === 'string') { // single entry apply when default is not used diff --git a/packages/generators/src/loader-generator.ts b/packages/generators/src/loader-generator.ts index 474ebe84cdf..debf22a3d2b 100644 --- a/packages/generators/src/loader-generator.ts +++ b/packages/generators/src/loader-generator.ts @@ -52,7 +52,7 @@ export const LoaderGenerator = addonGenerator( 'examples/simple/src/static-esm-module.js.tpl', ], ['src/_index.js.tpl'], - (gen): object => ({ name: gen.props.name }), + (gen): Record => ({ name: gen.props.name }), ); export default LoaderGenerator; diff --git a/packages/generators/src/plugin-generator.ts b/packages/generators/src/plugin-generator.ts index 113bdf8322e..f33298f5bad 100644 --- a/packages/generators/src/plugin-generator.ts +++ b/packages/generators/src/plugin-generator.ts @@ -31,7 +31,7 @@ export const PluginGenerator = addonGenerator( 'examples/simple/src/static-esm-module.js.tpl', ], ['src/_index.js.tpl', 'examples/simple/_webpack.config.js.tpl'], - (gen): object => ({ name: toUpperCamelCase(gen.props.name) }), + (gen): Record => ({ name: toUpperCamelCase(gen.props.name) }), ); export default PluginGenerator; diff --git a/packages/generators/src/types/index.ts b/packages/generators/src/types/index.ts index 00cc32f4ea8..398f4dbfc82 100644 --- a/packages/generators/src/types/index.ts +++ b/packages/generators/src/types/index.ts @@ -1,16 +1,17 @@ import Generator from 'yeoman-generator'; +import { Loader } from '../utils/styleSupport'; export interface SchemaProperties { additionalProperties?: boolean; - definitions?: object; - properties?: object; + definitions?: Record; + properties?: Record; type?: string; } interface WebpackResolve { - alias?: object; + alias?: Record; aliasFields?: string[]; - cachePredicate?: Function; + cachePredicate?: () => void; cacheWithContext?: boolean; descriptionFiles?: string[]; enforceExtension?: boolean; @@ -20,19 +21,19 @@ interface WebpackResolve { mainFiles?: string[]; moduleExtensions?: string[]; modules?: string[]; - plugins?: object[] | Function[]; + plugins?: Record[] | Array<() => void>; symlinks?: boolean; concord?: boolean; - unsafeCache?: boolean | object; + unsafeCache?: boolean | Record; useSyncFileSystemCalls?: boolean; } -type IRuleSetCondition = RegExp | string | Function | object; +type IRuleSetCondition = RegExp | string | (() => void) | Record | string[]; export interface WebpackOptions { amd?: string; bail?: boolean; - cache?: boolean | object; + cache?: boolean | Record; context?: string; devServer?: { hot?: boolean; @@ -45,8 +46,8 @@ export interface WebpackOptions { publicPath?: string; port?: number | string; socket?: string; - watchOptions?: object; - headers?: object; + watchOptions?: Record; + headers?: Record; logLevel?: string; clientLogLevel?: string; overlay?: @@ -65,50 +66,50 @@ export interface WebpackOptions { inline?: boolean; disableHostCheck?: boolean; public?: string; - https?: object | boolean; + https?: Record | boolean; contentBase?: false | number | string | string[]; watchContentBase?: boolean; open?: string | boolean; useLocalIp?: boolean; openPage?: string; compress?: boolean; - proxy?: object[] | Function[]; + proxy?: Record[] | Array<() => void>; historyApiFallback?: | boolean | { - rewrites?: object[]; + rewrites?: Record[]; disableDotRule?: boolean; }; - staticOptions?: object; - setup?: Function; - before?: Function; - after?: Function; - stats?: boolean | object | string; - reporter?: Function; + staticOptions?: Record; + setup?: () => void; + before?: () => void; + after?: () => void; + stats?: boolean | Record | string; + reporter?: () => void; logTime?: boolean; noInfo?: boolean; quiet?: boolean; serverSideRender?: boolean; index?: string; - log?: Function; - warn?: Function; + log?: () => void; + warn?: () => void; }; devtool?: string; - entry?: string | object | Function; - externals?: string | object | boolean | Function | RegExp; + entry?: string | Record | (() => void); + externals?: string | Record | boolean | (() => void) | RegExp; mode?: 'development' | 'production' | 'none' | string; module?: { exprContextCritical?: boolean; exprContextRecursive?: boolean; exprContextRegExp?: boolean | RegExp; exprContextRequest?: string; - noParse?: string | string[] | Function | RegExp | RegExp[]; + noParse?: string | string[] | (() => void) | RegExp | RegExp[]; rules?: Rule[]; unknownContextCritical?: boolean; unknownContextRecursive?: boolean; unknownContextRegExp?: boolean | RegExp; unknownContextRequest?: string; - unsafeCache?: boolean | Function; + unsafeCache?: boolean | (() => void); wrappedContextCritical?: boolean; wrappedContextRecursive?: boolean; wrappedContextRegExp?: RegExp; @@ -129,25 +130,25 @@ export interface WebpackOptions { setImmediate?: boolean | string; }; output?: { - auxiliaryComment?: string | object; + auxiliaryComment?: string | Record; chunkFilename?: string; chunkLoadTimeout?: number; crossOriginLoading?: boolean | string; jsonpScriptType?: string; - devtoolFallbackModuleFilenameTemplate?: string | Function; - devtoolLineToLine?: boolean | object; - devtoolModuleFilenameTemplate?: string | Function; + devtoolFallbackModuleFilenameTemplate?: string | (() => void); + devtoolLineToLine?: boolean | Record; + devtoolModuleFilenameTemplate?: string | (() => void); devtoolNamespace?: string; - filename?: string | Function; + filename?: string | (() => void); hashDigest?: 'latin1' | string; hashDigestLength?: number; - hashFunction?: string | Function; + hashFunction?: string | (() => void); hashSalt?: string; - hotUpdateChunkFilename?: string | Function; - hotUpdateFunction?: Function; - hotUpdateMainFilename?: string | Function; - jsonpFunction?: string; - library?: string | object; + hotUpdateChunkFilename?: string | (() => void); + hotUpdateFunction?: () => void; + hotUpdateMainFilename?: string | (() => void); + jsonpFunctiion?: string; + library?: string | Record; path?: string; }; optimization?: { @@ -167,7 +168,7 @@ export interface WebpackOptions { minChunks?: number; maxAsyncRequests?: number; maxInitialRequests?: number; - name?: boolean | Function | string; + name?: boolean | (() => void) | string; filename?: string; automaticNameDelimiter?: string; hidePathInfo?: boolean; @@ -176,8 +177,8 @@ export interface WebpackOptions { maxSize?: number; automaticNameDelimiter?: number; }; - cacheGroups?: number | boolean | string | Function | RegExp | object; - runtimeChunk?: boolean | string | object; + cacheGroups?: number | boolean | string | (() => void) | RegExp | Record; + runtimeChunk?: boolean | string | Record; noEmitOnErrors?: boolean; checkWasmTypes?: boolean; mangleWasmImports?: boolean; @@ -186,7 +187,7 @@ export interface WebpackOptions { namedChunks?: boolean; portableRecords?: boolean; minimize?: boolean; - minimizer?: object[] | Function[]; + minimizer?: Record[] | Array<() => void>; nodeEnv?: false | string; }; }; @@ -194,20 +195,20 @@ export interface WebpackOptions { performance?: | false | { - assetFilter?: Function; + assetFilter?: () => void; hints?: false | string; maxEntrypointSize?: number; maxAssetSize?: number; }; - plugins?: object[] | Function[] | string[] | string; + plugins?: Record[] | Array<() => void> | string[] | string; profile?: boolean; recordsInputPath?: string; recordsOutputPath?: string; recordsPath?: string; resolve?: WebpackResolve; resolveLoader?: WebpackResolve; - stats?: string | boolean | object; - target?: string | Function; + stats?: string | boolean | Record; + target?: string | (() => void); watch?: boolean; watchOptions?: { aggregateTimeout?: number; @@ -221,22 +222,22 @@ export interface Rule { exclude?: IRuleSetCondition; include?: IRuleSetCondition; issuer?: IRuleSetCondition; - loader?: string | Function | object; - loaders?: Function[] | object[]; - options?: object; - parser?: object; + loader?: string | (() => void) | Record; + loaders?: Array<() => void> | Record[]; + options?: Record; + parser?: Record; sideEffects?: boolean; type?: string; resource?: IRuleSetCondition; resourceQuery?: IRuleSetCondition; compiler?: IRuleSetCondition; - rules?: object[]; - use?: object | object[] | Function; + rules?: Record[]; + use?: Loader[] | (() => void); test?: IRuleSetCondition; } export class CustomGenerator extends Generator { - public entryOption: string | object; + public entryOption: string | Record; public configuration: { config: { configName?: string; diff --git a/packages/generators/src/utils/__tests__/npm-packages-exists.test.ts b/packages/generators/src/utils/__tests__/npm-packages-exists.test.ts index 90a89bdf05e..4ba4efa57ca 100644 --- a/packages/generators/src/utils/__tests__/npm-packages-exists.test.ts +++ b/packages/generators/src/utils/__tests__/npm-packages-exists.test.ts @@ -4,7 +4,8 @@ import { resolvePackages } from '../resolve-packages'; jest.mock('../resolve-packages'); // TS is not aware that jest changes the type of resolvePackages -const mockResolvePackages = resolvePackages as jest.Mock; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const mockResolvePackages = resolvePackages as any; describe('npmPackagesExists', () => { test('resolves packages when they are available on the local filesystem', () => { diff --git a/packages/generators/src/utils/__tests__/recursive-parser/__snapshots__/recursive-parser.test.ts.snap b/packages/generators/src/utils/__tests__/recursive-parser/__snapshots__/recursive-parser.test.ts.snap index 592b7f56e58..69096cb389d 100644 --- a/packages/generators/src/utils/__tests__/recursive-parser/__snapshots__/recursive-parser.test.ts.snap +++ b/packages/generators/src/utils/__tests__/recursive-parser/__snapshots__/recursive-parser.test.ts.snap @@ -140,7 +140,7 @@ exports[`recursive parser remove transforms correctly using "fixture-3" data 2`] port: 9000, }, devtool: 'eval', - plugins: ['plugin1', 'plugin3'], + plugins: ['plugin1', 'plugin2', 'plugin3'], resolve: { alias: { inject: \\"{{#if_eq build 'standalone'}}\\", diff --git a/packages/generators/src/utils/__tests__/recursive-parser/recursive-parser.test.ts b/packages/generators/src/utils/__tests__/recursive-parser/recursive-parser.test.ts index 2f7148f8768..5c3a33546d9 100644 --- a/packages/generators/src/utils/__tests__/recursive-parser/recursive-parser.test.ts +++ b/packages/generators/src/utils/__tests__/recursive-parser/recursive-parser.test.ts @@ -48,7 +48,7 @@ describe('recursive parser', () => { alias: null, }); - defineTest(join(__dirname), 'remove', 'fixture-3', 'plugins', ['plugin2']); + defineTest(join(__dirname), 'remove', 'fixture-3', 'plugins', 'plugin2'); defineTest(join(__dirname), 'remove', 'fixture-3', 'module', { noParse: null, diff --git a/packages/generators/src/utils/__tests__/resolve-packages.test.ts b/packages/generators/src/utils/__tests__/resolve-packages.test.ts index 2531ba2dd3d..824fac8fa8d 100644 --- a/packages/generators/src/utils/__tests__/resolve-packages.test.ts +++ b/packages/generators/src/utils/__tests__/resolve-packages.test.ts @@ -2,11 +2,9 @@ import path from 'path'; -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type function mockPromise(value) { const isValueAPromise = (value || {}).then; const mockedPromise = { - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type then(callback) { return mockPromise(callback(value)); }, @@ -15,12 +13,10 @@ function mockPromise(value) { return isValueAPromise ? value : mockedPromise; } -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type function spawnChild(pkg) { return pkg; } -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type function getLoc(option) { const packageModule = []; option.filter((pkg) => { diff --git a/packages/generators/src/utils/ast-utils.ts b/packages/generators/src/utils/ast-utils.ts index ec529f719aa..425a5406927 100644 --- a/packages/generators/src/utils/ast-utils.ts +++ b/packages/generators/src/utils/ast-utils.ts @@ -285,7 +285,7 @@ function findAndRemovePluginByName(j: JSCodeshift, node: Node, pluginName: strin * @returns {Void} */ -function createOrUpdatePluginByName(j: JSCodeshift, rootNodePath: Node, pluginName: string, options?: object): void { +function createOrUpdatePluginByName(j: JSCodeshift, rootNodePath: Node, pluginName: string, options?: Record): void { const pluginInstancePath: Node = findPluginsByName(j, j(rootNodePath), [pluginName]); let optionsProps: Node[]; if (options) { diff --git a/packages/generators/src/utils/copy-utils.ts b/packages/generators/src/utils/copy-utils.ts index bb582e9d0d8..25dd6fda949 100644 --- a/packages/generators/src/utils/copy-utils.ts +++ b/packages/generators/src/utils/copy-utils.ts @@ -8,7 +8,8 @@ import path from 'path'; * @param {string} templateDir Absolute path to template directory * @returns {Function} A curried function that takes a file path and copies it */ -export const generatorCopy = (generator, templateDir: string): ((filePath: string) => void) => (filePath: string): void => { +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any +export const generatorCopy = (generator: any, templateDir: string): ((filePath: string) => void) => (filePath: string): void => { const sourceParts = templateDir.split(path.delimiter); sourceParts.push(...filePath.split('/')); @@ -31,9 +32,12 @@ export const generatorCopy = (generator, templateDir: string): ((filePath: strin * the template files. * @returns {Function} A curried function that takes a file path and copies it */ -export const generatorCopyTpl = (generator, templateDir: string, templateData: object): ((filePath: string) => void) => ( - filePath: string, -): void => { +export const generatorCopyTpl = ( + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + generator: any, + templateDir: string, + templateData: Record, +): ((filePath: string) => void) => (filePath: string): void => { const sourceParts = templateDir.split(path.delimiter); sourceParts.push(...filePath.split('/')); diff --git a/packages/generators/src/utils/defineTest.ts b/packages/generators/src/utils/defineTest.ts index ada2f4f1c33..f90de53f3b1 100644 --- a/packages/generators/src/utils/defineTest.ts +++ b/packages/generators/src/utils/defineTest.ts @@ -4,7 +4,13 @@ import * as path from 'path'; import { JSCodeshift, Node } from './types/NodePath'; interface Module { - (jscodeshift: JSCodeshift, ast: Node, initOptions: string | boolean | object, action: string, transformName?: string): Node; + ( + jscodeshift: JSCodeshift, + ast: Node, + initOptions: string | boolean | Record, + action: string, + transformName?: string, + ): Node; default: transformType; parser: string; } @@ -12,8 +18,8 @@ interface Module { type transformType = ( jscodeshift: JSCodeshift, ast: Node, - initOptions: string | boolean | object, - action: object | string, + initOptions: string | boolean | Record, + action: Record | string, transformName?: string, ) => Node; @@ -45,8 +51,8 @@ function runSingleTransform( dirName: string, transformName: string, testFilePrefix: string, - initOptions: object | boolean | string, - action: object | string, + initOptions: Record | boolean | string, + action: Record | string, ): string { if (!testFilePrefix) { testFilePrefix = transformName; @@ -104,8 +110,8 @@ export default function defineTest( dirName: string, transformName: string, testFilePrefix?: string, - transformObject?: object | string, - action?: object | string, + transformObject?: Record | string, + action?: Record | string, ): void { const testName: string = testFilePrefix ? `transforms correctly using "${testFilePrefix}" data` : 'transforms correctly'; describe(transformName, () => { diff --git a/packages/generators/src/utils/entry.ts b/packages/generators/src/utils/entry.ts index e8f6fe333b7..831bcac2ec9 100644 --- a/packages/generators/src/utils/entry.ts +++ b/packages/generators/src/utils/entry.ts @@ -12,7 +12,11 @@ import validate from './validate'; * @returns {Object} An Object that holds the answers given by the user, later used to scaffold */ -export default async function entry(self: Generator, multiEntries: boolean, autoGenerateDefaults = false): Promise { +export default async function entry( + self: Generator, + multiEntries: boolean, + autoGenerateDefaults = false, +): Promise> { const fixEntry = (entry: string): string => { entry = entry.trim().replace(/"|'/g, ''); @@ -30,7 +34,7 @@ export default async function entry(self: Generator, multiEntries: boolean, auto }; if (multiEntries) { - const webpackEntryPoint: object = {}; + const webpackEntryPoint: Record = {}; const multipleEntriesAnswer = await InputValidate( self, 'multipleEntries', diff --git a/packages/generators/src/utils/modify-config-helper.ts b/packages/generators/src/utils/modify-config-helper.ts index 3357e7cccee..4dbeded7f35 100644 --- a/packages/generators/src/utils/modify-config-helper.ts +++ b/packages/generators/src/utils/modify-config-helper.ts @@ -14,7 +14,7 @@ export interface Config extends Object { topScope?: string[]; configName?: string; merge: string | string[]; - webpackOptions: object; + webpackOptions: Record; } export interface TransformConfig extends Object { @@ -24,10 +24,10 @@ export interface TransformConfig extends Object { } export interface WebpackScaffoldObject extends Object { - config: { + config?: { configName?: string; topScope?: string[]; - webpackOptions?: object; + webpackOptions?: Record; }; } @@ -87,7 +87,7 @@ export function modifyHelperUtil( generationPath, }, () => { - let configModule: object; + let configModule: Record>; let finalConfig: WebpackScaffoldObject = { config: {}, }; diff --git a/packages/generators/src/utils/npm-packages-exists.ts b/packages/generators/src/utils/npm-packages-exists.ts index bc79ea156de..e22dc5e4035 100644 --- a/packages/generators/src/utils/npm-packages-exists.ts +++ b/packages/generators/src/utils/npm-packages-exists.ts @@ -45,7 +45,7 @@ export function npmExists(moduleName: string): Promise { export function npmPackagesExists(pkg: string[]): void { const acceptedPackages: string[] = []; - function resolvePackagesIfReady(): void | Function { + function resolvePackagesIfReady(): void | (() => void) { if (acceptedPackages.length === pkg.length) { return resolvePackages(acceptedPackages); } diff --git a/packages/generators/src/utils/resolve-packages.ts b/packages/generators/src/utils/resolve-packages.ts index cd5a8aa3c57..9e86529a99a 100644 --- a/packages/generators/src/utils/resolve-packages.ts +++ b/packages/generators/src/utils/resolve-packages.ts @@ -9,10 +9,6 @@ import { utils } from 'webpack-cli'; const { logger } = utils; -interface ChildProcess { - status: number; -} - /** * * Attaches a promise to the installation of the package @@ -40,7 +36,7 @@ export function processPromise(child: ExecaSyncReturnValue): Promise { * a webpack configuration through yeoman or throws an error */ -export function resolvePackages(pkg: string[]): Function | void { +export function resolvePackages(pkg: string[]): (() => void) | void { Error.stackTraceLimit = 30; const packageLocations: string[] = []; diff --git a/packages/generators/src/utils/scaffold-utils.ts b/packages/generators/src/utils/scaffold-utils.ts index f8a153909f5..c7064a02559 100644 --- a/packages/generators/src/utils/scaffold-utils.ts +++ b/packages/generators/src/utils/scaffold-utils.ts @@ -35,7 +35,7 @@ export function InputValidate( cb?: (input: string) => string | boolean, defaultChoice?: string, skip = false, -): object | any { +): Record | any { if (skip) { return { [name]: defaultChoice }; } diff --git a/packages/generators/src/utils/types/Config.ts b/packages/generators/src/utils/types/Config.ts index a511f80a0c1..89f1ff78bff 100644 --- a/packages/generators/src/utils/types/Config.ts +++ b/packages/generators/src/utils/types/Config.ts @@ -5,7 +5,7 @@ export interface Config extends Object { topScope?: string[]; configName?: string; merge: string | string[]; - webpackOptions: object; + webpackOptions: Record; } export interface TransformConfig extends Object { diff --git a/packages/generators/src/utils/types/NodePath.ts b/packages/generators/src/utils/types/NodePath.ts index dbe41aceff6..f93d2b884f0 100644 --- a/packages/generators/src/utils/types/NodePath.ts +++ b/packages/generators/src/utils/types/NodePath.ts @@ -19,7 +19,7 @@ export interface Node extends Object { value?: string; }; filter?: (p: (p: Node) => boolean) => Node; - find?: (objectExpression: object, filterExpression?: object) => Node; + find?: (objectExpression: ExpressionObject, filterExpression?: Record) => Node; forEach?: (p: (p: Node) => void) => Node; get?: (property: string) => Node; remove?: () => void; @@ -31,12 +31,12 @@ export interface Node extends Object { }; node?: Node; name?: string; - object?: object; + object?: Record; parent?: Node; properties?: Node[]; property?: Node; - prune?: Function; - replaceWith?: (objectExpression: object) => Node; + prune?: () => void; + replaceWith?: (objectExpression: Node) => Node; size?: () => number; type?: string; value?: Node | string | Node[]; @@ -88,7 +88,7 @@ export interface JSCodeshift extends Object { Program?: ExpressionObject; filters?: { VariableDeclarator: { - requiresModule: Function; + requiresModule: (p: string) => (p: Node) => boolean; }; }; } diff --git a/packages/info/src/index.ts b/packages/info/src/index.ts index 3cc41ec587f..cbbf25657c3 100644 --- a/packages/info/src/index.ts +++ b/packages/info/src/index.ts @@ -30,7 +30,8 @@ const DEFAULT_DETAILS: Information = { }; class InfoCommand { - async apply(cli): Promise { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + async apply(cli: any): Promise { const { logger } = cli; await cli.makeCommand( diff --git a/packages/serve/src/index.ts b/packages/serve/src/index.ts index 8b52e1568ec..0f33450562a 100644 --- a/packages/serve/src/index.ts +++ b/packages/serve/src/index.ts @@ -1,7 +1,8 @@ import startDevServer from './startDevServer'; class ServeCommand { - async apply(cli): Promise { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + async apply(cli: any): Promise { const { logger } = cli; await cli.makeCommand( diff --git a/packages/serve/src/startDevServer.ts b/packages/serve/src/startDevServer.ts index ccdd113c970..5549c59f1ab 100644 --- a/packages/serve/src/startDevServer.ts +++ b/packages/serve/src/startDevServer.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/* eslint-disable @typescript-eslint/no-var-requires */ import { devServerOptionsType } from './types'; /** @@ -11,7 +14,13 @@ import { devServerOptionsType } from './types'; * * @returns {Object[]} array of resulting servers */ -export default async function startDevServer(compiler, devServerCliOptions, cliOptions, logger): Promise { + +export default async function startDevServer( + compiler: any, + devServerCliOptions: any, + cliOptions: any, + logger: any, +): Promise[]> { let devServerVersion, Server, findPort; try { diff --git a/packages/serve/src/types.ts b/packages/serve/src/types.ts index 1f573e2364d..c7fece4b5c5 100644 --- a/packages/serve/src/types.ts +++ b/packages/serve/src/types.ts @@ -5,30 +5,30 @@ export type devServerOptionsType = { // eslint-disable-next-line @typescript-eslint/no-explicit-any dev?: Record; firewall?: boolean | string[]; - headers?: object; - historyApiFallback?: boolean | object; + headers?: Record; + historyApiFallback?: boolean | Record; host?: string | null; hot?: boolean | string; http2?: boolean; - https?: boolean | object; - injectClient?: boolean | Function; - injectHot?: boolean | Function; + https?: boolean | Record; + injectClient?: boolean | (() => void); + injectHot?: boolean | (() => void); liveReload?: boolean; - onAfterSetupMiddleware?: Function; - onBeforeSetupMiddleware?: Function; - onListening?: Function; - open?: string | boolean | object; + onAfterSetupMiddleware?: () => void; + onBeforeSetupMiddleware?: () => void; + onListening?: () => void; + open?: string | boolean | Record; openPage?: string | string[]; - overlay?: boolean | object; + overlay?: boolean | Record; port?: number | string | null; profile?: boolean; progress?: boolean; - proxy?: object | (object | Function)[]; + proxy?: Record | (Record | (() => void))[]; public?: string; - static?: boolean | string | object | (string | object)[]; - transportMode?: object | string; + static?: boolean | string | Record | (string | Record)[]; + transportMode?: Record | string; useLocalIp?: boolean; - publicPath?: string | Function; + publicPath?: string | (() => void); stats?: string | boolean; }; diff --git a/test/entry/scss/webpack.config.js b/test/entry/scss/webpack.config.js index d8d1ce1a57e..a2cec076cda 100644 --- a/test/entry/scss/webpack.config.js +++ b/test/entry/scss/webpack.config.js @@ -1,4 +1,4 @@ -/* eslint-disable node/no-missing-require */ +// eslint-disable-next-line const MiniCssExtractPlugin = require('mini-css-extract-plugin'); module.exports = { diff --git a/test/stats/flags/webpack.config.js b/test/stats/flags/webpack.config.js index e8dfd7998a5..1d31a7103f5 100644 --- a/test/stats/flags/webpack.config.js +++ b/test/stats/flags/webpack.config.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line node/no-unpublished-require const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); module.exports = { diff --git a/test/utils/test-utils.js b/test/utils/test-utils.js index 34b66286b89..4c587c8967a 100644 --- a/test/utils/test-utils.js +++ b/test/utils/test-utils.js @@ -13,7 +13,6 @@ const isWebpack5 = version.startsWith('5'); let devServerVersion; try { - // eslint-disable-next-line devServerVersion = require('webpack-dev-server/package.json').version; } catch (error) { // Nothing diff --git a/yarn.lock b/yarn.lock index 8a1422527ca..9f2dbf16cd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1806,11 +1806,6 @@ "@types/eslint" "*" "@types/estree" "*" -"@types/eslint-visitor-keys@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" - integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== - "@types/eslint@*": version "7.2.6" resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.2.6.tgz#5e9aff555a975596c03a98b59ecd103decc70c3c" @@ -2046,49 +2041,77 @@ dependencies: "@types/yeoman-generator" "*" -"@typescript-eslint/eslint-plugin@^2.34.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9" - integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ== +"@typescript-eslint/eslint-plugin@^4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz#22dd301ce228aaab3416b14ead10b1db3e7d3180" + integrity sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw== dependencies: - "@typescript-eslint/experimental-utils" "2.34.0" + "@typescript-eslint/experimental-utils" "4.14.1" + "@typescript-eslint/scope-manager" "4.14.1" + debug "^4.1.1" functional-red-black-tree "^1.0.1" + lodash "^4.17.15" regexpp "^3.0.0" + semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.34.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f" - integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA== +"@typescript-eslint/experimental-utils@4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz#a5c945cb24dabb96747180e1cfc8487f8066f471" + integrity sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.34.0" + "@typescript-eslint/scope-manager" "4.14.1" + "@typescript-eslint/types" "4.14.1" + "@typescript-eslint/typescript-estree" "4.14.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^2.34.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8" - integrity sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA== +"@typescript-eslint/parser@^4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.14.1.tgz#3bd6c24710cd557d8446625284bcc9c6d52817c6" + integrity sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw== dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.34.0" - "@typescript-eslint/typescript-estree" "2.34.0" - eslint-visitor-keys "^1.1.0" + "@typescript-eslint/scope-manager" "4.14.1" + "@typescript-eslint/types" "4.14.1" + "@typescript-eslint/typescript-estree" "4.14.1" + debug "^4.1.1" -"@typescript-eslint/typescript-estree@2.34.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5" - integrity sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg== +"@typescript-eslint/scope-manager@4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz#8444534254c6f370e9aa974f035ced7fe713ce02" + integrity sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw== dependencies: + "@typescript-eslint/types" "4.14.1" + "@typescript-eslint/visitor-keys" "4.14.1" + +"@typescript-eslint/types@4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa" + integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w== + +"@typescript-eslint/typescript-estree@4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b" + integrity sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ== + dependencies: + "@typescript-eslint/types" "4.14.1" + "@typescript-eslint/visitor-keys" "4.14.1" debug "^4.1.1" - eslint-visitor-keys "^1.1.0" - glob "^7.1.6" + globby "^11.0.1" is-glob "^4.0.1" lodash "^4.17.15" semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/visitor-keys@4.14.1": + version "4.14.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91" + integrity sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA== + dependencies: + "@typescript-eslint/types" "4.14.1" + eslint-visitor-keys "^2.0.0" + "@webassemblyjs/ast@1.11.0": version "1.11.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.0.tgz#a5aa679efdc9e51707a4207139da57920555961f" @@ -4737,6 +4760,18 @@ fast-glob@^3.0.3: micromatch "^4.0.2" picomatch "^2.2.1" +fast-glob@^3.1.1: + version "3.2.5" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" + integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.0" + merge2 "^1.3.0" + micromatch "^4.0.2" + picomatch "^2.2.1" + fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -5391,6 +5426,18 @@ globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" +globby@^11.0.1: + version "11.0.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.2.tgz#1af538b766a3b540ebfb58a32b2e2d5897321d83" + integrity sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + globby@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" @@ -5814,7 +5861,7 @@ ignore@^4.0.3, ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.1: +ignore@^5.1.1, ignore@^5.1.4: version "5.1.8" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== From cd5ba144c8b195f81e123d28c25c5b7c6cb1820d Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Thu, 18 Feb 2021 17:48:56 +0530 Subject: [PATCH 029/122] chore: skip flaky tests for windows (#2445) --- test/config-format/mjs/mjs.test.js | 7 ++++++- test/config-lookup/custom-name/custom-name.test.js | 7 ++++++- .../defaults/mjs-config/default-mjs-config.test.js | 7 ++++++- test/config/error-mjs/config-error.test.js | 10 +++++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/test/config-format/mjs/mjs.test.js b/test/config-format/mjs/mjs.test.js index 97853c18bfd..f0c547a6995 100644 --- a/test/config-format/mjs/mjs.test.js +++ b/test/config-format/mjs/mjs.test.js @@ -1,4 +1,4 @@ -const { run } = require('../../utils/test-utils'); +const { run, isWindows } = require('../../utils/test-utils'); describe('webpack cli', () => { it('should support mjs config format', () => { @@ -10,6 +10,11 @@ describe('webpack cli', () => { expect(exitCode).toBe(2); expect(stdout).toBeFalsy(); } else { + // TODO: fix for windows + if (isWindows) { + expect(true).toBe(true); + return; + } expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); diff --git a/test/config-lookup/custom-name/custom-name.test.js b/test/config-lookup/custom-name/custom-name.test.js index 1f088a363e4..1e9e0cbd002 100644 --- a/test/config-lookup/custom-name/custom-name.test.js +++ b/test/config-lookup/custom-name/custom-name.test.js @@ -1,7 +1,7 @@ 'use strict'; const { resolve } = require('path'); -const { run } = require('../../utils/test-utils'); +const { run, isWindows } = require('../../utils/test-utils'); describe('custom config file', () => { it('should work with cjs format', () => { @@ -21,6 +21,11 @@ describe('custom config file', () => { expect(exitCode).toBe(2); expect(stdout).toBeFalsy(); } else { + // TODO: fix for windows + if (isWindows) { + expect(true).toBe(true); + return; + } expect(exitCode).toBe(0); expect(stderr).toBeFalsy(); expect(stdout).toBeTruthy(); diff --git a/test/config/defaults/mjs-config/default-mjs-config.test.js b/test/config/defaults/mjs-config/default-mjs-config.test.js index f5b443c9613..3873d528028 100644 --- a/test/config/defaults/mjs-config/default-mjs-config.test.js +++ b/test/config/defaults/mjs-config/default-mjs-config.test.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const { run, isWebpack5 } = require('../../../utils/test-utils'); +const { run, isWebpack5, isWindows } = require('../../../utils/test-utils'); describe('Default Config:', () => { it('Should be able to pick mjs config by default', () => { @@ -10,6 +10,11 @@ describe('Default Config:', () => { expect(exitCode).toEqual(2); expect(stdout).toBeFalsy(); } else { + // TODO: fix for windows + if (isWindows) { + expect(true).toBe(true); + return; + } expect(exitCode).toEqual(0); expect(stderr).toBeFalsy(); // default entry should be used diff --git a/test/config/error-mjs/config-error.test.js b/test/config/error-mjs/config-error.test.js index eb90cbf1e76..0bdf082b9b0 100644 --- a/test/config/error-mjs/config-error.test.js +++ b/test/config/error-mjs/config-error.test.js @@ -1,8 +1,16 @@ 'use strict'; const { resolve } = require('path'); -const { run } = require('../../utils/test-utils'); +const { run, isWindows } = require('../../utils/test-utils'); describe('config error', () => { + // TODO fix on windows + if (isWindows) { + it('TODO: ix on windows', () => { + expect(true).toBe(true); + }); + return; + } + it('should throw error with invalid configuration', () => { const { exitCode, stderr, stdout } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.mjs')], { env: { WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true }, From 6edc0e18527ecd91c2f5494b100ad9aab82a37a7 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 18 Feb 2021 17:09:11 +0300 Subject: [PATCH 030/122] chore(deps-dev): bump @typescript-eslint Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.14.1 to 4.15.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.15.1/packages/eslint-plugin) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 58 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9f2dbf16cd4..5ac34f05b68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2042,12 +2042,12 @@ "@types/yeoman-generator" "*" "@typescript-eslint/eslint-plugin@^4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz#22dd301ce228aaab3416b14ead10b1db3e7d3180" - integrity sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw== + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.1.tgz#835f64aa0a403e5e9e64c10ceaf8d05c3f015180" + integrity sha512-yW2epMYZSpNJXZy22Biu+fLdTG8Mn6b22kR3TqblVk50HGNV8Zya15WAXuQCr8tKw4Qf1BL4QtI6kv6PCkLoJw== dependencies: - "@typescript-eslint/experimental-utils" "4.14.1" - "@typescript-eslint/scope-manager" "4.14.1" + "@typescript-eslint/experimental-utils" "4.15.1" + "@typescript-eslint/scope-manager" "4.15.1" debug "^4.1.1" functional-red-black-tree "^1.0.1" lodash "^4.17.15" @@ -2055,15 +2055,15 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz#a5c945cb24dabb96747180e1cfc8487f8066f471" - integrity sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ== +"@typescript-eslint/experimental-utils@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.1.tgz#d744d1ac40570a84b447f7aa1b526368afd17eec" + integrity sha512-9LQRmOzBRI1iOdJorr4jEnQhadxK4c9R2aEAsm7WE/7dq8wkKD1suaV0S/JucTL8QlYUPU1y2yjqg+aGC0IQBQ== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.14.1" - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/typescript-estree" "4.14.1" + "@typescript-eslint/scope-manager" "4.15.1" + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/typescript-estree" "4.15.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" @@ -2085,11 +2085,24 @@ "@typescript-eslint/types" "4.14.1" "@typescript-eslint/visitor-keys" "4.14.1" +"@typescript-eslint/scope-manager@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz#f6511eb38def2a8a6be600c530c243bbb56ac135" + integrity sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA== + dependencies: + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/visitor-keys" "4.15.1" + "@typescript-eslint/types@4.14.1": version "4.14.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa" integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w== +"@typescript-eslint/types@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.1.tgz#da702f544ef1afae4bc98da699eaecd49cf31c8c" + integrity sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw== + "@typescript-eslint/typescript-estree@4.14.1": version "4.14.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b" @@ -2104,6 +2117,19 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz#fa9a9ff88b4a04d901ddbe5b248bc0a00cd610be" + integrity sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw== + dependencies: + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/visitor-keys" "4.15.1" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + semver "^7.3.2" + tsutils "^3.17.1" + "@typescript-eslint/visitor-keys@4.14.1": version "4.14.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91" @@ -2112,6 +2138,14 @@ "@typescript-eslint/types" "4.14.1" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz#c76abbf2a3be8a70ed760f0e5756bf62de5865dd" + integrity sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww== + dependencies: + "@typescript-eslint/types" "4.15.1" + eslint-visitor-keys "^2.0.0" + "@webassemblyjs/ast@1.11.0": version "1.11.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.0.tgz#a5aa679efdc9e51707a4207139da57920555961f" From cdd983a1eac5928d19c34de2636e3abf54d0a98d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 18 Feb 2021 20:21:47 +0300 Subject: [PATCH 031/122] chore(deps-dev): bump @typescript-eslint/parser Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.14.1 to 4.15.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.15.1/packages/parser) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5ac34f05b68..c68fde36863 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2068,13 +2068,13 @@ eslint-utils "^2.0.0" "@typescript-eslint/parser@^4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.14.1.tgz#3bd6c24710cd557d8446625284bcc9c6d52817c6" - integrity sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw== + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.15.1.tgz#4c91a0602733db63507e1dbf13187d6c71a153c4" + integrity sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA== dependencies: - "@typescript-eslint/scope-manager" "4.14.1" - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/typescript-estree" "4.14.1" + "@typescript-eslint/scope-manager" "4.15.1" + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/typescript-estree" "4.15.1" debug "^4.1.1" "@typescript-eslint/scope-manager@4.14.1": From fbc53aeadd47fb15f09d3469e224e2107c9e43a6 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Thu, 18 Feb 2021 22:52:13 +0530 Subject: [PATCH 032/122] docs: remove migrate references (#2450) --- .github/CONTRIBUTING.md | 66 ----------------------------------------- 1 file changed, 66 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c394cda8e83..21debd0edf9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -23,10 +23,6 @@ Table of Contents - [Submitting a good Pull Request](#submitting-a-good-pull-request) - [Commit message](#commit-message) - [Commit Message Format](#commit-message-format) -- [Migrate with the CLI](#migrate-with-the-cli) - - [How it's being done](#how-its-being-done) - - [Structure of a transform](#structure-of-a-transform) - - [Further Work](#further-work) - [Contributor License Agreement](#contributor-license-agreement) - [Documentation](#documentation) - [Releasing](#releasing) @@ -239,68 +235,6 @@ feat(webpack-cli): allow multiple values for --stats docs: update README.md ``` -## Migrate with the CLI - -```sh -webpack migrate -``` - -The expected result of the above command is to take the mentioned `webpack` configuration and create a new configuration file which is compatible with webpack 2. -It should be a valid new config and should keep intact all the features from the original config. -The new config will be as readable as possible (may add some comments). - -With [#40](https://github.com/webpack/webpack-cli/pull/40), we have been able to add basic scaffolding and do many of the conversions recommended in the [docs](https://webpack.js.org/migrate). - -### How it's being done - -We use [`jscodeshift`](https://github.com/facebook/jscodeshift) transforms called `codemods` to accomplish this. -We have written a bunch of transformations under [/lib/transformations](https://github.com/webpack/webpack-cli/tree/master/lib/transformations),divided logically. -We convert the existing webpack config to [AST](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API). We then parse this tree for the specific features and modify it to conform to webpack v2. - -#### Structure of a transform - -The directory structure of a transform looks as follows - - -```sh -│ -├──__snapshots__ -├──__testfixtures__ -│ │ -│ └───transform-name.input.js -│ -├──transform-name.js -├──transform-name.test.js -``` - -`transform-name.js` - -This file contains the actual transformation codemod. It applies specific transformation and parsing logic to accomplish its job. -There are utilities available under `/lib/utils.js` which can help you with this. - -`transform-name.test.js` - -This is where you declare a new test case for your transformation. -Each test will refer to an input webpack config snippet. -Conventionally we write them in `\_\_testfixtures\_\_`. - -```js -const defineTest = require('../defineTest'); - -defineTest(__dirname, 'transform-name.input1.js'); -defineTest(__dirname, 'transform-name.input2.js'); -``` - -`defineTest` is a helper test method which helps us to run tests on all the transforms uniformly. -It takes the input file given as parameter and uses jest to create a snapshot of the output. This effectively tests the correctness of our transformation. - -### Further Work - -This is still in a very raw form. We'd like to take this as close to a truly useful tool as possible. -We will still need to - -- Support all kinds of webpack configuration(made using merge tools) -- Test these transforms against real-world configurations. - ## Contributor License Agreement When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the CLA. If you are submitting a PR for the first time, it will link you to the right place to sign it. If you have committed your contributions using an email that is not the same as your email used on GitHub, the CLA bot can't accept your contribution. From 74ed07b0d27aad0ee873b039b644ea68470b3e87 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 18 Feb 2021 21:40:23 +0300 Subject: [PATCH 033/122] chore(deps-dev): bump webpack from 5.22.0 to 5.23.0 (#2451) Bumps [webpack](https://github.com/webpack/webpack) from 5.22.0 to 5.23.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.22.0...v5.23.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index c68fde36863..fa022fa1bed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11156,9 +11156,9 @@ webpack-sources@^2.1.1: source-map "^0.6.1" webpack@^5.21.1: - version "5.22.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.22.0.tgz#8505158bc52dcbbdb01ac94796a8aed61badf11a" - integrity sha512-xqlb6r9RUXda/d9iA6P7YRTP1ChWeP50TEESKMMNIg0u8/Rb66zN9YJJO7oYgJTRyFyYi43NVC5feG45FSO1vQ== + version "5.23.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.23.0.tgz#9ed57e9a54b267b3549899271ad780cddc6ee316" + integrity sha512-RC6dwDuRxiU75F8XC4H08NtzUrMfufw5LDnO8dTtaKU2+fszEdySCgZhNwSBBn516iNaJbQI7T7OPHIgCwcJmg== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" From 97ab92ac75324ff9598857a971c211e4a8de067e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 19 Feb 2021 14:35:13 +0300 Subject: [PATCH 034/122] chore(deps-dev): bump @types/node from 14.14.28 to 14.14.30 (#2453) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.28 to 14.14.30. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/yarn.lock b/yarn.lock index fa022fa1bed..cf087344fe2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1936,9 +1936,9 @@ integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.6": - version "14.14.28" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.28.tgz#cade4b64f8438f588951a6b35843ce536853f25b" - integrity sha512-lg55ArB+ZiHHbBBttLpzD07akz0QPrZgUODNakeC09i62dnrywr9mFErHuaPlB6I7z+sEbK+IYmplahvplCj2g== + version "14.14.30" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.30.tgz#7d5162eec085ba34f8cb9011e9ba12119f76f961" + integrity sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -2077,14 +2077,6 @@ "@typescript-eslint/typescript-estree" "4.15.1" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz#8444534254c6f370e9aa974f035ced7fe713ce02" - integrity sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw== - dependencies: - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/visitor-keys" "4.14.1" - "@typescript-eslint/scope-manager@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz#f6511eb38def2a8a6be600c530c243bbb56ac135" @@ -2093,30 +2085,11 @@ "@typescript-eslint/types" "4.15.1" "@typescript-eslint/visitor-keys" "4.15.1" -"@typescript-eslint/types@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa" - integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w== - "@typescript-eslint/types@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.1.tgz#da702f544ef1afae4bc98da699eaecd49cf31c8c" integrity sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw== -"@typescript-eslint/typescript-estree@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b" - integrity sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ== - dependencies: - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/visitor-keys" "4.14.1" - debug "^4.1.1" - globby "^11.0.1" - is-glob "^4.0.1" - lodash "^4.17.15" - semver "^7.3.2" - tsutils "^3.17.1" - "@typescript-eslint/typescript-estree@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz#fa9a9ff88b4a04d901ddbe5b248bc0a00cd610be" @@ -2130,14 +2103,6 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91" - integrity sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA== - dependencies: - "@typescript-eslint/types" "4.14.1" - eslint-visitor-keys "^2.0.0" - "@typescript-eslint/visitor-keys@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz#c76abbf2a3be8a70ed760f0e5756bf62de5865dd" From fb22376b0440f81261e89f0b2025199f945454c3 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 19 Feb 2021 17:10:13 +0530 Subject: [PATCH 035/122] test: refactor (#2454) --- .../__tests__/applyCLIPlugin.test.js | 51 ------------ .../webpack-cli/__tests__/resolveArgs.test.js | 79 ------------------- .../__tests__ => test/api}/CLI.test.js | 2 +- .../api}/resolveConfig/env.webpack.config.cjs | 0 .../api}/resolveConfig/resolveConfig.test.js | 2 +- .../api}/resolveConfig/webpack.config.cjs | 0 .../api}/resolveConfig/webpack.config1.cjs | 0 .../api}/resolveConfig/webpack.config2.cjs | 0 .../resolveConfig/webpack.promise.config.cjs | 0 9 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 packages/webpack-cli/__tests__/applyCLIPlugin.test.js delete mode 100644 packages/webpack-cli/__tests__/resolveArgs.test.js rename {packages/webpack-cli/__tests__ => test/api}/CLI.test.js (99%) rename {packages/webpack-cli/__tests__ => test/api}/resolveConfig/env.webpack.config.cjs (100%) rename {packages/webpack-cli/__tests__ => test/api}/resolveConfig/resolveConfig.test.js (97%) rename {packages/webpack-cli/__tests__ => test/api}/resolveConfig/webpack.config.cjs (100%) rename {packages/webpack-cli/__tests__ => test/api}/resolveConfig/webpack.config1.cjs (100%) rename {packages/webpack-cli/__tests__ => test/api}/resolveConfig/webpack.config2.cjs (100%) rename {packages/webpack-cli/__tests__ => test/api}/resolveConfig/webpack.promise.config.cjs (100%) diff --git a/packages/webpack-cli/__tests__/applyCLIPlugin.test.js b/packages/webpack-cli/__tests__/applyCLIPlugin.test.js deleted file mode 100644 index 7889a7af624..00000000000 --- a/packages/webpack-cli/__tests__/applyCLIPlugin.test.js +++ /dev/null @@ -1,51 +0,0 @@ -const webpackCLI = require('../lib/webpack-cli'); -const CLIPlugin = require('../lib/plugins/CLIPlugin'); - -const applyCLIPlugin = new webpackCLI().applyCLIPlugin; - -describe('CLIPluginResolver', () => { - it('should add CLI plugin to single compiler object', async () => { - const result = await applyCLIPlugin({ options: {}, path: new WeakMap() }, { hot: true, prefetch: true }); - expect(result.options.plugins[0] instanceof CLIPlugin).toBeTruthy(); - expect(result.options.plugins[0].options).toEqual({ - configPath: undefined, - helpfulOutput: true, - hot: true, - progress: undefined, - prefetch: true, - analyze: undefined, - }); - }); - - it('should add CLI plugin to multi compiler object', async () => { - const result = await applyCLIPlugin({ options: [{}, {}], path: new WeakMap() }, { hot: true, prefetch: true }); - expect(result.options[0].plugins[0] instanceof CLIPlugin).toBeTruthy(); - expect(result.options[1].plugins[0] instanceof CLIPlugin).toBeTruthy(); - expect(result.options).toEqual([ - { - plugins: [ - new CLIPlugin({ - configPath: undefined, - helpfulOutput: true, - hot: true, - progress: undefined, - prefetch: true, - analyze: undefined, - }), - ], - }, - { - plugins: [ - new CLIPlugin({ - configPath: undefined, - helpfulOutput: true, - hot: true, - progress: undefined, - prefetch: true, - analyze: undefined, - }), - ], - }, - ]); - }); -}); diff --git a/packages/webpack-cli/__tests__/resolveArgs.test.js b/packages/webpack-cli/__tests__/resolveArgs.test.js deleted file mode 100644 index db8215e98d5..00000000000 --- a/packages/webpack-cli/__tests__/resolveArgs.test.js +++ /dev/null @@ -1,79 +0,0 @@ -const { resolve } = require('path'); -const webpackCLI = require('../lib/webpack-cli'); - -const targetValues = ['web', 'webworker', 'node', 'async-node', 'node-webkit', 'electron-main', 'electron-renderer', 'electron-preload']; -const cli = new webpackCLI(); - -describe('BasicResolver', () => { - it('should handle the output option', async () => { - const result = await cli.applyOptions({ options: {} }, { outputPath: './bundle' }); - - expect(result.options.output.path).toEqual(resolve('bundle')); - }); - - it('should handle the mode option [production]', async () => { - const result = await cli.applyOptions({ options: {} }, { mode: 'production' }); - - expect(result.options).toMatchObject({ mode: 'production' }); - expect(result.options.mode).toEqual('production'); - }); - - it('should handle the mode option [development]', async () => { - const result = await cli.applyOptions( - { options: {} }, - { - mode: 'development', - }, - ); - - expect(result.options).toMatchObject({ mode: 'development' }); - expect(result.options.mode).toEqual('development'); - }); - - it('should handle the mode option [none]', async () => { - const result = await cli.applyOptions( - { options: {} }, - { - mode: 'none', - }, - ); - - expect(result.options).toMatchObject({ mode: 'none' }); - expect(result.options.mode).toEqual('none'); - }); - - it('should prefer supplied move flag over NODE_ENV', async () => { - process.env.NODE_ENV = 'production'; - const result = await cli.applyOptions({ options: {} }, { mode: 'development' }); - - expect(result.options).toMatchObject({ mode: 'development' }); - }); - - it('should prefer supplied move flag over mode from config', async () => { - const result = await cli.applyOptions({ options: { mode: 'development' } }, { mode: 'production' }); - - expect(result.options).toMatchObject({ mode: 'production' }); - }); - - it('should prefer mode form config over NODE_ENV', async () => { - process.env.NODE_ENV = 'development'; - const result = await cli.applyOptions({ options: {} }, { mode: 'production' }); - - expect(result.options).toMatchObject({ mode: 'production' }); - }); - - it('should prefer mode form flag over NODE_ENV and config', async () => { - process.env.NODE_ENV = 'development'; - const result = await cli.applyOptions({ options: {} }, {}); - - expect(result.options).toMatchObject({ mode: 'development' }); - }); - - targetValues.map((option) => { - it(`should handle ${option} option`, async () => { - const result = await cli.applyOptions({ options: {} }, { target: option }); - - expect(result.options.target).toEqual(option); - }); - }); -}); diff --git a/packages/webpack-cli/__tests__/CLI.test.js b/test/api/CLI.test.js similarity index 99% rename from packages/webpack-cli/__tests__/CLI.test.js rename to test/api/CLI.test.js index 348e081893a..a56e71c8769 100644 --- a/packages/webpack-cli/__tests__/CLI.test.js +++ b/test/api/CLI.test.js @@ -1,4 +1,4 @@ -const CLI = require('../lib/webpack-cli'); +const CLI = require('../../packages/webpack-cli/lib/webpack-cli'); describe('CLI API', () => { let cli; diff --git a/packages/webpack-cli/__tests__/resolveConfig/env.webpack.config.cjs b/test/api/resolveConfig/env.webpack.config.cjs similarity index 100% rename from packages/webpack-cli/__tests__/resolveConfig/env.webpack.config.cjs rename to test/api/resolveConfig/env.webpack.config.cjs diff --git a/packages/webpack-cli/__tests__/resolveConfig/resolveConfig.test.js b/test/api/resolveConfig/resolveConfig.test.js similarity index 97% rename from packages/webpack-cli/__tests__/resolveConfig/resolveConfig.test.js rename to test/api/resolveConfig/resolveConfig.test.js index d3002fb0225..cff857beb18 100644 --- a/packages/webpack-cli/__tests__/resolveConfig/resolveConfig.test.js +++ b/test/api/resolveConfig/resolveConfig.test.js @@ -1,5 +1,5 @@ const { resolve } = require('path'); -const WebpackCLI = require('../../lib/webpack-cli'); +const WebpackCLI = require('../../../packages/webpack-cli/lib/webpack-cli'); const config1 = require('./webpack.config1.cjs'); const config2 = require('./webpack.config2.cjs'); const arrayConfig = require('./webpack.config.cjs'); diff --git a/packages/webpack-cli/__tests__/resolveConfig/webpack.config.cjs b/test/api/resolveConfig/webpack.config.cjs similarity index 100% rename from packages/webpack-cli/__tests__/resolveConfig/webpack.config.cjs rename to test/api/resolveConfig/webpack.config.cjs diff --git a/packages/webpack-cli/__tests__/resolveConfig/webpack.config1.cjs b/test/api/resolveConfig/webpack.config1.cjs similarity index 100% rename from packages/webpack-cli/__tests__/resolveConfig/webpack.config1.cjs rename to test/api/resolveConfig/webpack.config1.cjs diff --git a/packages/webpack-cli/__tests__/resolveConfig/webpack.config2.cjs b/test/api/resolveConfig/webpack.config2.cjs similarity index 100% rename from packages/webpack-cli/__tests__/resolveConfig/webpack.config2.cjs rename to test/api/resolveConfig/webpack.config2.cjs diff --git a/packages/webpack-cli/__tests__/resolveConfig/webpack.promise.config.cjs b/test/api/resolveConfig/webpack.promise.config.cjs similarity index 100% rename from packages/webpack-cli/__tests__/resolveConfig/webpack.promise.config.cjs rename to test/api/resolveConfig/webpack.promise.config.cjs From b121039f5dca04de7b495dd08176d0615164a2cb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 20 Feb 2021 15:46:43 +0300 Subject: [PATCH 036/122] chore(deps-dev): bump @types/node Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.30 to 14.14.31. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index cf087344fe2..edab1d93118 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1936,9 +1936,9 @@ integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.6": - version "14.14.30" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.30.tgz#7d5162eec085ba34f8cb9011e9ba12119f76f961" - integrity sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg== + version "14.14.31" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.31.tgz#72286bd33d137aa0d152d47ec7c1762563d34055" + integrity sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g== "@types/normalize-package-data@^2.4.0": version "2.4.0" From 66ac9eb5989fa1ec6136d5463291b231a5684fa6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:21:05 +0300 Subject: [PATCH 037/122] chore(deps-dev): bump typescript from 4.1.5 to 4.2.2 (#2463) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.5 to 4.2.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/commits) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index edab1d93118..c10875d581c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10740,9 +10740,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== + version "4.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c" + integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ== uglify-js@^3.1.4: version "3.11.4" From c1462a44f7e954b947d0f9b34dfb9483a1010052 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:21:23 +0300 Subject: [PATCH 038/122] chore(deps-dev): bump ts-jest from 26.5.1 to 26.5.2 (#2465) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 26.5.1 to 26.5.2. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v26.5.1...v26.5.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index c10875d581c..7f565e676b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10618,9 +10618,9 @@ trim-off-newlines@^1.0.0: integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= ts-jest@^26.4.3: - version "26.5.1" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.1.tgz#4d53ee4481552f57c1624f0bd3425c8b17996150" - integrity sha512-G7Rmo3OJMvlqE79amJX8VJKDiRcd7/r61wh9fnvvG8cAjhA9edklGw/dCxRSQmfZ/z8NDums5srSVgwZos1qfg== + version "26.5.2" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.2.tgz#5281d6b44c2f94f71205728a389edc3d7995b0c4" + integrity sha512-bwyJ2zJieSugf7RB+o8fgkMeoMVMM2KPDE0UklRLuACxjwJsOrZNo6chrcScmK33YavPSwhARffy8dZx5LJdUQ== dependencies: "@types/jest" "26.x" bs-logger "0.x" From 06431900d2fb97a2d033003374d81721e84bebc6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:21:30 +0300 Subject: [PATCH 039/122] chore(deps-dev): bump webpack from 5.23.0 to 5.24.1 (#2464) Bumps [webpack](https://github.com/webpack/webpack) from 5.23.0 to 5.24.1. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.23.0...v5.24.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7f565e676b7..cdf9bc38989 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4318,10 +4318,10 @@ es-abstract@^1.18.0-next.0, es-abstract@^1.18.0-next.1: string.prototype.trimend "^1.0.1" string.prototype.trimstart "^1.0.1" -es-module-lexer@^0.3.26: - version "0.3.26" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.3.26.tgz#7b507044e97d5b03b01d4392c74ffeb9c177a83b" - integrity sha512-Va0Q/xqtrss45hWzP8CZJwzGSZJjDM5/MJRE3IXXnUCcVLElR9BRaE9F62BopysASyc4nM3uwhSW7FFB9nlWAA== +es-module-lexer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.4.0.tgz#21f4181cc8b7eee06855f1c59e6087c7bc4f77b0" + integrity sha512-iuEGihqqhKWFgh72Q/Jtch7V2t/ft8w8IPP2aEN8ArYKO+IWyo6hsi96hCdgyeEDQIV3InhYQ9BlwUFPGXrbEQ== es-to-primitive@^1.2.1: version "1.2.1" @@ -11121,9 +11121,9 @@ webpack-sources@^2.1.1: source-map "^0.6.1" webpack@^5.21.1: - version "5.23.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.23.0.tgz#9ed57e9a54b267b3549899271ad780cddc6ee316" - integrity sha512-RC6dwDuRxiU75F8XC4H08NtzUrMfufw5LDnO8dTtaKU2+fszEdySCgZhNwSBBn516iNaJbQI7T7OPHIgCwcJmg== + version "5.24.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.24.1.tgz#6b7730bfba1ee94b05d05ef7c32743a35105a744" + integrity sha512-eg+6OIt6npUSwbhRQY6XffAixEUSARBf+WAWOxrZwOB4jRbbpMXlridFy/Yt7N0U20Ry1vp/nnDbtN7l1rUdIA== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" @@ -11134,7 +11134,7 @@ webpack@^5.21.1: browserslist "^4.14.5" chrome-trace-event "^1.0.2" enhanced-resolve "^5.7.0" - es-module-lexer "^0.3.26" + es-module-lexer "^0.4.0" eslint-scope "^5.1.1" events "^3.2.0" glob-to-regexp "^0.4.1" From 4777381bfad4935ac90bdc58f02cd347f203222a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:47:05 +0300 Subject: [PATCH 040/122] chore(deps-dev): bump @typescript-eslint/parser Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.15.1 to 4.15.2. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.15.2/packages/parser) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index cdf9bc38989..46775103eb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2068,13 +2068,13 @@ eslint-utils "^2.0.0" "@typescript-eslint/parser@^4.14.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.15.1.tgz#4c91a0602733db63507e1dbf13187d6c71a153c4" - integrity sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA== + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.15.2.tgz#c804474321ef76a3955aec03664808f0d6e7872e" + integrity sha512-SHeF8xbsC6z2FKXsaTb1tBCf0QZsjJ94H6Bo51Y1aVEZ4XAefaw5ZAilMoDPlGghe+qtq7XdTiDlGfVTOmvA+Q== dependencies: - "@typescript-eslint/scope-manager" "4.15.1" - "@typescript-eslint/types" "4.15.1" - "@typescript-eslint/typescript-estree" "4.15.1" + "@typescript-eslint/scope-manager" "4.15.2" + "@typescript-eslint/types" "4.15.2" + "@typescript-eslint/typescript-estree" "4.15.2" debug "^4.1.1" "@typescript-eslint/scope-manager@4.15.1": @@ -2085,11 +2085,24 @@ "@typescript-eslint/types" "4.15.1" "@typescript-eslint/visitor-keys" "4.15.1" +"@typescript-eslint/scope-manager@4.15.2": + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.15.2.tgz#5725bda656995960ae1d004bfd1cd70320f37f4f" + integrity sha512-Zm0tf/MSKuX6aeJmuXexgdVyxT9/oJJhaCkijv0DvJVT3ui4zY6XYd6iwIo/8GEZGy43cd7w1rFMiCLHbRzAPQ== + dependencies: + "@typescript-eslint/types" "4.15.2" + "@typescript-eslint/visitor-keys" "4.15.2" + "@typescript-eslint/types@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.1.tgz#da702f544ef1afae4bc98da699eaecd49cf31c8c" integrity sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw== +"@typescript-eslint/types@4.15.2": + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.2.tgz#04acf3a2dc8001a88985291744241e732ef22c60" + integrity sha512-r7lW7HFkAarfUylJ2tKndyO9njwSyoy6cpfDKWPX6/ctZA+QyaYscAHXVAfJqtnY6aaTwDYrOhp+ginlbc7HfQ== + "@typescript-eslint/typescript-estree@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz#fa9a9ff88b4a04d901ddbe5b248bc0a00cd610be" @@ -2103,6 +2116,19 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@4.15.2": + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.2.tgz#c2f7a1e94f3428d229d5ecff3ead6581ee9b62fa" + integrity sha512-cGR8C2g5SPtHTQvAymEODeqx90pJHadWsgTtx6GbnTWKqsg7yp6Eaya9nFzUd4KrKhxdYTTFBiYeTPQaz/l8bw== + dependencies: + "@typescript-eslint/types" "4.15.2" + "@typescript-eslint/visitor-keys" "4.15.2" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + semver "^7.3.2" + tsutils "^3.17.1" + "@typescript-eslint/visitor-keys@4.15.1": version "4.15.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz#c76abbf2a3be8a70ed760f0e5756bf62de5865dd" @@ -2111,6 +2137,14 @@ "@typescript-eslint/types" "4.15.1" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@4.15.2": + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.2.tgz#3d1c7979ce75bf6acf9691109bd0d6b5706192b9" + integrity sha512-TME1VgSb7wTwgENN5KVj4Nqg25hP8DisXxNBojM4Nn31rYaNDIocNm5cmjOFfh42n7NVERxWrDFoETO/76ePyg== + dependencies: + "@typescript-eslint/types" "4.15.2" + eslint-visitor-keys "^2.0.0" + "@webassemblyjs/ast@1.11.0": version "1.11.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.0.tgz#a5aa679efdc9e51707a4207139da57920555961f" From 8222de9faa1f0469fa4430d6c504b0d723d05891 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:47:17 +0300 Subject: [PATCH 041/122] chore(deps-dev): bump @typescript-eslint/eslint-plugin Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.15.1 to 4.15.2. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.15.2/packages/eslint-plugin) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index 46775103eb2..7ac4460752b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2042,12 +2042,12 @@ "@types/yeoman-generator" "*" "@typescript-eslint/eslint-plugin@^4.14.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.1.tgz#835f64aa0a403e5e9e64c10ceaf8d05c3f015180" - integrity sha512-yW2epMYZSpNJXZy22Biu+fLdTG8Mn6b22kR3TqblVk50HGNV8Zya15WAXuQCr8tKw4Qf1BL4QtI6kv6PCkLoJw== + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.2.tgz#981b26b4076c62a5a55873fbef3fe98f83360c61" + integrity sha512-uiQQeu9tWl3f1+oK0yoAv9lt/KXO24iafxgQTkIYO/kitruILGx3uH+QtIAHqxFV+yIsdnJH+alel9KuE3J15Q== dependencies: - "@typescript-eslint/experimental-utils" "4.15.1" - "@typescript-eslint/scope-manager" "4.15.1" + "@typescript-eslint/experimental-utils" "4.15.2" + "@typescript-eslint/scope-manager" "4.15.2" debug "^4.1.1" functional-red-black-tree "^1.0.1" lodash "^4.17.15" @@ -2055,15 +2055,15 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.1.tgz#d744d1ac40570a84b447f7aa1b526368afd17eec" - integrity sha512-9LQRmOzBRI1iOdJorr4jEnQhadxK4c9R2aEAsm7WE/7dq8wkKD1suaV0S/JucTL8QlYUPU1y2yjqg+aGC0IQBQ== +"@typescript-eslint/experimental-utils@4.15.2": + version "4.15.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.2.tgz#5efd12355bd5b535e1831282e6cf465b9a71cf36" + integrity sha512-Fxoshw8+R5X3/Vmqwsjc8nRO/7iTysRtDqx6rlfLZ7HbT8TZhPeQqbPjTyk2RheH3L8afumecTQnUc9EeXxohQ== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.15.1" - "@typescript-eslint/types" "4.15.1" - "@typescript-eslint/typescript-estree" "4.15.1" + "@typescript-eslint/scope-manager" "4.15.2" + "@typescript-eslint/types" "4.15.2" + "@typescript-eslint/typescript-estree" "4.15.2" eslint-scope "^5.0.0" eslint-utils "^2.0.0" From 9d3ece045aea2f95cff03da58707c343d960d64f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 14:24:31 +0300 Subject: [PATCH 042/122] chore(deps-dev): bump webpack from 5.24.1 to 5.24.2 (#2466) Bumps [webpack](https://github.com/webpack/webpack) from 5.24.1 to 5.24.2. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.24.1...v5.24.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7ac4460752b..8571a0b521c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2077,14 +2077,6 @@ "@typescript-eslint/typescript-estree" "4.15.2" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz#f6511eb38def2a8a6be600c530c243bbb56ac135" - integrity sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA== - dependencies: - "@typescript-eslint/types" "4.15.1" - "@typescript-eslint/visitor-keys" "4.15.1" - "@typescript-eslint/scope-manager@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.15.2.tgz#5725bda656995960ae1d004bfd1cd70320f37f4f" @@ -2093,29 +2085,11 @@ "@typescript-eslint/types" "4.15.2" "@typescript-eslint/visitor-keys" "4.15.2" -"@typescript-eslint/types@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.1.tgz#da702f544ef1afae4bc98da699eaecd49cf31c8c" - integrity sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw== - "@typescript-eslint/types@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.2.tgz#04acf3a2dc8001a88985291744241e732ef22c60" integrity sha512-r7lW7HFkAarfUylJ2tKndyO9njwSyoy6cpfDKWPX6/ctZA+QyaYscAHXVAfJqtnY6aaTwDYrOhp+ginlbc7HfQ== -"@typescript-eslint/typescript-estree@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz#fa9a9ff88b4a04d901ddbe5b248bc0a00cd610be" - integrity sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw== - dependencies: - "@typescript-eslint/types" "4.15.1" - "@typescript-eslint/visitor-keys" "4.15.1" - debug "^4.1.1" - globby "^11.0.1" - is-glob "^4.0.1" - semver "^7.3.2" - tsutils "^3.17.1" - "@typescript-eslint/typescript-estree@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.2.tgz#c2f7a1e94f3428d229d5ecff3ead6581ee9b62fa" @@ -2129,14 +2103,6 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz#c76abbf2a3be8a70ed760f0e5756bf62de5865dd" - integrity sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww== - dependencies: - "@typescript-eslint/types" "4.15.1" - eslint-visitor-keys "^2.0.0" - "@typescript-eslint/visitor-keys@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.2.tgz#3d1c7979ce75bf6acf9691109bd0d6b5706192b9" @@ -11155,9 +11121,9 @@ webpack-sources@^2.1.1: source-map "^0.6.1" webpack@^5.21.1: - version "5.24.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.24.1.tgz#6b7730bfba1ee94b05d05ef7c32743a35105a744" - integrity sha512-eg+6OIt6npUSwbhRQY6XffAixEUSARBf+WAWOxrZwOB4jRbbpMXlridFy/Yt7N0U20Ry1vp/nnDbtN7l1rUdIA== + version "5.24.2" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.24.2.tgz#33790dad631e8b639f4246d762e257720875fe54" + integrity sha512-uxxKYEY4kMNjP+D2Y+8aw5Vd7ar4pMuKCNemxV26ysr1nk0YDiQTylg9U3VZIdkmI0YHa0uC8ABxL+uGxGWWJg== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46" From b1c035fae6771325781f71533fa90f2c9e4c4863 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 18:57:56 +0300 Subject: [PATCH 043/122] chore(deps): bump colorette from 1.2.1 to 1.2.2 (#2467) Bumps [colorette](https://github.com/jorgebucaran/colorette) from 1.2.1 to 1.2.2. - [Release notes](https://github.com/jorgebucaran/colorette/releases) - [Commits](https://github.com/jorgebucaran/colorette/compare/1.2.1...1.2.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8571a0b521c..9ee6575eb42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3370,9 +3370,9 @@ color-name@~1.1.4: integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== colorette@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" - integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== + version "1.2.2" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" + integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== colors@1.0.3: version "1.0.3" From 3772148fda2b52d6498ad9d4f43e2dae0eb8f3a2 Mon Sep 17 00:00:00 2001 From: Sumukha Hegde Date: Sun, 28 Feb 2021 13:33:46 +0530 Subject: [PATCH 044/122] docs: grammatical error in webpack-cli commands and arguments usage (#2469) --- packages/webpack-cli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webpack-cli/README.md b/packages/webpack-cli/README.md index 86941f9f47a..bbd61977060 100644 --- a/packages/webpack-cli/README.md +++ b/packages/webpack-cli/README.md @@ -42,7 +42,7 @@ If no command is specified then `bundle` command is used by default ### Help Usage -You display basic commands and arguments - +To display basic commands and arguments - ```bash npx webpack-cli --help From a1809892047088b9039b2454934eba034ac9c42e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 15:28:56 +0300 Subject: [PATCH 045/122] chore(deps-dev): bump eslint from 7.20.0 to 7.21.0 (#2471) Bumps [eslint](https://github.com/eslint/eslint) from 7.20.0 to 7.21.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.20.0...v7.21.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9ee6575eb42..e33b1d478a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -542,10 +542,10 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz#8f03a22a04de437254e8ce8cc84ba39689288752" integrity sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg== -"@eslint/eslintrc@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.3.0.tgz#d736d6963d7003b6514e6324bec9c602ac340318" - integrity sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg== +"@eslint/eslintrc@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547" + integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -554,7 +554,6 @@ ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.20" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -4439,12 +4438,12 @@ eslint-visitor-keys@^2.0.0: integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== eslint@^7.12.1: - version "7.20.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.20.0.tgz#db07c4ca4eda2e2316e7aa57ac7fc91ec550bdc7" - integrity sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw== + version "7.21.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.21.0.tgz#4ecd5b8c5b44f5dedc9b8a110b01bbfeb15d1c83" + integrity sha512-W2aJbXpMNofUp0ztQaF40fveSsJBjlSCSWpy//gzfTvwC+USs/nceBrKmlJOiM8r1bLwP2EuYkCqArn/6QTIgg== dependencies: "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.3.0" + "@eslint/eslintrc" "^0.4.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -4457,7 +4456,7 @@ eslint@^7.12.1: espree "^7.3.1" esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^6.0.0" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" globals "^12.1.0" @@ -4834,10 +4833,10 @@ figures@^3.0.0, figures@^3.2.0: dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.0.tgz#7921a89c391c6d93efec2169ac6bf300c527ea0a" - integrity sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" From 375e2f5b209a8992f89877fe35c441e1d0e9407e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 12:50:45 +0300 Subject: [PATCH 046/122] chore(deps-dev): bump @typescript-eslint/eslint-plugin Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.15.2 to 4.16.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.16.1/packages/eslint-plugin) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 58 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index e33b1d478a9..ad66ddaeeca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2041,12 +2041,12 @@ "@types/yeoman-generator" "*" "@typescript-eslint/eslint-plugin@^4.14.1": - version "4.15.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.2.tgz#981b26b4076c62a5a55873fbef3fe98f83360c61" - integrity sha512-uiQQeu9tWl3f1+oK0yoAv9lt/KXO24iafxgQTkIYO/kitruILGx3uH+QtIAHqxFV+yIsdnJH+alel9KuE3J15Q== + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.16.1.tgz#2caf6a79dd19c3853b8d39769a27fccb24e4e651" + integrity sha512-SK777klBdlkUZpZLC1mPvyOWk9yAFCWmug13eAjVQ4/Q1LATE/NbcQL1xDHkptQkZOLnPmLUA1Y54m8dqYwnoQ== dependencies: - "@typescript-eslint/experimental-utils" "4.15.2" - "@typescript-eslint/scope-manager" "4.15.2" + "@typescript-eslint/experimental-utils" "4.16.1" + "@typescript-eslint/scope-manager" "4.16.1" debug "^4.1.1" functional-red-black-tree "^1.0.1" lodash "^4.17.15" @@ -2054,15 +2054,15 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.15.2": - version "4.15.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.2.tgz#5efd12355bd5b535e1831282e6cf465b9a71cf36" - integrity sha512-Fxoshw8+R5X3/Vmqwsjc8nRO/7iTysRtDqx6rlfLZ7HbT8TZhPeQqbPjTyk2RheH3L8afumecTQnUc9EeXxohQ== +"@typescript-eslint/experimental-utils@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.16.1.tgz#da7a396dc7d0e01922acf102b76efff17320b328" + integrity sha512-0Hm3LSlMYFK17jO4iY3un1Ve9x1zLNn4EM50Lia+0EV99NdbK+cn0er7HC7IvBA23mBg3P+8dUkMXy4leL33UQ== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.15.2" - "@typescript-eslint/types" "4.15.2" - "@typescript-eslint/typescript-estree" "4.15.2" + "@typescript-eslint/scope-manager" "4.16.1" + "@typescript-eslint/types" "4.16.1" + "@typescript-eslint/typescript-estree" "4.16.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" @@ -2084,11 +2084,24 @@ "@typescript-eslint/types" "4.15.2" "@typescript-eslint/visitor-keys" "4.15.2" +"@typescript-eslint/scope-manager@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.16.1.tgz#244e2006bc60cfe46987e9987f4ff49c9e3f00d5" + integrity sha512-6IlZv9JaurqV0jkEg923cV49aAn8V6+1H1DRfhRcvZUrptQ+UtSKHb5kwTayzOYTJJ/RsYZdcvhOEKiBLyc0Cw== + dependencies: + "@typescript-eslint/types" "4.16.1" + "@typescript-eslint/visitor-keys" "4.16.1" + "@typescript-eslint/types@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.2.tgz#04acf3a2dc8001a88985291744241e732ef22c60" integrity sha512-r7lW7HFkAarfUylJ2tKndyO9njwSyoy6cpfDKWPX6/ctZA+QyaYscAHXVAfJqtnY6aaTwDYrOhp+ginlbc7HfQ== +"@typescript-eslint/types@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.16.1.tgz#5ba2d3e38b1a67420d2487519e193163054d9c15" + integrity sha512-nnKqBwMgRlhzmJQF8tnFDZWfunXmJyuXj55xc8Kbfup4PbkzdoDXZvzN8//EiKR27J6vUSU8j4t37yUuYPiLqA== + "@typescript-eslint/typescript-estree@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.2.tgz#c2f7a1e94f3428d229d5ecff3ead6581ee9b62fa" @@ -2102,6 +2115,19 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.16.1.tgz#c2fc46b05a48fbf8bbe8b66a63f0a9ba04b356f1" + integrity sha512-m8I/DKHa8YbeHt31T+UGd/l8Kwr0XCTCZL3H4HMvvLCT7HU9V7yYdinTOv1gf/zfqNeDcCgaFH2BMsS8x6NvJg== + dependencies: + "@typescript-eslint/types" "4.16.1" + "@typescript-eslint/visitor-keys" "4.16.1" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + semver "^7.3.2" + tsutils "^3.17.1" + "@typescript-eslint/visitor-keys@4.15.2": version "4.15.2" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.2.tgz#3d1c7979ce75bf6acf9691109bd0d6b5706192b9" @@ -2110,6 +2136,14 @@ "@typescript-eslint/types" "4.15.2" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.16.1.tgz#d7571fb580749fae621520deeb134370bbfc7293" + integrity sha512-s/aIP1XcMkEqCNcPQtl60ogUYjSM8FU2mq1O7y5cFf3Xcob1z1iXWNB6cC43Op+NGRTFgGolri6s8z/efA9i1w== + dependencies: + "@typescript-eslint/types" "4.16.1" + eslint-visitor-keys "^2.0.0" + "@webassemblyjs/ast@1.11.0": version "1.11.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.0.tgz#a5aa679efdc9e51707a4207139da57920555961f" From 609767aff9f9658e998457f09e05f4cc3280d3cc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 12:53:45 +0300 Subject: [PATCH 047/122] chore(deps-dev): bump @typescript-eslint/parser Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.15.2 to 4.16.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.16.1/packages/parser) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index ad66ddaeeca..b99d691b698 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2067,13 +2067,13 @@ eslint-utils "^2.0.0" "@typescript-eslint/parser@^4.14.1": - version "4.15.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.15.2.tgz#c804474321ef76a3955aec03664808f0d6e7872e" - integrity sha512-SHeF8xbsC6z2FKXsaTb1tBCf0QZsjJ94H6Bo51Y1aVEZ4XAefaw5ZAilMoDPlGghe+qtq7XdTiDlGfVTOmvA+Q== + version "4.16.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.16.1.tgz#3bbd3234dd3c5b882b2bcd9899bc30e1e1586d2a" + integrity sha512-/c0LEZcDL5y8RyI1zLcmZMvJrsR6SM1uetskFkoh3dvqDKVXPsXI+wFB/CbVw7WkEyyTKobC1mUNp/5y6gRvXg== dependencies: - "@typescript-eslint/scope-manager" "4.15.2" - "@typescript-eslint/types" "4.15.2" - "@typescript-eslint/typescript-estree" "4.15.2" + "@typescript-eslint/scope-manager" "4.16.1" + "@typescript-eslint/types" "4.16.1" + "@typescript-eslint/typescript-estree" "4.16.1" debug "^4.1.1" "@typescript-eslint/scope-manager@4.15.2": From 4cd3796023c498c6aaa92f26138701ad1c46dac9 Mon Sep 17 00:00:00 2001 From: Sumukha Hegde Date: Tue, 2 Mar 2021 15:46:56 +0530 Subject: [PATCH 048/122] docs: fix a typo at contrbuting readme file (#2470) Removed an extra line space in commit message format --- .github/CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 21debd0edf9..5a8214cbd5c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -196,10 +196,9 @@ We don't use the scope. The template of a commit would look like this: Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type** and a **subject**: -```md +``` : -