This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
making it so that you can pass arguments to run-scripts.
- Loading branch information
Showing
10 changed files
with
96 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ npm-start(1) -- Start a package | |
|
||
## SYNOPSIS | ||
|
||
npm start <name> | ||
npm start [-- <args>] | ||
|
||
## DESCRIPTION | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ npm-stop(1) -- Stop a package | |
|
||
## SYNOPSIS | ||
|
||
npm stop <name> | ||
npm stop [-- <args>] | ||
|
||
## DESCRIPTION | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var common = require('../common-tap') | ||
, test = require('tap').test | ||
, path = require('path') | ||
, spawn = require('child_process').spawn | ||
, rimraf = require('rimraf') | ||
, mkdirp = require('mkdirp') | ||
, pkg = __dirname + '/run-script' | ||
, cache = pkg + '/cache' | ||
, tmp = pkg + '/tmp' | ||
, node = process.execPath | ||
, npm = path.resolve(__dirname, '../../cli.js') | ||
, opts = { cwd: pkg } | ||
|
||
function testOutput (t, command, er, code, stdout, stderr) { | ||
if (er) | ||
throw er | ||
|
||
if (stderr) | ||
throw new Error('npm ' + command + ' stderr: ' + stderr.toString()) | ||
|
||
stdout = stdout.trim().split('\n') | ||
stdout = stdout[stdout.length - 1] | ||
t.equal(stdout, command) | ||
t.end() | ||
} | ||
|
||
function cleanup () { | ||
rimraf.sync(pkg + '/cache') | ||
rimraf.sync(pkg + '/tmp') | ||
} | ||
|
||
test('setup', function (t) { | ||
cleanup() | ||
mkdirp.sync(pkg + '/cache') | ||
mkdirp.sync(pkg + '/tmp') | ||
t.end() | ||
}) | ||
|
||
test('npm run-script', function (t) { | ||
common.npm(['run-script', 'start'], opts, testOutput.bind(null, t, "start")) | ||
}) | ||
|
||
test('npm run-script with args', function (t) { | ||
common.npm(["run-script", "start", "--", "-e 'console.log(\"stop\")'"], opts, testOutput.bind(null, t, "stop")) | ||
}) | ||
|
||
test('cleanup', function (t) { | ||
cleanup() | ||
t.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"name":"runscript" | ||
,"version":"1.2.3" | ||
,"scripts":{ | ||
"start":"node -e 'console.log(\"start\")'" | ||
} | ||
} |