Skip to content

Commit

Permalink
feat: remove npm set-script (#5456)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this removes `npm set-script`

Folks should use `npm pkg set` to set the `scripts` field in their
`package.json`

Closes npm/statusboard#449
  • Loading branch information
wraithgar authored Sep 8, 2022
1 parent 2a8c2fc commit 926f0ad
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 351 deletions.
96 changes: 0 additions & 96 deletions lib/commands/set-script.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/utils/cmd-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ const cmdList = [
'run-script',
'search',
'set',
'set-script',
'shrinkwrap',
'star',
'stars',
Expand Down
38 changes: 19 additions & 19 deletions smoke-tests/tap-snapshots/test/index.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ All commands:
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
{CWD}/smoke-tests/test/tap-testdir-index/.npmrc
Expand Down Expand Up @@ -597,21 +597,7 @@ exports[`test/index.js TAP npm pkg > should print package.json contents 1`] = `
`

exports[`test/index.js TAP npm prefix > should have expected prefix output 1`] = `
{CWD}/smoke-tests/test/tap-testdir-index/project
`

exports[`test/index.js TAP npm run-script > should have expected run-script output 1`] = `
> [email protected] hello
> echo Hello
Hello
`

exports[`test/index.js TAP npm set-script > should have expected script added package.json result 1`] = `
exports[`test/index.js TAP npm pkg set scripts > should have expected script added package.json result 1`] = `
{
"name": "project",
"version": "1.0.0",
Expand All @@ -634,7 +620,21 @@ exports[`test/index.js TAP npm set-script > should have expected script added pa
`

exports[`test/index.js TAP npm set-script > should have expected set-script output 1`] = `
exports[`test/index.js TAP npm pkg set scripts > should have expected set-script output 1`] = `
`

exports[`test/index.js TAP npm prefix > should have expected prefix output 1`] = `
{CWD}/smoke-tests/test/tap-testdir-index/project
`

exports[`test/index.js TAP npm run-script > should have expected run-script output 1`] = `
> [email protected] hello
> echo Hello
Hello
`

Expand Down
4 changes: 2 additions & 2 deletions smoke-tests/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ t.test('npm outdated', async t => {
t.matchSnapshot(err.stdout, 'should have expected outdated output')
})

t.test('npm set-script', async t => {
const cmdRes = await exec('set-script', 'hello', 'echo Hello')
t.test('npm pkg set scripts', async t => {
const cmdRes = await exec('pkg', 'set', 'scripts.hello=echo Hello')

t.matchSnapshot(cmdRes, 'should have expected set-script output')
t.matchSnapshot(
Expand Down
1 change: 0 additions & 1 deletion tap-snapshots/test/lib/commands/completion.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ Array [
run-script
search
set
set-script
shrinkwrap
star
stars
Expand Down
13 changes: 0 additions & 13 deletions tap-snapshots/test/lib/load-all-commands.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -790,19 +790,6 @@ npm set <key>=<value> [<key>=<value> ...] (See \`npm config\`)
Run "npm help set" for more info
`

exports[`test/lib/load-all-commands.js TAP load each command set-script > must match snapshot 1`] = `
Set tasks in the scripts section of package.json, deprecated
Usage:
npm set-script [<script>] [<command>]
Options:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
Run "npm help set-script" for more info
`

exports[`test/lib/load-all-commands.js TAP load each command shrinkwrap > must match snapshot 1`] = `
Lock down dependency versions for publication
Expand Down
35 changes: 12 additions & 23 deletions tap-snapshots/test/lib/npm.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ All commands:
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
/some/config/file/.npmrc
Expand Down Expand Up @@ -63,9 +63,9 @@ All commands:
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
/some/config/file/.npmrc
Expand Down Expand Up @@ -99,9 +99,9 @@ All commands:
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
/some/config/file/.npmrc
Expand Down Expand Up @@ -135,9 +135,9 @@ All commands:
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
/some/config/file/.npmrc
Expand Down Expand Up @@ -829,17 +829,6 @@ All commands:
Run "npm help set" for more info
set-script Set tasks in the scripts section of package.json, deprecated
Usage:
npm set-script [<script>] [<command>]
Options:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
Run "npm help set-script" for more info
shrinkwrap Lock down dependency versions for publication
Usage:
Expand Down
8 changes: 0 additions & 8 deletions tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,6 @@ Object {
"searc": "search",
"search": "search",
"set": "set",
"set-": "set-script",
"set-s": "set-script",
"set-sc": "set-script",
"set-scr": "set-script",
"set-scri": "set-script",
"set-scrip": "set-script",
"set-script": "set-script",
"sho": "show",
"show": "show",
"shr": "shrinkwrap",
Expand Down Expand Up @@ -464,7 +457,6 @@ Object {
"run-script",
"search",
"set",
"set-script",
"shrinkwrap",
"star",
"stars",
Expand Down
Loading

0 comments on commit 926f0ad

Please sign in to comment.