blob: 9a623626519262ef5830832b60cb3e622f5382a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpandNpmShortcut = void 0;
/**
* Expands commands prefixed with `npm:`, `yarn:`, `pnpm:`, or `bun:` into the full version `npm run <command>` and so on.
*/
class ExpandNpmShortcut {
parse(commandInfo) {
const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn|pnpm|bun):(\S+)(.*)/) || [];
if (!cmdName) {
return commandInfo;
}
return {
...commandInfo,
name: commandInfo.name || cmdName,
command: `${npmCmd} run ${cmdName}${args}`,
};
}
}
exports.ExpandNpmShortcut = ExpandNpmShortcut;
|