From 6b15751106beb99234aa4bf39ae05cf40076d42a Mon Sep 17 00:00:00 2001 From: Yash-Singh1 Date: Tue, 24 Nov 2020 14:24:24 -0800 Subject: [PATCH] feat: add npm set-script Introduces the set-script command. It accepts two arguments, the script name and the command ref: https://github.com/npm/rfcs/blob/latest/accepted/0016-set-script-command.md PR-URL: https://github.com/npm/cli/pull/2237 Credit: @Yash-Singh1 Close: #2237 Reviewed-by: @ruyadorno --- docs/content/commands/npm-set-script.md | 34 ++++ lib/set-script.js | 55 +++++++ lib/utils/cmd-list.js | 1 + .../test-lib-utils-cmd-list.js-TAP.test.js | 1 + test/coverage-map.js | 3 +- test/lib/set-script.js | 154 ++++++++++++++++++ 6 files changed, 246 insertions(+), 2 deletions(-) create mode 100644 docs/content/commands/npm-set-script.md create mode 100644 lib/set-script.js create mode 100644 test/lib/set-script.js diff --git a/docs/content/commands/npm-set-script.md b/docs/content/commands/npm-set-script.md new file mode 100644 index 0000000000000..7bc8f75d23653 --- /dev/null +++ b/docs/content/commands/npm-set-script.md @@ -0,0 +1,34 @@ +--- +title: npm-set-script +section: 1 +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. + +```bash +npm set-script [