@stacksjs/cli 0.52.0 → 0.52.2
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/dist/index.d.ts +13 -2
- package/dist/index.mjs +10 -6
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -7,20 +7,31 @@ import ora from 'ora';
|
|
|
7
7
|
export { ansi256Bg, bgBlack, bgBlue, bgCyan, bgGray, bgGreen, bgLightBlue, bgLightCyan, bgLightGray, bgLightGreen, bgLightMagenta, bgLightRed, bgLightYellow, bgMagenta, bgRed, bgWhite, bgYellow, black, blue, bold, cyan, dim, gray, green, hidden, inverse, italic, lightBlue, lightCyan, lightGray, lightGreen, lightMagenta, lightRed, lightYellow, link, magenta, red, reset, strikethrough, underline, white, yellow } from 'kolorist';
|
|
8
8
|
export { log } from '@stacksjs/logging';
|
|
9
9
|
|
|
10
|
+
interface InstallPackageOptions {
|
|
11
|
+
cwd?: string;
|
|
12
|
+
dev?: boolean;
|
|
13
|
+
silent?: boolean;
|
|
14
|
+
packageManager?: string;
|
|
15
|
+
packageManagerVersion?: string;
|
|
16
|
+
preferOffline?: boolean;
|
|
17
|
+
additionalArgs?: string[];
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* Install an npm package.
|
|
12
21
|
*
|
|
13
22
|
* @param pkg - The package name to install.
|
|
23
|
+
* @param pkg - The options to pass to the install.The options to pass to the install.
|
|
14
24
|
* @returns The result of the install.
|
|
15
25
|
*/
|
|
16
|
-
declare function installPackage(pkg: string): Promise<CommandReturnValue>;
|
|
26
|
+
declare function installPackage(pkg: string, options?: InstallPackageOptions): Promise<CommandReturnValue>;
|
|
17
27
|
/**
|
|
18
28
|
* Install a Stack into your project.
|
|
19
29
|
*
|
|
20
30
|
* @param pkg - The Stack name to install.
|
|
31
|
+
* @param options - The options to pass to the install.
|
|
21
32
|
* @returns The result of the install.
|
|
22
33
|
*/
|
|
23
|
-
declare function installStack(name: string): Promise<CommandReturnValue>;
|
|
34
|
+
declare function installStack(name: string, options?: InstallPackageOptions): Promise<CommandReturnValue>;
|
|
24
35
|
|
|
25
36
|
declare const prompt: <T extends {
|
|
26
37
|
type?: "text" | undefined;
|
package/dist/index.mjs
CHANGED
|
@@ -12,12 +12,16 @@ import { execSync as execSync$1 } from 'node:child_process';
|
|
|
12
12
|
import { ExitCode } from '@stacksjs/types';
|
|
13
13
|
export { ExitCode } from '@stacksjs/types';
|
|
14
14
|
import { projectPath } from '@stacksjs/path';
|
|
15
|
-
import { ResultAsync
|
|
15
|
+
import { ResultAsync } from '@stacksjs/error-handling';
|
|
16
16
|
|
|
17
|
-
async function installPackage(pkg) {
|
|
17
|
+
async function installPackage(pkg, options) {
|
|
18
|
+
if (options)
|
|
19
|
+
return await installPackage$1(pkg, options);
|
|
18
20
|
return await installPackage$1(pkg, { silent: true });
|
|
19
21
|
}
|
|
20
|
-
async function installStack(name) {
|
|
22
|
+
async function installStack(name, options) {
|
|
23
|
+
if (options)
|
|
24
|
+
return await installPackage$1(`@stacksjs/${name}`, options);
|
|
21
25
|
return await installPackage$1(`@stacksjs/${name}`, { silent: true });
|
|
22
26
|
}
|
|
23
27
|
|
|
@@ -40,6 +44,8 @@ function outro(text, options, error) {
|
|
|
40
44
|
if (error)
|
|
41
45
|
log.error(error);
|
|
42
46
|
} else {
|
|
47
|
+
if (options?.type === "info")
|
|
48
|
+
log.info(text);
|
|
43
49
|
log.success(text);
|
|
44
50
|
}
|
|
45
51
|
if (options.startTime) {
|
|
@@ -152,7 +158,6 @@ function execSync(command) {
|
|
|
152
158
|
return execSync$1(command, { encoding: "utf-8" });
|
|
153
159
|
}
|
|
154
160
|
async function runCommand(command, options) {
|
|
155
|
-
console.log("runCommand", command, options);
|
|
156
161
|
return await exec(command, options);
|
|
157
162
|
}
|
|
158
163
|
async function runCommands(commands, options) {
|
|
@@ -164,14 +169,13 @@ async function runCommands(commands, options) {
|
|
|
164
169
|
process.exit();
|
|
165
170
|
}
|
|
166
171
|
const spinner = determineSpinner(options);
|
|
167
|
-
console.log("spinner", spinner);
|
|
168
172
|
for (const command of commands) {
|
|
169
173
|
const result = await runCommand(command, options);
|
|
170
174
|
if (result.isOk()) {
|
|
171
175
|
results.push(result);
|
|
172
176
|
} else if (result.isErr()) {
|
|
173
177
|
if (spinner) {
|
|
174
|
-
|
|
178
|
+
log.error(new Error("Failed to run command"));
|
|
175
179
|
process.exit(ExitCode.FatalError);
|
|
176
180
|
}
|
|
177
181
|
results.push(result);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.52.
|
|
4
|
+
"version": "0.52.2",
|
|
5
5
|
"packageManager": "pnpm@8.5.1",
|
|
6
6
|
"description": "The simple way to create beautiful CLIs.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -50,18 +50,18 @@
|
|
|
50
50
|
"cac": "^6.7.14",
|
|
51
51
|
"execa": "^7.1.1",
|
|
52
52
|
"ora": "^6.3.1",
|
|
53
|
-
"@stacksjs/
|
|
54
|
-
"@stacksjs/
|
|
55
|
-
"@stacksjs/
|
|
56
|
-
"@stacksjs/
|
|
57
|
-
"@stacksjs/
|
|
58
|
-
"@stacksjs/
|
|
53
|
+
"@stacksjs/error-handling": "0.52.2",
|
|
54
|
+
"@stacksjs/logging": "0.52.2",
|
|
55
|
+
"@stacksjs/path": "0.52.2",
|
|
56
|
+
"@stacksjs/types": "0.52.2",
|
|
57
|
+
"@stacksjs/utils": "0.52.2",
|
|
58
|
+
"@stacksjs/config": "0.52.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"kolorist": "1.8.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@stacksjs/development": "0.52.
|
|
64
|
+
"@stacksjs/development": "0.52.2"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|