From fc2817af28ac306e74096edb8dc68c2f575df1e4 Mon Sep 17 00:00:00 2001 From: Matt Revell Date: Tue, 16 Jun 2020 08:36:53 +0100 Subject: [PATCH] Add support for pnpm (#225) --- README.md | 4 ++-- src/command-parser/expand-npm-shortcut.js | 2 +- src/command-parser/expand-npm-shortcut.spec.js | 2 +- src/command-parser/expand-npm-wildcard.js | 2 +- src/command-parser/expand-npm-wildcard.spec.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2c9df3b8..fdc9bce8 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,6 @@ concurrently([ So *null* means the process didn't terminate normally. This will make **concurrent** to return non-zero exit code too. -* Does this work with the npm-replacement [yarn](https://github.com/yarnpkg/yarn)? +* Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn) or [pnpm](https://pnpm.js.org/)? - Yes! In all examples above, you may replace "`npm`" with "`yarn`". + Yes! In all examples above, you may replace "`npm`" with "`yarn`" or "`pnpm`". diff --git a/src/command-parser/expand-npm-shortcut.js b/src/command-parser/expand-npm-shortcut.js index c5135fd1..d36f1fd9 100644 --- a/src/command-parser/expand-npm-shortcut.js +++ b/src/command-parser/expand-npm-shortcut.js @@ -1,6 +1,6 @@ module.exports = class ExpandNpmShortcut { parse(commandInfo) { - const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn):(\S+)(.*)/) || []; + const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn|pnpm):(\S+)(.*)/) || []; if (!cmdName) { return commandInfo; } diff --git a/src/command-parser/expand-npm-shortcut.spec.js b/src/command-parser/expand-npm-shortcut.spec.js index 1489368f..a72ed116 100644 --- a/src/command-parser/expand-npm-shortcut.spec.js +++ b/src/command-parser/expand-npm-shortcut.spec.js @@ -9,7 +9,7 @@ it('returns same command if no npm: prefix is present', () => { expect(parser.parse(commandInfo)).toBe(commandInfo); }); -for (const npmCmd of ['npm', 'yarn']) { +for (const npmCmd of ['npm', 'yarn', 'pnpm']) { describe(`with ${npmCmd}: prefix`, () => { it(`expands to "${npmCmd} run