@stacksjs/cli 0.58.28 → 0.58.44

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ async function installStack(name, options) {
14
14
  // src/cli.ts
15
15
  import cac from "cac";
16
16
  // package.json
17
- var version = "0.58.28";
17
+ var version = "0.58.44";
18
18
 
19
19
  // src/cli.ts
20
20
  function cli(name, options) {
@@ -37,9 +37,6 @@ function parseOptions() {
37
37
  }
38
38
  return options;
39
39
  }
40
- // src/run.ts
41
- import {err as err2, ok as ok2} from "@stacksjs/error-handling";
42
-
43
40
  // src/exec.ts
44
41
  import process from "process";
45
42
  import {err, handleError, ok} from "@stacksjs/error-handling";
@@ -155,13 +152,11 @@ async function runProcess(command, options) {
155
152
  log.debug("Running command:", underline(italic(command)), "with options:", options);
156
153
  return await exec(command, options);
157
154
  }
158
- function runCommandSync(command, options) {
155
+ async function runCommandSync(command, options) {
159
156
  if (options?.verbose)
160
157
  log.debug("Running command:", underline(italic(command)), "with options:", options);
161
- const result = execSync(command, options);
162
- if (result.isErr())
163
- return err2(result.error);
164
- return ok2(result.value);
158
+ const result = await execSync(command, options);
159
+ return result;
165
160
  }
166
161
  async function runCommands(commands, options) {
167
162
  const results = [];
@@ -192,16 +187,17 @@ import {config as config2} from "@stacksjs/config";
192
187
  import {handleError as handleError2} from "@stacksjs/error-handling";
193
188
  import {log as log2} from "@stacksjs/logging";
194
189
  import {ExitCode as ExitCode2} from "@stacksjs/types";
190
+ import {bgCyan as bgCyan2, bold as bold2, cyan as cyan2, dim as dim2, gray as gray2, green as green2, italic as italic2} from "kolorist";
195
191
  async function intro(command, options) {
196
192
  return new Promise((resolve) => {
197
193
  if (options?.quiet === false) {
198
194
  console.log();
199
- console.log(cyan(bold("Stacks CLI")) + dim(` v${version}`));
195
+ console.log(cyan2(bold2("Stacks CLI")) + dim2(` v${version}`));
200
196
  console.log();
201
197
  }
202
- let msg = `Preparing to run ${bgCyan(italic(bold(` ${command} `)))}`;
198
+ let msg = `Running ${bgCyan2(italic2(bold2(` ${command} `)))}`;
203
199
  if (command === "buddy deploy")
204
- msg = `Preparing to run ${bgCyan(italic(bold(` ${command} `)))} for ${bold(`${config2.app.name}`)} ${italic(`via ${config2.app.url}`)}`;
200
+ msg = `Running ${bgCyan2(italic2(bold2(` ${command} `)))} for ${bold2(`${config2.app.name}`)} ${italic2(`via ${config2.app.url}`)}`;
205
201
  log2.info(msg);
206
202
  if (options?.showPerformance === false || options?.quiet)
207
203
  return resolve(0);
@@ -209,28 +205,33 @@ async function intro(command, options) {
209
205
  });
210
206
  }
211
207
  function outro(text, options, error) {
212
- const message = options?.message || text;
208
+ const opts = {
209
+ type: "success",
210
+ useSeconds: true,
211
+ ...options
212
+ };
213
+ opts.message = options?.message || text;
213
214
  return new Promise((resolve) => {
214
215
  if (error)
215
216
  return handleError2(error);
216
- if (options.startTime) {
217
- let time = performance.now() - options.startTime;
218
- if (options.useSeconds) {
217
+ if (opts?.startTime) {
218
+ let time = performance.now() - opts.startTime;
219
+ if (opts.useSeconds) {
219
220
  time = time / 1000;
220
221
  time = Math.round(time * 100) / 100;
221
222
  }
222
- if (options.quiet === true)
223
+ if (opts.quiet === true)
223
224
  return resolve(ExitCode2.Success);
224
225
  if (error)
225
- log2.error(`[${time.toFixed(2)}${options.useSeconds ? "s" : "ms"}] Failed`);
226
- else if (options.type === "info")
227
- console.log(`${dim(gray(`[${time.toFixed(2)}${options.useSeconds ? "s" : "ms"}]`))} ${message ?? "Complete"}`);
226
+ log2.error(`[${time.toFixed(2)}${opts.useSeconds ? "s" : "ms"}] Failed`);
227
+ else if (opts.type === "info")
228
+ console.log(`${dim2(gray2(`[${time.toFixed(2)}${opts.useSeconds ? "s" : "ms"}]`))} ${opts.message ?? "Complete"}`);
228
229
  else
229
- console.log(`${dim(gray(bold(`[${time.toFixed(2)}${options.useSeconds ? "s" : "ms"}]`)))} ${bold(green(message ?? "Complete"))}`);
230
+ console.log(`${dim2(gray2(bold2(`[${time.toFixed(2)}${opts.useSeconds ? "s" : "ms"}]`)))} ${bold2(green2(opts.message ?? "Complete"))}`);
230
231
  } else {
231
- if (options?.type === "info")
232
+ if (opts?.type === "info")
232
233
  console.log(text);
233
- else if (message !== text)
234
+ else if (opts?.type === "success" && opts?.quiet !== true)
234
235
  log2.success(text);
235
236
  }
236
237
  return resolve(ExitCode2.Success);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/cli",
3
3
  "type": "module",
4
- "version": "0.58.28",
4
+ "version": "0.58.44",
5
5
  "description": "TypeScript framework for CLI artisans. Build beautiful console apps with ease.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",