From 8898710220a3d84b0a9ea2a6d9cf880e50b94c9e Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 10 May 2022 10:00:36 -0700 Subject: [PATCH] feat: deprecated set-script, birthday, --global, and --local --- docs/content/commands/npm-bin.md | 2 + docs/content/commands/npm-config.md | 11 +++++ docs/content/commands/npm-diff.md | 2 + docs/content/commands/npm-install-test.md | 2 + docs/content/commands/npm-install.md | 2 + docs/content/commands/npm-link.md | 2 + docs/content/commands/npm-ls.md | 2 + docs/content/commands/npm-outdated.md | 2 + docs/content/commands/npm-prefix.md | 2 + docs/content/commands/npm-rebuild.md | 2 + docs/content/commands/npm-root.md | 2 + docs/content/commands/npm-set-script.md | 2 + docs/content/commands/npm-update.md | 2 + docs/content/using-npm/config.md | 45 ++++++++++++------- lib/commands/birthday.js | 4 +- lib/commands/set-script.js | 4 +- lib/utils/config/definitions.js | 15 +++++++ .../test/lib/load-all-commands.js.test.cjs | 4 +- .../lib/utils/config/definitions.js.test.cjs | 11 +++++ .../lib/utils/config/describe-all.js.test.cjs | 45 ++++++++++++------- .../test/lib/utils/npm-usage.js.test.cjs | 2 +- test/lib/commands/set-script.js | 2 +- 22 files changed, 127 insertions(+), 40 deletions(-) diff --git a/docs/content/commands/npm-bin.md b/docs/content/commands/npm-bin.md index 94b72cfd5c81c..b344ea2fc9415 100644 --- a/docs/content/commands/npm-bin.md +++ b/docs/content/commands/npm-bin.md @@ -34,6 +34,8 @@ Print the folder where npm will install executables. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-config.md b/docs/content/commands/npm-config.md index a66a198ce42d1..809e42a1be1cd 100644 --- a/docs/content/commands/npm-config.md +++ b/docs/content/commands/npm-config.md @@ -124,6 +124,8 @@ Not supported by all npm commands. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See @@ -156,6 +158,15 @@ The command to run for `npm edit` and `npm config edit`. When passed to `npm config` this refers to which config file to use. +When set to "global" mode, packages are installed into the `prefix` folder +instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + diff --git a/docs/content/commands/npm-diff.md b/docs/content/commands/npm-diff.md index 7dcc8af7c3b4c..7183e4a2b752e 100644 --- a/docs/content/commands/npm-diff.md +++ b/docs/content/commands/npm-diff.md @@ -248,6 +248,8 @@ Treat all files as text in `npm diff`. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-install-test.md b/docs/content/commands/npm-install-test.md index 3dd860ea5c6f6..18e374869d5a6 100644 --- a/docs/content/commands/npm-install-test.md +++ b/docs/content/commands/npm-install-test.md @@ -70,6 +70,8 @@ rather than using npm's default semver range operator. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-install.md b/docs/content/commands/npm-install.md index 445772f0353a1..f99fcc0161dea 100644 --- a/docs/content/commands/npm-install.md +++ b/docs/content/commands/npm-install.md @@ -460,6 +460,8 @@ rather than using npm's default semver range operator. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-link.md b/docs/content/commands/npm-link.md index 975c807c38b34..34c67aa3def81 100644 --- a/docs/content/commands/npm-link.md +++ b/docs/content/commands/npm-link.md @@ -153,6 +153,8 @@ rather than using npm's default semver range operator. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-ls.md b/docs/content/commands/npm-ls.md index ded8c0c0d26ef..5ad4593bfa2f6 100644 --- a/docs/content/commands/npm-ls.md +++ b/docs/content/commands/npm-ls.md @@ -137,6 +137,8 @@ Output parseable results from commands that write to standard output. For * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-outdated.md b/docs/content/commands/npm-outdated.md index 6fa026550e747..1bf2de039c315 100644 --- a/docs/content/commands/npm-outdated.md +++ b/docs/content/commands/npm-outdated.md @@ -150,6 +150,8 @@ Output parseable results from commands that write to standard output. For * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-prefix.md b/docs/content/commands/npm-prefix.md index 39328bcc88a14..6f08e43fa8c0c 100644 --- a/docs/content/commands/npm-prefix.md +++ b/docs/content/commands/npm-prefix.md @@ -51,6 +51,8 @@ npm prefix -g * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-rebuild.md b/docs/content/commands/npm-rebuild.md index 52c368c8c513b..fa5b0cfa97d7c 100644 --- a/docs/content/commands/npm-rebuild.md +++ b/docs/content/commands/npm-rebuild.md @@ -42,6 +42,8 @@ will be rebuilt. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-root.md b/docs/content/commands/npm-root.md index 40b58e4b33d0b..80545235fc969 100644 --- a/docs/content/commands/npm-root.md +++ b/docs/content/commands/npm-root.md @@ -41,6 +41,8 @@ echo "Global packages installed in: ${global_node_modules}" * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/commands/npm-set-script.md b/docs/content/commands/npm-set-script.md index 0fc267f760c81..8695b43f14423 100644 --- a/docs/content/commands/npm-set-script.md +++ b/docs/content/commands/npm-set-script.md @@ -7,6 +7,8 @@ description: Set tasks in the scripts section of package.json ### Synopsis An npm command that lets you create a task in the `scripts` section of the `package.json`. +Deprecated. + diff --git a/docs/content/commands/npm-update.md b/docs/content/commands/npm-update.md index 421d04ca3dc58..55aad182fcafe 100644 --- a/docs/content/commands/npm-update.md +++ b/docs/content/commands/npm-update.md @@ -188,6 +188,8 @@ Will also prevent writing to `package-lock.json` if set to `false`. * Default: false * Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index a33e791bb836b..12b508582af1c 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -687,23 +687,6 @@ results in no commit being made at all. -#### `global` - -* Default: false -* Type: Boolean - -Operates in "global" mode, so that packages are installed into the `prefix` -folder instead of the current working directory. See -[folders](/configuring-npm/folders) for more on the differences in behavior. - -* packages are installed into the `{prefix}/lib/node_modules` folder, instead - of the current working directory. -* bin files are linked to `{prefix}/bin` -* man pages are linked to `{prefix}/share/man` - - - - #### `global-style` * Default: false @@ -1001,6 +984,15 @@ npm registry. Must be IPv4 in versions of Node prior to 0.12. When passed to `npm config` this refers to which config file to use. +When set to "global" mode, packages are installed into the `prefix` folder +instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + @@ -1941,6 +1933,25 @@ Alias for `--include=dev`. +#### `global` + +* Default: false +* Type: Boolean +* DEPRECATED: `--global`, `--local` are deprecated. Use `--location=global` + instead. + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + + #### `init.author.email` * Default: "" diff --git a/lib/commands/birthday.js b/lib/commands/birthday.js index c7b5b31c54a62..cdd6db6286905 100644 --- a/lib/commands/birthday.js +++ b/lib/commands/birthday.js @@ -1,13 +1,15 @@ const BaseCommand = require('../base-command.js') +const log = require('../utils/log-shim') class Birthday extends BaseCommand { static name = 'birthday' - static description = 'Birthday' + static description = 'Birthday, deprecated' static ignoreImplicitWorkspace = true static isShellout = true async exec () { this.npm.config.set('yes', true) + log.warn('birthday', 'birthday is deprecated and will be removed in a future release') return this.npm.exec('exec', ['@npmcli/npm-birthday']) } } diff --git a/lib/commands/set-script.js b/lib/commands/set-script.js index a6b7c3a50cdaf..a085f72a31428 100644 --- a/lib/commands/set-script.js +++ b/lib/commands/set-script.js @@ -5,7 +5,7 @@ const log = require('../utils/log-shim') const BaseCommand = require('../base-command.js') class SetScript extends BaseCommand { - static description = 'Set tasks in the scripts section of package.json' + static description = 'Set tasks in the scripts section of package.json, deprecated' static params = ['workspace', 'workspaces', 'include-workspace-root'] static name = 'set-script' static usage = ['[