@ilanalimanjs/open_pack 2.4.4 → 2.4.5
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/bin/index.js +14 -7
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -109,12 +109,19 @@ const isTTY = Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
|
109
109
|
const SHELL_TOOLS = new Set(Object.keys(PACKAGE_MANAGERS));
|
|
110
110
|
|
|
111
111
|
const STATE_ICONS = {
|
|
112
|
-
done: chalk.green('
|
|
113
|
-
warning: chalk.yellow('
|
|
114
|
-
failed: chalk.red('
|
|
112
|
+
done: chalk.green('●'),
|
|
113
|
+
warning: chalk.yellow('●'),
|
|
114
|
+
failed: chalk.red('●'),
|
|
115
115
|
pending: muted('○')
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
const STATUS_VALUES = {
|
|
119
|
+
done: (result) => muted(`${(result.duration / 1000).toFixed(1)}s`),
|
|
120
|
+
warning: (result) => chalk.yellow(`${(result.duration / 1000).toFixed(1)}s`),
|
|
121
|
+
failed: () => chalk.red('failed'),
|
|
122
|
+
pending: () => muted('pending')
|
|
123
|
+
};
|
|
124
|
+
|
|
118
125
|
class UsageError extends Error {}
|
|
119
126
|
|
|
120
127
|
const pause = (ms) => (isTTY ? sleep(ms) : Promise.resolve());
|
|
@@ -344,7 +351,7 @@ const printEnvironmentCard = (environment) => {
|
|
|
344
351
|
const printStatusCard = (results) => {
|
|
345
352
|
const rows = results.map((result) => ({
|
|
346
353
|
label: `${STATE_ICONS[result.state]} ${result.label}`,
|
|
347
|
-
value: result.
|
|
354
|
+
value: STATUS_VALUES[result.state](result)
|
|
348
355
|
}));
|
|
349
356
|
console.log();
|
|
350
357
|
console.log(renderCard('Build status', rows));
|
|
@@ -381,7 +388,7 @@ const printHelp = () => {
|
|
|
381
388
|
|
|
382
389
|
const printFailure = (title, detail) => {
|
|
383
390
|
console.log();
|
|
384
|
-
console.log(` ${chalk.red('
|
|
391
|
+
console.log(` ${chalk.red('●')} ${chalk.bold(title)}`);
|
|
385
392
|
if (detail) console.log(` ${muted(detail)}`);
|
|
386
393
|
console.log();
|
|
387
394
|
process.exitCode = 1;
|
|
@@ -599,7 +606,7 @@ const runSteps = async (steps, results) => {
|
|
|
599
606
|
spinner.stopAndPersist({ symbol: STATE_ICONS[state], text: `${prefix} ${label}` });
|
|
600
607
|
} catch (error) {
|
|
601
608
|
results[index] = { label: step.active, state: 'failed', duration: Date.now() - startedAt };
|
|
602
|
-
spinner.stopAndPersist({ symbol: STATE_ICONS.failed, text: `${prefix} ${step.active}` });
|
|
609
|
+
spinner.stopAndPersist({ symbol: STATE_ICONS.failed, text: `${prefix} ${step.active} ${chalk.red('failed')}` });
|
|
603
610
|
throw error;
|
|
604
611
|
}
|
|
605
612
|
}
|
|
@@ -614,7 +621,7 @@ const printSummary = ({ name, packageManager, mode, port, startedAt }) => {
|
|
|
614
621
|
if (mode !== MODES.run) pending.push(devCommand);
|
|
615
622
|
|
|
616
623
|
console.log();
|
|
617
|
-
console.log(` ${chalk.green('
|
|
624
|
+
console.log(` ${chalk.green('●')} ${chalk.bold(name)} is ready ${muted(`in ${duration}s`)}`);
|
|
618
625
|
console.log();
|
|
619
626
|
if (mode === MODES.run) {
|
|
620
627
|
console.log(` ${muted('Server')} ${accent(devUrl)}`);
|