Skip to content

Commit

Permalink
Merge babbc73 into 0c64306
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavohenke committed Dec 22, 2023
2 parents 0c64306 + babbc73 commit 5106808
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion bin/concurrently.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

import * as defaults from '../src/defaults';
import concurrently from '../src/index';
import { concurrently } from '../src/index';
import { epilogue } from './epilogue';

// Clean-up arguments (yargs expects only the arguments after the program name)
Expand Down
4 changes: 4 additions & 0 deletions index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { concurrently } from './src/index.js';

export * from './src/index.js';
export default concurrently;
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { concurrently } from './src/index.js';

export * from './src/index.js';
export default concurrently;
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const concurrently = require('./dist/src/index.js');

module.exports = exports = concurrently.default;
module.exports = exports = concurrently.concurrently;
Object.assign(exports, concurrently);
4 changes: 2 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* While in local development, make sure you've run `pnpm run build` first.
*/

import concurrently from './dist/src/index.js';
import { concurrently } from './dist/src/index.js';

// NOTE: the star reexport doesn't work in Node <12.20, <14.13 and <15.
export * from './dist/src/index.js';

export default concurrently.default;
export default concurrently;
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "8.2.2",
"description": "Run commands concurrently",
"main": "index.js",
"types": "dist/src/index.d.ts",
"types": "index.d.ts",
"type": "commonjs",
"bin": {
"concurrently": "./dist/bin/concurrently.js",
Expand All @@ -14,10 +14,14 @@
},
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./index.mjs",
"require": "./index.js",
"default": "./index.js"
"import": {
"types": "./index.d.mts",
"default": "./index.mjs"
},
"require": {
"types": "./index.d.ts",
"default": "./index.js"
}
},
"./package.json": "./package.json"
},
Expand Down
28 changes: 13 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Readable } from 'stream';

import { CloseEvent, Command, CommandIdentifier, TimerEvent } from './command';
import {
concurrently,
concurrently as createConcurrently,
ConcurrentlyCommandInput,
ConcurrentlyOptions as BaseConcurrentlyOptions,
ConcurrentlyResult,
Expand Down Expand Up @@ -91,10 +91,10 @@ export type ConcurrentlyOptions = BaseConcurrentlyOptions & {
additionalArguments?: string[];
};

export default (
export function concurrently(
commands: ConcurrentlyCommandInput[],
options: Partial<ConcurrentlyOptions> = {},
) => {
) {
const logger = new Logger({
hide: options.hide,
prefixFormat: options.prefix,
Expand All @@ -103,7 +103,7 @@ export default (
timestampFormat: options.timestampFormat,
});

return concurrently(commands, {
return createConcurrently(commands, {
maxProcesses: options.maxProcesses,
raw: options.raw,
successCondition: options.successCondition,
Expand Down Expand Up @@ -141,28 +141,26 @@ export default (
prefixColors: options.prefixColors || [],
additionalArguments: options.additionalArguments,
});
};
}

// Export all flow controllers, types, and the main concurrently function,
// so that 3rd-parties can use them however they want

// Main
export { ConcurrentlyCommandInput, ConcurrentlyResult, createConcurrently, Logger };

// Command specific
export { CloseEvent, Command, CommandIdentifier, TimerEvent };

// Flow controllers
export {
CloseEvent,
// Command specific
Command,
CommandIdentifier,
concurrently,
ConcurrentlyCommandInput,
ConcurrentlyResult,
// Flow controllers
FlowController,
InputHandler,
KillOnSignal,
KillOthers,
LogError,
LogExit,
Logger,
LogOutput,
LogTimings,
RestartProcess,
TimerEvent,
};

0 comments on commit 5106808

Please sign in to comment.