npm-run-all2
Advanced tools
Comparing version 6.1.2 to 6.2.0
@@ -10,6 +10,14 @@ # Changelog | ||
## [v6.1.2](https://github.com/bcomnes/npm-run-all2/compare/v6.1.1...v6.1.2) | ||
## [v6.2.0](https://github.com/bcomnes/npm-run-all2/compare/v6.1.2...v6.2.0) | ||
### Merged | ||
- Placeholder that unfolds into multiple tasks [`#134`](https://github.com/bcomnes/npm-run-all2/pull/134) | ||
- 📝 add compatibility note for pnpm. [`#136`](https://github.com/bcomnes/npm-run-all2/pull/136) | ||
- Upgrade: Bump codecov/codecov-action from 3 to 4 [`#131`](https://github.com/bcomnes/npm-run-all2/pull/131) | ||
## [v6.1.2](https://github.com/bcomnes/npm-run-all2/compare/v6.1.1...v6.1.2) - 2024-01-31 | ||
### Merged | ||
- feat: move to read-package-json-fast [`#130`](https://github.com/bcomnes/npm-run-all2/pull/130) | ||
@@ -16,0 +24,0 @@ - Upgrade: Bump c8 from 8.0.1 to 9.0.0 [`#127`](https://github.com/bcomnes/npm-run-all2/pull/127) |
@@ -180,3 +180,9 @@ | [index](../README.md) | npm-run-all | [run-s](run-s.md) | [run-p](run-p.md) | [Node API](node-api.md) | | ||
- `{*}` -- All arguments as combined. | ||
- `{%}` -- Repeats the command for every argument. (There's no equivalent shell parameter and does not support suffixes) | ||
Support for following suffixes: | ||
- `{1-=foo}` -- defaults to `'foo'` here when the 1st argument is missing | ||
- `{1:=foo}` -- defaults to `'foo'` here and in all following `{1}` when the 1st argument is missing | ||
Those are similar to [Shell Parameters](http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters). But please note arguments are enclosed by double quotes automatically (similar to npm). | ||
@@ -183,0 +189,0 @@ |
@@ -144,3 +144,9 @@ | [index](../README.md) | [npm-run-all](npm-run-all.md) | [run-s](run-s.md) | run-p | [Node API](node-api.md) | | ||
- `{*}` -- All arguments as combined. | ||
- `{%}` -- Repeats the command for every argument. (There's no equivalent shell parameter and does not support suffixes) | ||
Support for following suffixes: | ||
- `{1-=foo}` -- defaults to `'foo'` here when the 1st argument is missing | ||
- `{1:=foo}` -- defaults to `'foo'` here and in all following `{1}` when the 1st argument is missing | ||
Those are similar to [Shell Parameters](http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters). But please note arguments are enclosed by double quotes automatically (similar to npm). | ||
@@ -147,0 +153,0 @@ |
@@ -135,3 +135,9 @@ | [index](../README.md) | [npm-run-all](npm-run-all.md) | run-s | [run-p](run-p.md) | [Node API](node-api.md) | | ||
- `{*}` -- All arguments as combined. | ||
- `{%}` -- Repeats the command for every argument. (There's no equivalent shell parameter and does not support suffixes) | ||
Support for following suffixes: | ||
- `{1-=foo}` -- defaults to `'foo'` here when the 1st argument is missing | ||
- `{1:=foo}` -- defaults to `'foo'` here and in all following `{1}` when the 1st argument is missing | ||
Those are similar to [Shell Parameters](http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters). But please note arguments are enclosed by double quotes automatically (similar to npm). | ||
@@ -138,0 +144,0 @@ |
@@ -22,3 +22,4 @@ /** | ||
const ARGS_PATTERN = /\{(!)?([*@]|\d+)([^}]+)?}/g | ||
const ARGS_PATTERN = /\{(!)?([*@%]|\d+)([^}]+)?}/g | ||
const ARGS_UNPACK_PATTERN = /\{(!)?([%])([^}]+)?}/g | ||
@@ -48,3 +49,22 @@ /** | ||
return patterns.map(pattern => pattern.replace(ARGS_PATTERN, (whole, indirectionMark, id, options) => { | ||
const unfoldedPatterns = patterns | ||
.flatMap(pattern => { | ||
const match = ARGS_UNPACK_PATTERN.exec(pattern) | ||
if (match && match[2] === '%') { | ||
const result = [] | ||
for (let i = 0, length = args.length; i < length; i++) { | ||
const argPosition = i + 1 | ||
result.push(pattern.replace(ARGS_UNPACK_PATTERN, (whole, indirectionMark, id, options) => { | ||
if (indirectionMark != null || options != null || id !== '%') { | ||
throw Error(`Invalid Placeholder: ${whole}`) | ||
} | ||
return `{${argPosition}}` | ||
})) | ||
} | ||
return result | ||
} | ||
return pattern | ||
}) | ||
return unfoldedPatterns.map(pattern => pattern.replace(ARGS_PATTERN, (whole, indirectionMark, id, options) => { | ||
if (indirectionMark != null) { | ||
@@ -51,0 +71,0 @@ throw Error(`Invalid Placeholder: ${whole}`) |
{ | ||
"name": "npm-run-all2", | ||
"version": "6.1.2", | ||
"version": "6.2.0", | ||
"description": "A CLI tool to run multiple npm-scripts in parallel or sequential. (Maintainence fork)", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -51,5 +51,5 @@ | index | [npm-run-all] | [run-s] | [run-p] | [Node API] | | ||
#### Yarn Compatibility | ||
#### Yarn / pnpm Compatibility | ||
If a script is invoked with Yarn, `npm-run-all` will correctly use Yarn to execute the plan's child scripts. | ||
`npm-run-all` is compatible with both Yarn and pnpm. If a script is invoked using either package manager, `npm-run-all` will correctly utilize it to execute the plan's child scripts. | ||
@@ -56,0 +56,0 @@ ### Node API |
@@ -14,2 +14,4 @@ /* eslint-env mocha */ | ||
const assert = require('assert').strict | ||
const { strictEqual } = assert | ||
const nodeApi = require('../lib') | ||
@@ -36,27 +38,27 @@ const util = require('./lib/util') | ||
nodeApi('test-task:dump {1}') | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {1}']) | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
it("npm-run-all command (only '--' exists)", () => | ||
runAll(['test-task:dump {1}', '--']) | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {1}']) | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
it("run-s command (only '--' exists)", () => | ||
runSeq(['test-task:dump {1}', '--']) | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {1}']) | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
it("run-p command (only '--' exists)", () => | ||
runPar(['test-task:dump {1}', '--']) | ||
.then(() => assert(result() === '[]'))) | ||
.then(() => strictEqual(result(), '[]'))) | ||
}) | ||
@@ -67,15 +69,15 @@ | ||
nodeApi('test-task:dump {1}', { arguments: ['1st', '2nd'] }) | ||
.then(() => assert(result() === '["1st"]'))) | ||
.then(() => strictEqual(result(), '["1st"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {1}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st"]'))) | ||
.then(() => strictEqual(result(), '["1st"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {1}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st"]'))) | ||
.then(() => strictEqual(result(), '["1st"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {1}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st"]'))) | ||
.then(() => strictEqual(result(), '["1st"]'))) | ||
}) | ||
@@ -86,15 +88,15 @@ | ||
nodeApi('test-task:dump {2}', { arguments: ['1st', '2nd'] }) | ||
.then(() => assert(result() === '["2nd"]'))) | ||
.then(() => strictEqual(result(), '["2nd"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {2}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["2nd"]'))) | ||
.then(() => strictEqual(result(), '["2nd"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {2}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["2nd"]'))) | ||
.then(() => strictEqual(result(), '["2nd"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {2}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["2nd"]'))) | ||
.then(() => strictEqual(result(), '["2nd"]'))) | ||
}) | ||
@@ -105,15 +107,15 @@ | ||
nodeApi('test-task:dump {@}', { arguments: ['1st', '2nd'] }) | ||
.then(() => assert(result() === '["1st","2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {@}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st","2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {@}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st","2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {@}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st","2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd"]'))) | ||
}) | ||
@@ -124,33 +126,54 @@ | ||
nodeApi('test-task:dump {*}', { arguments: ['1st', '2nd'] }) | ||
.then(() => assert(result() === '["1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st 2nd"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {*}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st 2nd"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {*}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st 2nd"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {*}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st 2nd"]'))) | ||
}) | ||
describe("'{%}' should be unfolded into one command for each argument following '--':", () => { | ||
it('Node API', () => | ||
nodeApi('test-task:dump {%}', { arguments: ['1st', '2nd'] }) | ||
.then(() => strictEqual(result(), '["1st"]["2nd"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {%}', '--', '1st', '2nd']) | ||
.then(() => strictEqual(result(), '["1st"]["2nd"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {%}', '--', '1st', '2nd']) | ||
.then(() => strictEqual(result(), '["1st"]["2nd"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {%}', '--', '1st', '2nd']) | ||
.then(() => { | ||
const value = result() | ||
assert(value === '["1st"]["2nd"]' || value === '["2nd"]["1st"]') | ||
})) | ||
}) | ||
describe("Every '{1}', '{2}', '{@}' and '{*}' should be replaced by the arguments preceded by '--':", () => { | ||
it('Node API', () => | ||
nodeApi('test-task:dump {1} {2} {3} {@} {*}', { arguments: ['1st', '2nd'] }) | ||
.then(() => assert(result() === '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {1} {2} {3} {@} {*}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {1} {2} {3} {@} {*}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {1} {2} {3} {@} {*}', '--', '1st', '2nd']) | ||
.then(() => assert(result() === '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
.then(() => strictEqual(result(), '["1st","2nd","1st","2nd","1st 2nd"]'))) | ||
}) | ||
@@ -161,15 +184,15 @@ | ||
nodeApi('test-task:dump {1:-foo} {1}') | ||
.then(() => assert(result() === '["foo"]'))) | ||
.then(() => strictEqual(result(), '["foo"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {1:-foo} {1}']) | ||
.then(() => assert(result() === '["foo"]'))) | ||
.then(() => strictEqual(result(), '["foo"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {1:-foo} {1}']) | ||
.then(() => assert(result() === '["foo"]'))) | ||
.then(() => strictEqual(result(), '["foo"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {1:-foo} {1}']) | ||
.then(() => assert(result() === '["foo"]'))) | ||
.then(() => strictEqual(result(), '["foo"]'))) | ||
}) | ||
@@ -180,16 +203,16 @@ | ||
nodeApi('test-task:dump {1:=foo} {1}') | ||
.then(() => assert(result() === '["foo","foo"]'))) | ||
.then(() => strictEqual(result(), '["foo","foo"]'))) | ||
it('npm-run-all command', () => | ||
runAll(['test-task:dump {1:=foo} {1}']) | ||
.then(() => assert(result() === '["foo","foo"]'))) | ||
.then(() => strictEqual(result(), '["foo","foo"]'))) | ||
it('run-s command', () => | ||
runSeq(['test-task:dump {1:=foo} {1}']) | ||
.then(() => assert(result() === '["foo","foo"]'))) | ||
.then(() => strictEqual(result(), '["foo","foo"]'))) | ||
it('run-p command', () => | ||
runPar(['test-task:dump {1:=foo} {1}']) | ||
.then(() => assert(result() === '["foo","foo"]'))) | ||
.then(() => strictEqual(result(), '["foo","foo"]'))) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
225801
4139