neex 0.7.45 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -326
- package/bin/neex +31 -0
- package/install.js +94 -0
- package/package.json +30 -63
- package/dist/bin/neex.d.ts +0 -26
- package/dist/bin/neex.d.ts.map +0 -1
- package/dist/bin/neex.js +0 -8
- package/dist/src/build-manager.d.ts +0 -41
- package/dist/src/build-manager.d.ts.map +0 -1
- package/dist/src/build-manager.js +0 -369
- package/dist/src/cli.d.ts +0 -2
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -67
- package/dist/src/commands/add-commands.d.ts +0 -4
- package/dist/src/commands/add-commands.d.ts.map +0 -1
- package/dist/src/commands/add-commands.js +0 -83
- package/dist/src/commands/build-commands.d.ts +0 -5
- package/dist/src/commands/build-commands.d.ts.map +0 -1
- package/dist/src/commands/build-commands.js +0 -123
- package/dist/src/commands/dev-commands.d.ts +0 -5
- package/dist/src/commands/dev-commands.d.ts.map +0 -1
- package/dist/src/commands/dev-commands.js +0 -198
- package/dist/src/commands/index.d.ts +0 -8
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/commands/index.js +0 -27
- package/dist/src/commands/init-commands.d.ts +0 -2
- package/dist/src/commands/init-commands.d.ts.map +0 -1
- package/dist/src/commands/init-commands.js +0 -20
- package/dist/src/commands/run-commands.d.ts +0 -3
- package/dist/src/commands/run-commands.d.ts.map +0 -1
- package/dist/src/commands/run-commands.js +0 -93
- package/dist/src/commands/server-commands.d.ts +0 -3
- package/dist/src/commands/server-commands.d.ts.map +0 -1
- package/dist/src/commands/server-commands.js +0 -51
- package/dist/src/commands/start-commands.d.ts +0 -5
- package/dist/src/commands/start-commands.d.ts.map +0 -1
- package/dist/src/commands/start-commands.js +0 -162
- package/dist/src/dev-manager.d.ts +0 -51
- package/dist/src/dev-manager.d.ts.map +0 -1
- package/dist/src/dev-manager.js +0 -471
- package/dist/src/index.d.ts +0 -41
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -70
- package/dist/src/logger-manager.d.ts +0 -4
- package/dist/src/logger-manager.d.ts.map +0 -1
- package/dist/src/logger-manager.js +0 -17
- package/dist/src/logger.d.ts +0 -34
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/logger.js +0 -279
- package/dist/src/runner.d.ts +0 -21
- package/dist/src/runner.d.ts.map +0 -1
- package/dist/src/runner.js +0 -414
- package/dist/src/start-manager.d.ts +0 -49
- package/dist/src/start-manager.d.ts.map +0 -1
- package/dist/src/start-manager.js +0 -484
- package/dist/src/types.d.ts +0 -41
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/utils.d.ts +0 -2
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -9
package/dist/src/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { RunOptions, RunResult } from './types';
|
|
2
|
-
export { RunOptions, RunResult };
|
|
3
|
-
export interface neexOptions {
|
|
4
|
-
parallel?: boolean;
|
|
5
|
-
maxParallel?: number;
|
|
6
|
-
printOutput?: boolean;
|
|
7
|
-
color?: boolean;
|
|
8
|
-
showTiming?: boolean;
|
|
9
|
-
prefix?: boolean;
|
|
10
|
-
stopOnError?: boolean;
|
|
11
|
-
minimalOutput?: boolean;
|
|
12
|
-
groupOutput?: boolean;
|
|
13
|
-
isServerMode?: boolean;
|
|
14
|
-
retry?: number;
|
|
15
|
-
retryDelay?: number;
|
|
16
|
-
registerCleanup?: (cleanupFn: () => void) => void;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Run one or more commands in parallel or sequentially
|
|
20
|
-
*/
|
|
21
|
-
export declare function run(commands: string | string[], options?: neexOptions): Promise<RunResult[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Run multiple commands in parallel
|
|
24
|
-
*/
|
|
25
|
-
export declare function runParallel(commands: string | string[], options?: Omit<neexOptions, 'parallel'>): Promise<RunResult[]>;
|
|
26
|
-
/**
|
|
27
|
-
* Run multiple commands sequentially
|
|
28
|
-
*/
|
|
29
|
-
export declare function runSequential(commands: string | string[], options?: Omit<neexOptions, 'parallel'>): Promise<RunResult[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Run multiple servers with optimized output
|
|
32
|
-
*/
|
|
33
|
-
export declare function runServers(commands: string | string[], options?: Omit<neexOptions, 'parallel' | 'isServerMode'>): Promise<RunResult[]>;
|
|
34
|
-
declare const _default: {
|
|
35
|
-
run: typeof run;
|
|
36
|
-
runParallel: typeof runParallel;
|
|
37
|
-
runSequential: typeof runSequential;
|
|
38
|
-
runServers: typeof runServers;
|
|
39
|
-
};
|
|
40
|
-
export default _default;
|
|
41
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAEjC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;GAEG;AACH,wBAAsB,GAAG,CACvB,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CA+BtB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GACtC,OAAO,CAAC,SAAS,EAAE,CAAC,CAEtB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GACtC,OAAO,CAAC,SAAS,EAAE,CAAC,CAEtB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,cAAc,CAAC,GACvD,OAAO,CAAC,SAAS,EAAE,CAAC,CAOtB;;;;;;;AAED,wBAKE"}
|
package/dist/src/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.run = run;
|
|
7
|
-
exports.runParallel = runParallel;
|
|
8
|
-
exports.runSequential = runSequential;
|
|
9
|
-
exports.runServers = runServers;
|
|
10
|
-
// src/index.ts - Updated version
|
|
11
|
-
const runner_1 = require("./runner");
|
|
12
|
-
const logger_1 = __importDefault(require("./logger"));
|
|
13
|
-
/**
|
|
14
|
-
* Run one or more commands in parallel or sequentially
|
|
15
|
-
*/
|
|
16
|
-
async function run(commands, options) {
|
|
17
|
-
const cmdArray = Array.isArray(commands) ? commands : [commands];
|
|
18
|
-
const runOptions = {
|
|
19
|
-
parallel: options?.parallel ?? false,
|
|
20
|
-
maxParallel: options?.maxParallel,
|
|
21
|
-
printOutput: options?.printOutput ?? true,
|
|
22
|
-
color: options?.color ?? true,
|
|
23
|
-
showTiming: options?.showTiming ?? true,
|
|
24
|
-
prefix: options?.prefix ?? true,
|
|
25
|
-
stopOnError: options?.stopOnError ?? false,
|
|
26
|
-
minimalOutput: options?.minimalOutput ?? false,
|
|
27
|
-
groupOutput: options?.groupOutput ?? false,
|
|
28
|
-
isServerMode: options?.isServerMode ?? false,
|
|
29
|
-
retry: options?.retry,
|
|
30
|
-
retryDelay: options?.retryDelay,
|
|
31
|
-
};
|
|
32
|
-
const runner = new runner_1.Runner(runOptions);
|
|
33
|
-
if (options?.registerCleanup) {
|
|
34
|
-
options.registerCleanup(() => runner.cleanup());
|
|
35
|
-
}
|
|
36
|
-
const results = await runner.run(cmdArray);
|
|
37
|
-
if (runOptions.printOutput && cmdArray.length > 1) {
|
|
38
|
-
logger_1.default.printSummary(results);
|
|
39
|
-
}
|
|
40
|
-
return results;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Run multiple commands in parallel
|
|
44
|
-
*/
|
|
45
|
-
async function runParallel(commands, options) {
|
|
46
|
-
return run(commands, { ...options, parallel: true });
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Run multiple commands sequentially
|
|
50
|
-
*/
|
|
51
|
-
async function runSequential(commands, options) {
|
|
52
|
-
return run(commands, { ...options, parallel: false });
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Run multiple servers with optimized output
|
|
56
|
-
*/
|
|
57
|
-
async function runServers(commands, options) {
|
|
58
|
-
return run(commands, {
|
|
59
|
-
...options,
|
|
60
|
-
parallel: true,
|
|
61
|
-
isServerMode: true,
|
|
62
|
-
printOutput: true,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
exports.default = {
|
|
66
|
-
run,
|
|
67
|
-
runParallel,
|
|
68
|
-
runSequential,
|
|
69
|
-
runServers,
|
|
70
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger-manager.d.ts","sourceRoot":"","sources":["../../src/logger-manager.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;yBACH,MAAM,UAAS,MAAM,GAAG,MAAM,GAAG,OAAO;CAS9D,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.loggerManager = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
exports.loggerManager = {
|
|
9
|
-
printLine: (message, level = 'info') => {
|
|
10
|
-
const prefix = {
|
|
11
|
-
info: chalk_1.default.blue('i'),
|
|
12
|
-
warn: chalk_1.default.yellow('!'),
|
|
13
|
-
error: chalk_1.default.red('x'),
|
|
14
|
-
}[level];
|
|
15
|
-
console.log(`${prefix} ${message}`);
|
|
16
|
-
},
|
|
17
|
-
};
|
package/dist/src/logger.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { CommandOutput, RunResult } from './types';
|
|
2
|
-
declare class Logger {
|
|
3
|
-
private static instance;
|
|
4
|
-
private prefixLength;
|
|
5
|
-
private outputBuffer;
|
|
6
|
-
private commandColors;
|
|
7
|
-
private startTimes;
|
|
8
|
-
private spinnerFrames;
|
|
9
|
-
private spinnerIndex;
|
|
10
|
-
private spinnerIntervals;
|
|
11
|
-
private isSpinnerActive;
|
|
12
|
-
private constructor();
|
|
13
|
-
static getInstance(): Logger;
|
|
14
|
-
private getSpinnerFrame;
|
|
15
|
-
private showBanner;
|
|
16
|
-
setCommands(commands: string[]): void;
|
|
17
|
-
private generateColor;
|
|
18
|
-
formatPrefix(command: string): string;
|
|
19
|
-
bufferOutput(output: CommandOutput): void;
|
|
20
|
-
printBuffer(command: string): void;
|
|
21
|
-
clearBuffer(command: string): void;
|
|
22
|
-
printLine(message: string, level?: 'info' | 'error' | 'warn'): void;
|
|
23
|
-
printStart(command: string): void;
|
|
24
|
-
startSpinner(command: string): void;
|
|
25
|
-
stopSpinner(command: string): void;
|
|
26
|
-
stopAllSpinners(): void;
|
|
27
|
-
printSuccess(result: RunResult): void;
|
|
28
|
-
printError(result: RunResult): void;
|
|
29
|
-
printEnd(result: RunResult, minimalOutput: boolean): void;
|
|
30
|
-
printSummary(results: RunResult[]): void;
|
|
31
|
-
}
|
|
32
|
-
declare const _default: Logger;
|
|
33
|
-
export default _default;
|
|
34
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/src/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGnD,cAAM,MAAM;IACV,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAA2C;IAC/D,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,aAAa,CAAsD;IAC3E,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,gBAAgB,CAA0C;IAClE,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,MAAM;IAO5B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,UAAU;IAMlB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAyBrC,OAAO,CAAC,aAAa;IAyBrB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAMrC,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAMzC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAyClC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,OAAO,GAAG,MAAe,GAAG,IAAI;IAU3E,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAuBjC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAoBnC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAelC,eAAe,IAAI,IAAI;IAevB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAerC,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAmBnC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAqCzD,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI;CAyDzC;;AAED,wBAAoC"}
|
package/dist/src/logger.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// src/logger.ts
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
const string_width_1 = __importDefault(require("string-width"));
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
class Logger {
|
|
12
|
-
static instance;
|
|
13
|
-
prefixLength = 0;
|
|
14
|
-
outputBuffer = new Map();
|
|
15
|
-
commandColors = new Map();
|
|
16
|
-
startTimes = new Map();
|
|
17
|
-
spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
18
|
-
spinnerIndex = 0;
|
|
19
|
-
spinnerIntervals = new Map();
|
|
20
|
-
isSpinnerActive = false;
|
|
21
|
-
constructor() { }
|
|
22
|
-
static getInstance() {
|
|
23
|
-
if (!Logger.instance) {
|
|
24
|
-
Logger.instance = new Logger();
|
|
25
|
-
}
|
|
26
|
-
return Logger.instance;
|
|
27
|
-
}
|
|
28
|
-
getSpinnerFrame() {
|
|
29
|
-
const frame = this.spinnerFrames[this.spinnerIndex];
|
|
30
|
-
this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;
|
|
31
|
-
return frame;
|
|
32
|
-
}
|
|
33
|
-
showBanner() {
|
|
34
|
-
console.log('\n' + chalk_1.default.bgHex('#0066FF').black(' Neex ') + '\n');
|
|
35
|
-
}
|
|
36
|
-
setCommands(commands) {
|
|
37
|
-
// Clear any existing spinner intervals
|
|
38
|
-
this.stopAllSpinners();
|
|
39
|
-
// Show Neex banner
|
|
40
|
-
this.showBanner();
|
|
41
|
-
// Calculate prefix length for aligning output
|
|
42
|
-
this.prefixLength = Math.max(...commands.map(cmd => (0, string_width_1.default)(cmd))) + 3;
|
|
43
|
-
// Initialize buffers and colors for each command
|
|
44
|
-
commands.forEach(cmd => {
|
|
45
|
-
this.outputBuffer.set(cmd, []);
|
|
46
|
-
this.commandColors.set(cmd, this.generateColor(cmd));
|
|
47
|
-
});
|
|
48
|
-
// Log commands that will be executed
|
|
49
|
-
console.log(chalk_1.default.dim('» Commands to execute:'));
|
|
50
|
-
commands.forEach(cmd => {
|
|
51
|
-
const color = this.commandColors.get(cmd) || chalk_1.default.white;
|
|
52
|
-
console.log(chalk_1.default.dim(' ┌') + color(` ${cmd}`));
|
|
53
|
-
});
|
|
54
|
-
console.log(''); // Add a blank line after commands list
|
|
55
|
-
}
|
|
56
|
-
generateColor(command) {
|
|
57
|
-
// Generate distinct colors for commands based on the command string
|
|
58
|
-
const vibrantColors = [
|
|
59
|
-
'#00BFFF', // Deep Sky Blue
|
|
60
|
-
'#32CD32', // Lime Green
|
|
61
|
-
'#FF6347', // Tomato
|
|
62
|
-
'#9370DB', // Medium Purple
|
|
63
|
-
'#FF8C00', // Dark Orange
|
|
64
|
-
'#20B2AA', // Light Sea Green
|
|
65
|
-
'#0066FF', // Deep Pink
|
|
66
|
-
'#4169E1', // Royal Blue
|
|
67
|
-
'#FFD700', // Gold
|
|
68
|
-
'#8A2BE2', // Blue Violet
|
|
69
|
-
];
|
|
70
|
-
let hash = 0;
|
|
71
|
-
for (let i = 0; i < command.length; i++) {
|
|
72
|
-
hash = (hash << 5) - hash + command.charCodeAt(i);
|
|
73
|
-
hash |= 0; // Convert to 32bit integer
|
|
74
|
-
}
|
|
75
|
-
const colorIndex = Math.abs(hash) % vibrantColors.length;
|
|
76
|
-
return chalk_1.default.hex(vibrantColors[colorIndex]);
|
|
77
|
-
}
|
|
78
|
-
formatPrefix(command) {
|
|
79
|
-
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
80
|
-
const prefix = `${command}:`.padEnd(this.prefixLength);
|
|
81
|
-
return color(prefix);
|
|
82
|
-
}
|
|
83
|
-
bufferOutput(output) {
|
|
84
|
-
const currentBuffer = this.outputBuffer.get(output.command) || [];
|
|
85
|
-
currentBuffer.push(output);
|
|
86
|
-
this.outputBuffer.set(output.command, currentBuffer);
|
|
87
|
-
}
|
|
88
|
-
printBuffer(command) {
|
|
89
|
-
const buffer = this.outputBuffer.get(command) || [];
|
|
90
|
-
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
91
|
-
// Stop spinner for this command if running
|
|
92
|
-
this.stopSpinner(command);
|
|
93
|
-
buffer.forEach(output => {
|
|
94
|
-
const prefix = this.formatPrefix(output.command);
|
|
95
|
-
const content = output.data.trim();
|
|
96
|
-
if (content) {
|
|
97
|
-
const lines = content.split('\n');
|
|
98
|
-
lines.forEach(line => {
|
|
99
|
-
if (line.trim()) {
|
|
100
|
-
const outputLine = `${prefix} ${line}`;
|
|
101
|
-
// Show stderr in appropriate colors
|
|
102
|
-
if (output.type === 'stderr') {
|
|
103
|
-
// Not all stderr is an error, check for warning or info patterns
|
|
104
|
-
if (line.toLowerCase().includes('warn') ||
|
|
105
|
-
line.toLowerCase().includes('warning')) {
|
|
106
|
-
console.log(`${prefix} ${chalk_1.default.yellow(line)}`);
|
|
107
|
-
}
|
|
108
|
-
else if (line.toLowerCase().includes('error')) {
|
|
109
|
-
console.log(`${prefix} ${chalk_1.default.red(line)}`);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
console.log(`${prefix} ${line}`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
console.log(outputLine);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
// Clear buffer after printing
|
|
123
|
-
this.outputBuffer.set(command, []);
|
|
124
|
-
}
|
|
125
|
-
clearBuffer(command) {
|
|
126
|
-
this.outputBuffer.set(command, []);
|
|
127
|
-
}
|
|
128
|
-
printLine(message, level = 'info') {
|
|
129
|
-
if (level === 'error') {
|
|
130
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} ${message}`));
|
|
131
|
-
}
|
|
132
|
-
else if (level === 'warn') {
|
|
133
|
-
console.warn(chalk_1.default.yellow(`${figures_1.default.warning} ${message}`));
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} ${message}`));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
printStart(command) {
|
|
140
|
-
// Record start time
|
|
141
|
-
this.startTimes.set(command, new Date());
|
|
142
|
-
const prefix = this.formatPrefix(command);
|
|
143
|
-
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
144
|
-
// Stop any previous spinner for this command (e.g. if retrying)
|
|
145
|
-
this.stopSpinner(command);
|
|
146
|
-
// Clear the line before printing "Starting..."
|
|
147
|
-
if (this.isSpinnerActive) {
|
|
148
|
-
// Check if any spinner was active to avoid clearing unnecessarily
|
|
149
|
-
process.stdout.write('\r' + ' '.repeat(process.stdout.columns || 80) + '\r');
|
|
150
|
-
}
|
|
151
|
-
console.log(`${prefix} ${color('Starting...')}`);
|
|
152
|
-
// Start spinner for this command
|
|
153
|
-
this.startSpinner(command);
|
|
154
|
-
}
|
|
155
|
-
startSpinner(command) {
|
|
156
|
-
// Only create a spinner if one doesn't already exist for this command
|
|
157
|
-
if (this.spinnerIntervals.has(command)) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
this.isSpinnerActive = true;
|
|
161
|
-
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
162
|
-
const prefix = this.formatPrefix(command);
|
|
163
|
-
const interval = setInterval(() => {
|
|
164
|
-
const frame = this.getSpinnerFrame();
|
|
165
|
-
process.stdout.write(`\r${prefix} ${color(frame)} ${chalk_1.default.dim('Running...')}`);
|
|
166
|
-
}, 80);
|
|
167
|
-
this.spinnerIntervals.set(command, interval);
|
|
168
|
-
}
|
|
169
|
-
stopSpinner(command) {
|
|
170
|
-
const interval = this.spinnerIntervals.get(command);
|
|
171
|
-
if (interval) {
|
|
172
|
-
clearInterval(interval);
|
|
173
|
-
this.spinnerIntervals.delete(command);
|
|
174
|
-
// Clear the spinner line
|
|
175
|
-
if (this.isSpinnerActive) {
|
|
176
|
-
process.stdout.write('\r' + ' '.repeat(process.stdout.columns || 80) + '\r');
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
stopAllSpinners() {
|
|
181
|
-
this.spinnerIntervals.forEach((interval, command) => {
|
|
182
|
-
clearInterval(interval);
|
|
183
|
-
});
|
|
184
|
-
this.spinnerIntervals.clear();
|
|
185
|
-
this.isSpinnerActive = false;
|
|
186
|
-
// Clear the spinner line if any spinner was active
|
|
187
|
-
if (this.isSpinnerActive) {
|
|
188
|
-
process.stdout.write('\r' + ' '.repeat(process.stdout.columns || 80) + '\r');
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
printSuccess(result) {
|
|
192
|
-
const { command, duration } = result;
|
|
193
|
-
this.stopSpinner(command);
|
|
194
|
-
const prefix = this.formatPrefix(command);
|
|
195
|
-
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
196
|
-
const durationStr = duration
|
|
197
|
-
? ` ${chalk_1.default.dim(`(${(duration / 1000).toFixed(2)}s)`)}`
|
|
198
|
-
: '';
|
|
199
|
-
console.log(`${prefix} ${chalk_1.default.green(figures_1.default.tick)} ${chalk_1.default.green('Completed')}${durationStr}`);
|
|
200
|
-
}
|
|
201
|
-
printError(result) {
|
|
202
|
-
const { command, error, code, duration } = result;
|
|
203
|
-
this.stopSpinner(command);
|
|
204
|
-
const prefix = this.formatPrefix(command);
|
|
205
|
-
const durationStr = duration
|
|
206
|
-
? ` ${chalk_1.default.dim(`(${(duration / 1000).toFixed(2)}s)`)}`
|
|
207
|
-
: '';
|
|
208
|
-
const errorCode = code !== null ? ` ${chalk_1.default.red(`[code: ${code}]`)}` : '';
|
|
209
|
-
console.error(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} ${chalk_1.default.red('Failed')}${errorCode}${durationStr}`);
|
|
210
|
-
if (error) {
|
|
211
|
-
console.error(`${prefix} ${chalk_1.default.red(error.message)}`);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
printEnd(result, minimalOutput) {
|
|
215
|
-
this.stopSpinner(result.command);
|
|
216
|
-
const prefix = this.formatPrefix(result.command); // Corrected to formatPrefix
|
|
217
|
-
let durationDisplay = '';
|
|
218
|
-
if (result.duration !== null) {
|
|
219
|
-
// Ensure result.duration is treated as a number here
|
|
220
|
-
durationDisplay = `(${(0, utils_1.formatDuration)(result.duration)})`;
|
|
221
|
-
}
|
|
222
|
-
const duration = durationDisplay;
|
|
223
|
-
if (minimalOutput) {
|
|
224
|
-
if (!result.success) {
|
|
225
|
-
const status = result.code !== null ? `failed (code ${result.code})` : 'failed';
|
|
226
|
-
this.printLine(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} ${result.command} ${status} ${duration}`, 'error');
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
if (result.success) {
|
|
231
|
-
this.printLine(`${prefix} ${chalk_1.default.green(figures_1.default.tick)} Command "${result.command}" finished successfully ${duration}`, 'info');
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
const errorCode = result.code !== null ? ` (code ${result.code})` : '';
|
|
235
|
-
const errorMessage = result.error ? `: ${result.error.message}` : '';
|
|
236
|
-
this.printLine(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} Command "${result.command}" failed${errorCode}${errorMessage} ${duration}`, 'error');
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
printSummary(results) {
|
|
241
|
-
// Stop any remaining spinners
|
|
242
|
-
this.stopAllSpinners();
|
|
243
|
-
const successful = results.filter(r => r.success).length;
|
|
244
|
-
const failed = results.length - successful;
|
|
245
|
-
const totalDuration = results.reduce((sum, result) => sum + (result.duration || 0), 0);
|
|
246
|
-
const totalSeconds = (totalDuration / 1000).toFixed(2);
|
|
247
|
-
console.log('\n' +
|
|
248
|
-
chalk_1.default.bgHex('#0066FF').black(' Execution Summary ') +
|
|
249
|
-
'\n');
|
|
250
|
-
console.log(`${chalk_1.default.green(`${figures_1.default.tick} ${successful} succeeded`)}, ${chalk_1.default.red(`${figures_1.default.cross} ${failed} failed`)}`);
|
|
251
|
-
console.log(`${chalk_1.default.blue(figures_1.default.info)} ${chalk_1.default.dim(`Total execution time: ${totalSeconds}s`)}`);
|
|
252
|
-
if (successful > 0) {
|
|
253
|
-
console.log('\n' + chalk_1.default.green.bold('Successful commands:'));
|
|
254
|
-
results
|
|
255
|
-
.filter(r => r.success)
|
|
256
|
-
.forEach(result => {
|
|
257
|
-
const color = this.commandColors.get(result.command) || chalk_1.default.white;
|
|
258
|
-
const duration = result.duration
|
|
259
|
-
? chalk_1.default.dim(` (${(result.duration / 1000).toFixed(2)}s)`)
|
|
260
|
-
: '';
|
|
261
|
-
console.log(` ${chalk_1.default.green(figures_1.default.tick)} ${color(result.command)}${duration}`);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
if (failed > 0) {
|
|
265
|
-
console.log('\n' + chalk_1.default.red.bold('Failed commands:'));
|
|
266
|
-
results
|
|
267
|
-
.filter(r => !r.success)
|
|
268
|
-
.forEach(result => {
|
|
269
|
-
const color = this.commandColors.get(result.command) || chalk_1.default.white;
|
|
270
|
-
const duration = result.duration
|
|
271
|
-
? chalk_1.default.dim(` (${(result.duration / 1000).toFixed(2)}s)`)
|
|
272
|
-
: '';
|
|
273
|
-
const code = result.code !== null ? chalk_1.default.red(` [code: ${result.code}]`) : '';
|
|
274
|
-
console.log(` ${chalk_1.default.red(figures_1.default.cross)} ${color(result.command)}${code}${duration}`);
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
exports.default = Logger.getInstance();
|
package/dist/src/runner.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RunOptions, RunResult } from './types';
|
|
2
|
-
export declare class Runner {
|
|
3
|
-
private options;
|
|
4
|
-
private activeProcesses;
|
|
5
|
-
private serverInfo;
|
|
6
|
-
private portRegex;
|
|
7
|
-
private urlRegex;
|
|
8
|
-
private isCleaningUp;
|
|
9
|
-
constructor(options: RunOptions);
|
|
10
|
-
private setupSignalHandlers;
|
|
11
|
-
private expandWildcardCommands;
|
|
12
|
-
private resolveScriptAndCwd;
|
|
13
|
-
detectServerInfo(command: string, data: string): void;
|
|
14
|
-
runCommand(originalCommand: string, currentRetry?: number): Promise<RunResult>;
|
|
15
|
-
runSequential(commands: string[]): Promise<RunResult[]>;
|
|
16
|
-
runParallel(commands: string[]): Promise<RunResult[]>;
|
|
17
|
-
run(initialCommands: string[]): Promise<RunResult[]>;
|
|
18
|
-
cleanup(signal?: NodeJS.Signals): void;
|
|
19
|
-
private killProcess;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=runner.d.ts.map
|
package/dist/src/runner.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,SAAS,EAA6B,MAAM,SAAS,CAAC;AAM3E,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,SAAS,CACyD;IAC1E,OAAO,CAAC,QAAQ,CAAiD;IACjE,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,EAAE,UAAU;IAM/B,OAAO,CAAC,mBAAmB;YAsBb,sBAAsB;YA4CtB,mBAAmB;IAmCjC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAsC/C,UAAU,CACd,eAAe,EAAE,MAAM,EACvB,YAAY,SAAI,GACf,OAAO,CAAC,SAAS,CAAC;IAkKf,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAevD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAuBrD,GAAG,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAsBnD,OAAO,CAAC,MAAM,GAAE,MAAM,CAAC,OAAmB,GAAG,IAAI;YAwC1C,WAAW;CAkD1B"}
|