Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 926f0ad

Browse files
authoredSep 8, 2022
feat: remove npm set-script (npm#5456)
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
1 parent 2a8c2fc commit 926f0ad

File tree

9 files changed

+33
-351
lines changed

9 files changed

+33
-351
lines changed
 

‎lib/commands/set-script.js

-96
This file was deleted.

‎lib/utils/cmd-list.js

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ const cmdList = [
121121
'run-script',
122122
'search',
123123
'set',
124-
'set-script',
125124
'shrinkwrap',
126125
'star',
127126
'stars',

‎smoke-tests/tap-snapshots/test/index.js.test.cjs

+19-19
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ All commands:
2727
hook, init, install, install-ci-test, install-test, link,
2828
ll, login, logout, ls, org, outdated, owner, pack, ping,
2929
pkg, prefix, profile, prune, publish, query, rebuild, repo,
30-
restart, root, run-script, search, set, set-script,
31-
shrinkwrap, star, stars, start, stop, team, test, token,
32-
uninstall, unpublish, unstar, update, version, view, whoami
30+
restart, root, run-script, search, set, shrinkwrap, star,
31+
stars, start, stop, team, test, token, uninstall, unpublish,
32+
unstar, update, version, view, whoami
3333
3434
Specify configs in the ini-formatted file:
3535
{CWD}/smoke-tests/test/tap-testdir-index/.npmrc
@@ -597,21 +597,7 @@ exports[`test/index.js TAP npm pkg > should print package.json contents 1`] = `
597597
598598
`
599599

600-
exports[`test/index.js TAP npm prefix > should have expected prefix output 1`] = `
601-
{CWD}/smoke-tests/test/tap-testdir-index/project
602-
603-
`
604-
605-
exports[`test/index.js TAP npm run-script > should have expected run-script output 1`] = `
606-
607-
> project@1.0.0 hello
608-
> echo Hello
609-
610-
Hello
611-
612-
`
613-
614-
exports[`test/index.js TAP npm set-script > should have expected script added package.json result 1`] = `
600+
exports[`test/index.js TAP npm pkg set scripts > should have expected script added package.json result 1`] = `
615601
{
616602
"name": "project",
617603
"version": "1.0.0",
@@ -634,7 +620,21 @@ exports[`test/index.js TAP npm set-script > should have expected script added pa
634620
635621
`
636622

637-
exports[`test/index.js TAP npm set-script > should have expected set-script output 1`] = `
623+
exports[`test/index.js TAP npm pkg set scripts > should have expected set-script output 1`] = `
624+
625+
`
626+
627+
exports[`test/index.js TAP npm prefix > should have expected prefix output 1`] = `
628+
{CWD}/smoke-tests/test/tap-testdir-index/project
629+
630+
`
631+
632+
exports[`test/index.js TAP npm run-script > should have expected run-script output 1`] = `
633+
634+
> project@1.0.0 hello
635+
> echo Hello
636+
637+
Hello
638638
639639
`
640640

‎smoke-tests/test/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ t.test('npm outdated', async t => {
224224
t.matchSnapshot(err.stdout, 'should have expected outdated output')
225225
})
226226

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

230230
t.matchSnapshot(cmdRes, 'should have expected set-script output')
231231
t.matchSnapshot(

‎tap-snapshots/test/lib/commands/completion.js.test.cjs

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ Array [
9494
run-script
9595
search
9696
set
97-
set-script
9897
shrinkwrap
9998
star
10099
stars

‎tap-snapshots/test/lib/load-all-commands.js.test.cjs

-13
Original file line numberDiff line numberDiff line change
@@ -790,19 +790,6 @@ npm set <key>=<value> [<key>=<value> ...] (See \`npm config\`)
790790
Run "npm help set" for more info
791791
`
792792

793-
exports[`test/lib/load-all-commands.js TAP load each command set-script > must match snapshot 1`] = `
794-
Set tasks in the scripts section of package.json, deprecated
795-
796-
Usage:
797-
npm set-script [<script>] [<command>]
798-
799-
Options:
800-
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
801-
[-ws|--workspaces] [--include-workspace-root]
802-
803-
Run "npm help set-script" for more info
804-
`
805-
806793
exports[`test/lib/load-all-commands.js TAP load each command shrinkwrap > must match snapshot 1`] = `
807794
Lock down dependency versions for publication
808795

‎tap-snapshots/test/lib/npm.js.test.cjs

+12-23
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ All commands:
2727
hook, init, install, install-ci-test, install-test, link,
2828
ll, login, logout, ls, org, outdated, owner, pack, ping,
2929
pkg, prefix, profile, prune, publish, query, rebuild, repo,
30-
restart, root, run-script, search, set, set-script,
31-
shrinkwrap, star, stars, start, stop, team, test, token,
32-
uninstall, unpublish, unstar, update, version, view, whoami
30+
restart, root, run-script, search, set, shrinkwrap, star,
31+
stars, start, stop, team, test, token, uninstall, unpublish,
32+
unstar, update, version, view, whoami
3333
3434
Specify configs in the ini-formatted file:
3535
/some/config/file/.npmrc
@@ -63,9 +63,9 @@ All commands:
6363
hook, init, install, install-ci-test, install-test, link,
6464
ll, login, logout, ls, org, outdated, owner, pack, ping,
6565
pkg, prefix, profile, prune, publish, query, rebuild, repo,
66-
restart, root, run-script, search, set, set-script,
67-
shrinkwrap, star, stars, start, stop, team, test, token,
68-
uninstall, unpublish, unstar, update, version, view, whoami
66+
restart, root, run-script, search, set, shrinkwrap, star,
67+
stars, start, stop, team, test, token, uninstall, unpublish,
68+
unstar, update, version, view, whoami
6969
7070
Specify configs in the ini-formatted file:
7171
/some/config/file/.npmrc
@@ -99,9 +99,9 @@ All commands:
9999
hook, init, install, install-ci-test, install-test, link,
100100
ll, login, logout, ls, org, outdated, owner, pack, ping,
101101
pkg, prefix, profile, prune, publish, query, rebuild, repo,
102-
restart, root, run-script, search, set, set-script,
103-
shrinkwrap, star, stars, start, stop, team, test, token,
104-
uninstall, unpublish, unstar, update, version, view, whoami
102+
restart, root, run-script, search, set, shrinkwrap, star,
103+
stars, start, stop, team, test, token, uninstall, unpublish,
104+
unstar, update, version, view, whoami
105105
106106
Specify configs in the ini-formatted file:
107107
/some/config/file/.npmrc
@@ -135,9 +135,9 @@ All commands:
135135
hook, init, install, install-ci-test, install-test, link,
136136
ll, login, logout, ls, org, outdated, owner, pack, ping,
137137
pkg, prefix, profile, prune, publish, query, rebuild, repo,
138-
restart, root, run-script, search, set, set-script,
139-
shrinkwrap, star, stars, start, stop, team, test, token,
140-
uninstall, unpublish, unstar, update, version, view, whoami
138+
restart, root, run-script, search, set, shrinkwrap, star,
139+
stars, start, stop, team, test, token, uninstall, unpublish,
140+
unstar, update, version, view, whoami
141141
142142
Specify configs in the ini-formatted file:
143143
/some/config/file/.npmrc
@@ -829,17 +829,6 @@ All commands:
829829
830830
Run "npm help set" for more info
831831
832-
set-script Set tasks in the scripts section of package.json, deprecated
833-
834-
Usage:
835-
npm set-script [<script>] [<command>]
836-
837-
Options:
838-
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
839-
[-ws|--workspaces] [--include-workspace-root]
840-
841-
Run "npm help set-script" for more info
842-
843832
shrinkwrap Lock down dependency versions for publication
844833
845834
Usage:

‎tap-snapshots/test/lib/utils/cmd-list.js.test.cjs

-8
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,6 @@ Object {
260260
"searc": "search",
261261
"search": "search",
262262
"set": "set",
263-
"set-": "set-script",
264-
"set-s": "set-script",
265-
"set-sc": "set-script",
266-
"set-scr": "set-script",
267-
"set-scri": "set-script",
268-
"set-scrip": "set-script",
269-
"set-script": "set-script",
270263
"sho": "show",
271264
"show": "show",
272265
"shr": "shrinkwrap",
@@ -464,7 +457,6 @@ Object {
464457
"run-script",
465458
"search",
466459
"set",
467-
"set-script",
468460
"shrinkwrap",
469461
"star",
470462
"stars",
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.