Skip to content

Commit fc2817a

Browse files
authoredJun 16, 2020
Add support for pnpm (#225)
1 parent e837544 commit fc2817a

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,6 @@ concurrently([
283283
So *null* means the process didn't terminate normally. This will make **concurrent**
284284
to return non-zero exit code too.
285285

286-
* Does this work with the npm-replacement [yarn](https://github.com/yarnpkg/yarn)?
286+
* Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn) or [pnpm](https://pnpm.js.org/)?
287287

288-
Yes! In all examples above, you may replace "`npm`" with "`yarn`".
288+
Yes! In all examples above, you may replace "`npm`" with "`yarn`" or "`pnpm`".

‎src/command-parser/expand-npm-shortcut.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = class ExpandNpmShortcut {
22
parse(commandInfo) {
3-
const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn):(\S+)(.*)/) || [];
3+
const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn|pnpm):(\S+)(.*)/) || [];
44
if (!cmdName) {
55
return commandInfo;
66
}

‎src/command-parser/expand-npm-shortcut.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ it('returns same command if no npm: prefix is present', () => {
99
expect(parser.parse(commandInfo)).toBe(commandInfo);
1010
});
1111

12-
for (const npmCmd of ['npm', 'yarn']) {
12+
for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
1313
describe(`with ${npmCmd}: prefix`, () => {
1414
it(`expands to "${npmCmd} run <script> <args>"`, () => {
1515
const commandInfo = {

‎src/command-parser/expand-npm-wildcard.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = class ExpandNpmWildcard {
77
}
88

99
parse(commandInfo) {
10-
const [, npmCmd, cmdName, args] = commandInfo.command.match(/(npm|yarn) run (\S+)([^&]*)/) || [];
10+
const [, npmCmd, cmdName, args] = commandInfo.command.match(/(npm|yarn|pnpm) run (\S+)([^&]*)/) || [];
1111
const wildcardPosition = (cmdName || '').indexOf('*');
1212

1313
// If the regex didn't match an npm script, or it has no wildcard,

‎src/command-parser/expand-npm-wildcard.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ it('expands to nothing if no scripts exist in package.json', () => {
3131
expect(parser.parse({ command: 'npm run foo-*-baz qux' })).toEqual([]);
3232
});
3333

34-
for (const npmCmd of ['npm', 'yarn']) {
34+
for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
3535
describe(`with an ${npmCmd}: prefix`, () => {
3636
it('expands to all scripts matching pattern', () => {
3737
readPkg.mockReturnValue({

0 commit comments

Comments
 (0)
Please sign in to comment.