diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2022-03-24 18:46:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 18:46:54 +0300 |
commit | 723a0918a5a9d9f795584f85d04506fafda9ca42 (patch) | |
tree | 37f0f659d7b81abd9b6cb6d2038ce83571e2c2b4 /tap-snapshots/test/lib | |
parent | 362831c4eba2554b44feec60fdff197d92eac0c1 (diff) |
feat(version): reify on workspace version change (#4588)
Adds a minimalistic reify step that updates the installed tree after a
version change within one of the configured workspaces when using any
of the workspaces config options.
It's also possible to use the `--save` config option in order to
auto update semver ranges of dependencies declarations accross dependent
`package.json` files.
Fixes: https://github.com/npm/cli/issues/3403
Relates to: https://github.com/npm/rfcs/issues/556
Relates to: https://github.com/npm/cli/issues/3757
Relates to: https://github.com/npm/cli/issues/4193
Diffstat (limited to 'tap-snapshots/test/lib')
6 files changed, 120 insertions, 2 deletions
diff --git a/tap-snapshots/test/lib/commands/config.js.test.cjs b/tap-snapshots/test/lib/commands/config.js.test.cjs index 8e9791523..0806c68ca 100644 --- a/tap-snapshots/test/lib/commands/config.js.test.cjs +++ b/tap-snapshots/test/lib/commands/config.js.test.cjs @@ -155,6 +155,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "which": null, "workspace": [], "workspaces": null, + "workspaces-update": true, "yes": null, "metrics-registry": "https://registry.npmjs.org/" } @@ -308,6 +309,7 @@ viewer = "{VIEWER}" which = null workspace = [] workspaces = null +workspaces-update = true yes = null ; "global" config from {GLOBALPREFIX}/npmrc diff --git a/tap-snapshots/test/lib/commands/version.js.test.cjs b/tap-snapshots/test/lib/commands/version.js.test.cjs new file mode 100644 index 000000000..e19f9b8ee --- /dev/null +++ b/tap-snapshots/test/lib/commands/version.js.test.cjs @@ -0,0 +1,94 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/commands/version.js TAP empty versions workspaces with one arg, all workspaces > must match snapshot 1`] = ` +{ + "name": "workspaces-test", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "workspaces-test", + "version": "1.0.0", + "workspaces": [ + "workspace-a", + "workspace-b" + ] + }, + "node_modules/workspace-a": { + "resolved": "workspace-a", + "link": true + }, + "node_modules/workspace-b": { + "resolved": "workspace-b", + "link": true + }, + "workspace-a": { + "version": "2.0.0" + }, + "workspace-b": { + "version": "2.0.0" + } + }, + "dependencies": { + "workspace-a": { + "version": "file:workspace-a" + }, + "workspace-b": { + "version": "file:workspace-b" + } + } +} + +` + +exports[`test/lib/commands/version.js TAP empty versions workspaces with one arg, all workspaces, saves package.json > must match snapshot 1`] = ` +{ + "name": "workspaces-test", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "workspaces-test", + "version": "1.0.0", + "workspaces": [ + "workspace-a", + "workspace-b" + ], + "dependencies": { + "workspace-a": "^2.0.0", + "workspace-b": "^2.0.0" + } + }, + "node_modules/workspace-a": { + "resolved": "workspace-a", + "link": true + }, + "node_modules/workspace-b": { + "resolved": "workspace-b", + "link": true + }, + "workspace-a": { + "version": "2.0.0" + }, + "workspace-b": { + "version": "2.0.0" + } + }, + "dependencies": { + "workspace-a": { + "version": "file:workspace-a" + }, + "workspace-b": { + "version": "file:workspace-b" + } + } +} + +` diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 1ad8aee29..9fe2a5491 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -1092,7 +1092,7 @@ Options: [--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json] [--preid prerelease-id] [--sign-git-tag] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] -[-ws|--workspaces] [--include-workspace-root] +[-ws|--workspaces] [--no-workspaces-update] [--include-workspace-root] alias: verison diff --git a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index 373f094a5..4d3a6f150 100644 --- a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -151,6 +151,7 @@ Array [ "which", "workspace", "workspaces", + "workspaces-update", "yes", ] ` @@ -1915,6 +1916,16 @@ _unless_ one or more workspaces are specified in the \`workspace\` config. This value is not exported to the environment for child processes. ` +exports[`test/lib/utils/config/definitions.js TAP > config description for workspaces-update 1`] = ` +#### \`workspaces-update\` + +* Default: true +* Type: Boolean + +If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the \`node_modules\` folder. +` + exports[`test/lib/utils/config/definitions.js TAP > config description for yes 1`] = ` #### \`yes\` diff --git a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index 3a7d90db0..94ddbe2b1 100644 --- a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -1697,6 +1697,17 @@ This value is not exported to the environment for child processes. <!-- automatically generated, do not edit manually --> <!-- see lib/utils/config/definitions.js --> +#### \`workspaces-update\` + +* Default: true +* Type: Boolean + +If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the \`node_modules\` folder. + +<!-- automatically generated, do not edit manually --> +<!-- see lib/utils/config/definitions.js --> + #### \`yes\` * Default: null diff --git a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index 8f73b93f3..181e47da7 100644 --- a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -1125,7 +1125,7 @@ All commands: [--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json] [--preid prerelease-id] [--sign-git-tag] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] - [-ws|--workspaces] [--include-workspace-root] + [-ws|--workspaces] [--no-workspaces-update] [--include-workspace-root] alias: verison |