Skip to content

Commit 91c2448

Browse files
authored
Add support for Bun (#406)
1 parent 388a9df commit 91c2448

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ tired of opening terminals and made **concurrently**.
4545

4646
**concurrently** can be installed in the global scope (if you'd like to have it available and use it on the whole system) or locally for a specific package (for example if you'd like to use it in the `scripts` section of your package):
4747

48-
| | npm | Yarn | pnpm |
49-
| ----------- | ----------------------- | ------------------------------ | -------------------------- |
50-
| **Global** | `npm i -g concurrently` | `yarn global add concurrently` | `pnpm add -g concurrently` |
51-
| **Local**\* | `npm i -D concurrently` | `yarn add -D concurrently` | `pnpm add -D concurrently` |
48+
| | npm | Yarn | pnpm | Bun |
49+
| ----------- | ----------------------- | ------------------------------ | -------------------------- | ------------------------- |
50+
| **Global** | `npm i -g concurrently` | `yarn global add concurrently` | `pnpm add -g concurrently` | `bun add -g concurrently` |
51+
| **Local**\* | `npm i -D concurrently` | `yarn add -D concurrently` | `pnpm add -D concurrently` | `bun add -d concurrently` |
5252

5353
<sub>\* It's recommended to add **concurrently** to `devDependencies` as it's usually used for developing purposes. Please adjust the command if this doesn't apply in your case.</sub>
5454

@@ -427,6 +427,6 @@ It contains the following properties:
427427
So _null_ means the process didn't terminate normally. This will make **concurrently**
428428
to return non-zero exit code too.
429429

430-
- Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn) or [pnpm](https://pnpm.js.org/)?
430+
- Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn), [pnpm](https://pnpm.js.org/), or [Bun](https://bun.sh/)?
431431

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

src/command-parser/expand-npm-shortcut.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ it('returns same command if no npm: prefix is present', () => {
1313
expect(parser.parse(commandInfo)).toBe(commandInfo);
1414
});
1515

16-
for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
16+
for (const npmCmd of ['npm', 'yarn', 'pnpm', 'bun']) {
1717
describe(`with ${npmCmd}: prefix`, () => {
1818
it(`expands to "${npmCmd} run <script> <args>"`, () => {
1919
const commandInfo = createCommandInfo(`${npmCmd}:foo -- bar`, 'echo');

src/command-parser/expand-npm-shortcut.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { CommandInfo } from '../command';
22
import { CommandParser } from './command-parser';
33

44
/**
5-
* Expands commands prefixed with `npm:`, `yarn:` or `pnpm:` into the full version `npm run <command>` and so on.
5+
* Expands commands prefixed with `npm:`, `yarn:`, `pnpm:`, or `bun:` into the full version `npm run <command>` and so on.
66
*/
77
export class ExpandNpmShortcut implements CommandParser {
88
parse(commandInfo: CommandInfo) {
99
const [, npmCmd, cmdName, args] =
10-
commandInfo.command.match(/^(npm|yarn|pnpm):(\S+)(.*)/) || [];
10+
commandInfo.command.match(/^(npm|yarn|pnpm|bun):(\S+)(.*)/) || [];
1111
if (!cmdName) {
1212
return commandInfo;
1313
}

src/command-parser/expand-npm-wildcard.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ it('expands to nothing if no scripts exist in package.json', () => {
6767
expect(parser.parse(createCommandInfo('npm run foo-*-baz qux'))).toEqual([]);
6868
});
6969

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

src/command-parser/expand-npm-wildcard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CommandParser } from './command-parser';
77
const OMISSION = /\(!([^)]+)\)/;
88

99
/**
10-
* Finds wildcards in npm/yarn/pnpm run commands and replaces them with all matching scripts in the
10+
* Finds wildcards in npm/yarn/pnpm/bun run commands and replaces them with all matching scripts in the
1111
* `package.json` file of the current directory.
1212
*/
1313
export class ExpandNpmWildcard implements CommandParser {
@@ -26,7 +26,7 @@ export class ExpandNpmWildcard implements CommandParser {
2626

2727
parse(commandInfo: CommandInfo) {
2828
const [, npmCmd, cmdName, args] =
29-
commandInfo.command.match(/(npm|yarn|pnpm) run (\S+)([^&]*)/) || [];
29+
commandInfo.command.match(/(npm|yarn|pnpm|bun) run (\S+)([^&]*)/) || [];
3030
const wildcardPosition = (cmdName || '').indexOf('*');
3131

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

0 commit comments

Comments
 (0)