Skip to content

Commit

Permalink
fix: support migrate externally
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Jan 8, 2021
1 parent 0f1fb0d commit 88342e8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@types/node": "^14.14.6",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"@webpack-cli/migrate": "^1.1.2",
"colorette": "^1.2.1",
"commitlint": "^11.0.0",
"commitlint-config-cz": "^0.13.2",
Expand Down
1 change: 0 additions & 1 deletion packages/webpack-cli/lib/webpack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ class WebpackCLI {
} else {
pkg = commandName;
}

if (pkg !== 'webpack-cli' && !getPkg(pkg)) {
if (!allowToInstall) {
return;
Expand Down
2 changes: 1 addition & 1 deletion test/help/help.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('help', () => {
expect(stdout).toContain('Made with ♥ by the webpack team');
});

const commands = ['bundle', 'loader', 'plugin', 'info', 'init', 'serve'];
const commands = ['bundle', 'loader', 'plugin', 'info', 'init', 'serve', 'migrate'];

commands.forEach((command) => {
it(`should show help information for '${command}' command using the "--help" option`, () => {
Expand Down
9 changes: 9 additions & 0 deletions test/version/version.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ describe('single version flag', () => {
expect(stdout).toContain(`webpack-dev-server ${webpackDevServerPkgJSON.version}`);
});

it('outputs version with migrate', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['migrate', '--version'], false);
expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toContain(`webpack-cli ${pkgJSON.version}`);
expect(stdout).toContain(`webpack ${webpack.version}`);
expect(stdout).toContain(`webpack-dev-server ${webpackDevServerPkgJSON.version}`);
});

it('outputs version with the alias c for init', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['i', '--version'], false);

Expand Down
28 changes: 17 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==

"@types/diff@*", "@types/diff@^4.0.2":
"@types/diff@*":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/diff/-/diff-4.0.2.tgz#2e9bb89f9acc3ab0108f0f3dc4dbdcf2fff8a99c"
integrity sha512-mIenTfsIe586/yzsyfql69KRnA75S8SVXQbTLpDejRrjH0QSJcpu3AUOi/Vjnt9IOsXKxPhJfGpQUNMueIU1fQ==
Expand Down Expand Up @@ -1860,7 +1860,7 @@
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz#9140779736aa2655635ee756e2467d787cfe8a2a"
integrity sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==

"@types/inquirer@*", "@types/inquirer@^7.3.1":
"@types/inquirer@*":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-7.3.1.tgz#1f231224e7df11ccfaf4cf9acbcc3b935fea292d"
integrity sha512-osD38QVIfcdgsPCT0V3lD7eH0OFurX71Jft18bZrsVQWVRt6TuxRzlr0GJLrxoHZR2V5ph7/qP8se/dcnI7o0g==
Expand Down Expand Up @@ -1907,14 +1907,6 @@
dependencies:
"@types/node" "*"

"@types/listr@^0.14.2":
version "0.14.2"
resolved "https://registry.yarnpkg.com/@types/listr/-/listr-0.14.2.tgz#2e5f80fbc3ca8dceb9940ce9bf8e3113ab452545"
integrity sha512-wCipMbQr3t2UHTm90LldVp+oTBj1TX6zvpkCJcWS4o8nn6kS8SN93oUvKJAgueIRZ5M36yOlFmScqBxYH8Ajig==
dependencies:
"@types/node" "*"
rxjs "^6.5.1"

"@types/mem-fs-editor@*":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@types/mem-fs-editor/-/mem-fs-editor-7.0.0.tgz#e6576e0f66e20055481b2cdbf193457f1a2c4e65"
Expand Down Expand Up @@ -2239,6 +2231,20 @@
"@webassemblyjs/wast-parser" "1.9.1"
"@xtuc/long" "4.2.2"

"@webpack-cli/migrate@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@webpack-cli/migrate/-/migrate-1.1.2.tgz#7bac28243c63a99f6fc809cff4585a5aa9c9b907"
integrity sha512-wbIaaL88LXAcExzp9iG09Pp3sf+FPPQb/g7qCLJAVYAkN8P5L3Km7dLix9K2VQpDfGvEBE0tbEK//ot86F35ZQ==
dependencies:
"@webpack-cli/utils" "^1.2.1"
colorette "^1.2.1"
diff "^4.0.2"
inquirer "^7.3.3"
jscodeshift "^0.11.0"
listr "^0.14.3"
p-each-series "^2.1.0"
p-lazy "^3.0.0"

"@xtuc/ieee754@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790"
Expand Down Expand Up @@ -9485,7 +9491,7 @@ run-queue@^1.0.0, run-queue@^1.0.3:
dependencies:
aproba "^1.1.1"

rxjs@>=6.4.0, rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.5.1, rxjs@^6.6.0, rxjs@^6.6.3:
rxjs@>=6.4.0, rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.6.0, rxjs@^6.6.3:
version "6.6.3"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552"
integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==
Expand Down

0 comments on commit 88342e8

Please sign in to comment.