@twin.org/cli-core 0.0.1-next.21 → 0.0.1-next.23
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/cjs/index.cjs +13 -3
- package/dist/esm/index.mjs +13 -3
- package/dist/types/cliUtils.d.ts +9 -1
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/CLIUtils.md +35 -1
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -298,6 +298,17 @@ class CLIUtils {
|
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Run a shell command.
|
|
303
|
+
* @param command The app to run in the shell.
|
|
304
|
+
* @param args The args for the app.
|
|
305
|
+
* @param cwd The working directory to execute the command in.
|
|
306
|
+
* @returns Promise to wait for command execution to complete.
|
|
307
|
+
*/
|
|
308
|
+
static async runShellCmd(command, args, cwd) {
|
|
309
|
+
const osCommand = process.platform.startsWith("win") ? `${command}.cmd` : command;
|
|
310
|
+
return CLIUtils.runShellApp(osCommand, args, cwd);
|
|
311
|
+
}
|
|
301
312
|
/**
|
|
302
313
|
* Run a shell app.
|
|
303
314
|
* @param app The app to run in the shell.
|
|
@@ -305,10 +316,9 @@ class CLIUtils {
|
|
|
305
316
|
* @param cwd The working directory to execute the command in.
|
|
306
317
|
* @returns Promise to wait for command execution to complete.
|
|
307
318
|
*/
|
|
308
|
-
static async
|
|
319
|
+
static async runShellApp(app, args, cwd) {
|
|
309
320
|
return new Promise((resolve, reject) => {
|
|
310
|
-
const
|
|
311
|
-
const sp = node_child_process.spawn(osCommand, args, {
|
|
321
|
+
const sp = node_child_process.spawn(app, args, {
|
|
312
322
|
shell: true,
|
|
313
323
|
cwd
|
|
314
324
|
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -277,6 +277,17 @@ class CLIUtils {
|
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Run a shell command.
|
|
282
|
+
* @param command The app to run in the shell.
|
|
283
|
+
* @param args The args for the app.
|
|
284
|
+
* @param cwd The working directory to execute the command in.
|
|
285
|
+
* @returns Promise to wait for command execution to complete.
|
|
286
|
+
*/
|
|
287
|
+
static async runShellCmd(command, args, cwd) {
|
|
288
|
+
const osCommand = process.platform.startsWith("win") ? `${command}.cmd` : command;
|
|
289
|
+
return CLIUtils.runShellApp(osCommand, args, cwd);
|
|
290
|
+
}
|
|
280
291
|
/**
|
|
281
292
|
* Run a shell app.
|
|
282
293
|
* @param app The app to run in the shell.
|
|
@@ -284,10 +295,9 @@ class CLIUtils {
|
|
|
284
295
|
* @param cwd The working directory to execute the command in.
|
|
285
296
|
* @returns Promise to wait for command execution to complete.
|
|
286
297
|
*/
|
|
287
|
-
static async
|
|
298
|
+
static async runShellApp(app, args, cwd) {
|
|
288
299
|
return new Promise((resolve, reject) => {
|
|
289
|
-
const
|
|
290
|
-
const sp = spawn(osCommand, args, {
|
|
300
|
+
const sp = spawn(app, args, {
|
|
291
301
|
shell: true,
|
|
292
302
|
cwd
|
|
293
303
|
});
|
package/dist/types/cliUtils.d.ts
CHANGED
|
@@ -56,6 +56,14 @@ export declare class CLIUtils {
|
|
|
56
56
|
* @returns The root path.
|
|
57
57
|
*/
|
|
58
58
|
static findNpmRoot(rootFolder: string): Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Run a shell command.
|
|
61
|
+
* @param command The app to run in the shell.
|
|
62
|
+
* @param args The args for the app.
|
|
63
|
+
* @param cwd The working directory to execute the command in.
|
|
64
|
+
* @returns Promise to wait for command execution to complete.
|
|
65
|
+
*/
|
|
66
|
+
static runShellCmd(command: string, args: string[], cwd: string): Promise<void>;
|
|
59
67
|
/**
|
|
60
68
|
* Run a shell app.
|
|
61
69
|
* @param app The app to run in the shell.
|
|
@@ -63,7 +71,7 @@ export declare class CLIUtils {
|
|
|
63
71
|
* @param cwd The working directory to execute the command in.
|
|
64
72
|
* @returns Promise to wait for command execution to complete.
|
|
65
73
|
*/
|
|
66
|
-
static
|
|
74
|
+
static runShellApp(app: string, args: string[], cwd: string): Promise<void>;
|
|
67
75
|
/**
|
|
68
76
|
* Write a JSON file.
|
|
69
77
|
* @param jsonFilename The filename to write.
|
package/docs/changelog.md
CHANGED
|
@@ -222,7 +222,41 @@ The root path.
|
|
|
222
222
|
|
|
223
223
|
### runShellCmd()
|
|
224
224
|
|
|
225
|
-
> `static` **runShellCmd**(`
|
|
225
|
+
> `static` **runShellCmd**(`command`, `args`, `cwd`): `Promise`\<`void`\>
|
|
226
|
+
|
|
227
|
+
Run a shell command.
|
|
228
|
+
|
|
229
|
+
#### Parameters
|
|
230
|
+
|
|
231
|
+
##### command
|
|
232
|
+
|
|
233
|
+
`string`
|
|
234
|
+
|
|
235
|
+
The app to run in the shell.
|
|
236
|
+
|
|
237
|
+
##### args
|
|
238
|
+
|
|
239
|
+
`string`[]
|
|
240
|
+
|
|
241
|
+
The args for the app.
|
|
242
|
+
|
|
243
|
+
##### cwd
|
|
244
|
+
|
|
245
|
+
`string`
|
|
246
|
+
|
|
247
|
+
The working directory to execute the command in.
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
`Promise`\<`void`\>
|
|
252
|
+
|
|
253
|
+
Promise to wait for command execution to complete.
|
|
254
|
+
|
|
255
|
+
***
|
|
256
|
+
|
|
257
|
+
### runShellApp()
|
|
258
|
+
|
|
259
|
+
> `static` **runShellApp**(`app`, `args`, `cwd`): `Promise`\<`void`\>
|
|
226
260
|
|
|
227
261
|
Run a shell app.
|
|
228
262
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/cli-core",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.23",
|
|
4
4
|
"description": "Core classes for building a CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "0.0.1-next.
|
|
18
|
-
"@twin.org/crypto": "0.0.1-next.
|
|
17
|
+
"@twin.org/core": "0.0.1-next.23",
|
|
18
|
+
"@twin.org/crypto": "0.0.1-next.23",
|
|
19
19
|
"@twin.org/nameof": "next",
|
|
20
20
|
"chalk": "5.4.1",
|
|
21
21
|
"commander": "13.0.0",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
29
30
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"import": "./dist/esm/index.mjs"
|
|
31
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"files": [
|