Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-09-01 20:22:26 +0300
committerGar <gar+gh@danger.computer>2022-09-01 20:44:45 +0300
commitda6f4f1a8a7efacaf22a9ebe8e750a1916e2347f (patch)
tree5145eb5ec3805328999d163c86ed42258feba527
parentdcc376534212e13fcd5813db9eb067be8179d04f (diff)
feat: remove `npm bin`gar/remove-bin
BREAKING CHANGE: this removes the `npm bin` command The output of this command is misleading and incomplete. The `.bin` resolution of npm is much more nuanced than this command implies, and the output of `npm bin` is not somthing end users should be dealing with. `npm` itself is responsible for running the `bin` entries of modules, with the exception of global bins, which end up in the same folder as `node` itself, presumably already in a user's path since they can run node. Closes https://github.com/npm/statusboard/issues/537
-rw-r--r--lib/commands/bin.js23
-rw-r--r--lib/utils/cmd-list.js1
-rw-r--r--smoke-tests/tap-snapshots/test/index.js.test.cjs2
-rw-r--r--tap-snapshots/test/lib/commands/completion.js.test.cjs1
-rw-r--r--tap-snapshots/test/lib/load-all-commands.js.test.cjs12
-rw-r--r--tap-snapshots/test/lib/npm.js.test.cjs18
-rw-r--r--tap-snapshots/test/lib/utils/cmd-list.js.test.cjs4
-rw-r--r--test/lib/commands/bin.js32
8 files changed, 6 insertions, 87 deletions
diff --git a/lib/commands/bin.js b/lib/commands/bin.js
deleted file mode 100644
index 9ba3cb400..000000000
--- a/lib/commands/bin.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const log = require('../utils/log-shim.js')
-const BaseCommand = require('../base-command.js')
-// TODO this may not be needed at all. Ignoring because our tests normalize
-// process.env.path already
-/* istanbul ignore next */
-const path = process.env.path || process.env.Path || process.env.PATH
-const { delimiter } = require('path')
-
-class Bin extends BaseCommand {
- static description = 'Display npm bin folder'
- static name = 'bin'
- static params = ['global']
- static ignoreImplicitWorkspace = true
-
- async exec (args) {
- const b = this.npm.bin
- this.npm.output(b)
- if (this.npm.global && !path.split(delimiter).includes(b)) {
- log.error('bin', '(not in PATH env variable)')
- }
- }
-}
-module.exports = Bin
diff --git a/lib/utils/cmd-list.js b/lib/utils/cmd-list.js
index 38439542a..4dca7df2d 100644
--- a/lib/utils/cmd-list.js
+++ b/lib/utils/cmd-list.js
@@ -74,7 +74,6 @@ const cmdList = [
'access',
'adduser',
'audit',
- 'bin',
'bugs',
'cache',
'ci',
diff --git a/smoke-tests/tap-snapshots/test/index.js.test.cjs b/smoke-tests/tap-snapshots/test/index.js.test.cjs
index 68145ce52..6b0b7b394 100644
--- a/smoke-tests/tap-snapshots/test/index.js.test.cjs
+++ b/smoke-tests/tap-snapshots/test/index.js.test.cjs
@@ -21,7 +21,7 @@ npm help npm more involved overview
All commands:
- access, adduser, audit, bin, bugs, cache, ci, completion,
+ access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
diff --git a/tap-snapshots/test/lib/commands/completion.js.test.cjs b/tap-snapshots/test/lib/commands/completion.js.test.cjs
index f08ef0f37..6bd7901e2 100644
--- a/tap-snapshots/test/lib/commands/completion.js.test.cjs
+++ b/tap-snapshots/test/lib/commands/completion.js.test.cjs
@@ -47,7 +47,6 @@ Array [
access
adduser
audit
- bin
bugs
cache
ci
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 eac037f4b..6ea63931c 100644
--- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs
+++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs
@@ -57,18 +57,6 @@ Options:
Run "npm help audit" for more info
`
-exports[`test/lib/load-all-commands.js TAP load each command bin > must match snapshot 1`] = `
-Display npm bin folder
-
-Usage:
-npm bin
-
-Options:
-[-g|--global]
-
-Run "npm help bin" for more info
-`
-
exports[`test/lib/load-all-commands.js TAP load each command birthday > must match snapshot 1`] = `
Birthday, deprecated
diff --git a/tap-snapshots/test/lib/npm.js.test.cjs b/tap-snapshots/test/lib/npm.js.test.cjs
index 094792afd..fcd167742 100644
--- a/tap-snapshots/test/lib/npm.js.test.cjs
+++ b/tap-snapshots/test/lib/npm.js.test.cjs
@@ -21,7 +21,7 @@ npm help npm more involved overview
All commands:
- access, adduser, audit, bin, bugs, cache, ci, completion,
+ access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
@@ -57,7 +57,7 @@ npm help npm more involved overview
All commands:
- access, adduser, audit, bin, bugs, cache, ci, completion,
+ access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
@@ -93,7 +93,7 @@ npm help npm more involved overview
All commands:
- access, adduser, audit, bin, bugs, cache, ci, completion,
+ access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
@@ -129,7 +129,7 @@ npm help npm more involved overview (in a browser)
All commands:
- access, adduser, audit, bin, bugs, cache, ci, completion,
+ access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
@@ -211,16 +211,6 @@ All commands:
Run "npm help audit" for more info
- bin Display npm bin folder
-
- Usage:
- npm bin
-
- Options:
- [-g|--global]
-
- Run "npm help bin" for more info
-
bugs Report bugs for a package in a web browser
Usage:
diff --git a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
index dd0df9b86..e88cf67fa 100644
--- a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
+++ b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
@@ -30,8 +30,7 @@ Object {
"auth": "author",
"autho": "author",
"author": "author",
- "bi": "bin",
- "bin": "bin",
+ "b": "bugs",
"bu": "bugs",
"bug": "bugs",
"bugs": "bugs",
@@ -418,7 +417,6 @@ Object {
"access",
"adduser",
"audit",
- "bin",
"bugs",
"cache",
"ci",
diff --git a/test/lib/commands/bin.js b/test/lib/commands/bin.js
deleted file mode 100644
index 46170e765..000000000
--- a/test/lib/commands/bin.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const t = require('tap')
-const { load: loadMockNpm } = require('../../fixtures/mock-npm')
-const mockGlobals = require('../../fixtures/mock-globals')
-
-t.test('bin not global', async t => {
- const { npm, joinedOutput, logs } = await loadMockNpm(t)
- await npm.exec('bin', [])
- t.match(joinedOutput(), npm.localBin)
- t.match(logs.error, [])
-})
-
-t.test('bin global in env.path', async t => {
- const { npm, joinedOutput, logs } = await loadMockNpm(t, {
- config: { global: true },
- })
-
- mockGlobals(t, {
- 'process.env': { path: npm.globalBin },
- })
- await npm.exec('bin', [])
- t.match(joinedOutput(), npm.globalBin)
- t.match(logs.error, [])
-})
-
-t.test('bin not in path', async t => {
- const { npm, joinedOutput, logs } = await loadMockNpm(t, {
- config: { global: true },
- })
- await npm.exec('bin', [])
- t.match(joinedOutput(), npm.globalBin)
- t.match(logs.error, [['bin', '(not in PATH env variable)']])
-})