Skip to content

Commit

Permalink
Fix named export concurrently
Browse files Browse the repository at this point in the history
Fixes #399
  • Loading branch information
gustavohenke committed Dec 14, 2023
1 parent 0c64306 commit b854b6a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 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
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;
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;
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 b854b6a

Please sign in to comment.