hereya-cli 0.21.0 → 0.22.0
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 +20 -20
- package/dist/lib/log.d.ts +5 -0
- package/dist/lib/log.js +41 -0
- package/dist/lib/shell.d.ts +0 -1
- package/dist/lib/shell.js +4 -21
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g hereya-cli
|
|
|
20
20
|
$ hereya COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ hereya (--version)
|
|
23
|
-
hereya-cli/0.
|
|
23
|
+
hereya-cli/0.22.0 linux-x64 node-v22.13.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -81,7 +81,7 @@ EXAMPLES
|
|
|
81
81
|
$ hereya add cloudy/docker_postgres
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
84
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/add/index.ts)_
|
|
85
85
|
|
|
86
86
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
87
87
|
|
|
@@ -106,7 +106,7 @@ EXAMPLES
|
|
|
106
106
|
$ hereya bootstrap local
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
109
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/bootstrap/index.ts)_
|
|
110
110
|
|
|
111
111
|
## `hereya deploy`
|
|
112
112
|
|
|
@@ -131,7 +131,7 @@ EXAMPLES
|
|
|
131
131
|
$ hereya deploy
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
134
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/deploy/index.ts)_
|
|
135
135
|
|
|
136
136
|
## `hereya down`
|
|
137
137
|
|
|
@@ -157,7 +157,7 @@ EXAMPLES
|
|
|
157
157
|
$ hereya down
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
160
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/down/index.ts)_
|
|
161
161
|
|
|
162
162
|
## `hereya env [NAME]`
|
|
163
163
|
|
|
@@ -188,7 +188,7 @@ EXAMPLES
|
|
|
188
188
|
$ hereya env -w dev -l
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
191
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/env/index.ts)_
|
|
192
192
|
|
|
193
193
|
## `hereya env set [NAME]`
|
|
194
194
|
|
|
@@ -215,7 +215,7 @@ EXAMPLES
|
|
|
215
215
|
$ hereya env set FOO -v bar -w dev
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
218
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/env/set/index.ts)_
|
|
219
219
|
|
|
220
220
|
## `hereya help [COMMAND]`
|
|
221
221
|
|
|
@@ -261,7 +261,7 @@ EXAMPLES
|
|
|
261
261
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
264
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/init/index.ts)_
|
|
265
265
|
|
|
266
266
|
## `hereya remove PACKAGE`
|
|
267
267
|
|
|
@@ -288,7 +288,7 @@ EXAMPLES
|
|
|
288
288
|
$ hereya remove cloudy/docker_postgres
|
|
289
289
|
```
|
|
290
290
|
|
|
291
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
291
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/remove/index.ts)_
|
|
292
292
|
|
|
293
293
|
## `hereya run CMD`
|
|
294
294
|
|
|
@@ -314,7 +314,7 @@ EXAMPLES
|
|
|
314
314
|
$ hereya run -w uat -- node index.js
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
317
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/run/index.ts)_
|
|
318
318
|
|
|
319
319
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
320
320
|
|
|
@@ -339,7 +339,7 @@ EXAMPLES
|
|
|
339
339
|
$ hereya unbootstrap local
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
342
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/unbootstrap/index.ts)_
|
|
343
343
|
|
|
344
344
|
## `hereya undeploy`
|
|
345
345
|
|
|
@@ -364,7 +364,7 @@ EXAMPLES
|
|
|
364
364
|
$ hereya undeploy
|
|
365
365
|
```
|
|
366
366
|
|
|
367
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
367
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/undeploy/index.ts)_
|
|
368
368
|
|
|
369
369
|
## `hereya up`
|
|
370
370
|
|
|
@@ -390,7 +390,7 @@ EXAMPLES
|
|
|
390
390
|
$ hereya up
|
|
391
391
|
```
|
|
392
392
|
|
|
393
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
393
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/up/index.ts)_
|
|
394
394
|
|
|
395
395
|
## `hereya workspace create NAME`
|
|
396
396
|
|
|
@@ -410,7 +410,7 @@ EXAMPLES
|
|
|
410
410
|
$ hereya workspace create dev
|
|
411
411
|
```
|
|
412
412
|
|
|
413
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
413
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/create/index.ts)_
|
|
414
414
|
|
|
415
415
|
## `hereya workspace delete NAME`
|
|
416
416
|
|
|
@@ -430,7 +430,7 @@ EXAMPLES
|
|
|
430
430
|
$ hereya workspace delete dev
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
433
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/delete/index.ts)_
|
|
434
434
|
|
|
435
435
|
## `hereya workspace env [NAME]`
|
|
436
436
|
|
|
@@ -456,7 +456,7 @@ EXAMPLES
|
|
|
456
456
|
$ hereya workspace env myEnv -w dev
|
|
457
457
|
```
|
|
458
458
|
|
|
459
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
459
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/env/index.ts)_
|
|
460
460
|
|
|
461
461
|
## `hereya workspace env set`
|
|
462
462
|
|
|
@@ -480,7 +480,7 @@ EXAMPLES
|
|
|
480
480
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
483
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/env/set/index.ts)_
|
|
484
484
|
|
|
485
485
|
## `hereya workspace env unset`
|
|
486
486
|
|
|
@@ -501,7 +501,7 @@ EXAMPLES
|
|
|
501
501
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
502
502
|
```
|
|
503
503
|
|
|
504
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
504
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/env/unset/index.ts)_
|
|
505
505
|
|
|
506
506
|
## `hereya workspace install PACKAGE`
|
|
507
507
|
|
|
@@ -528,7 +528,7 @@ EXAMPLES
|
|
|
528
528
|
$ hereya workspace install hereya/aws-cognito
|
|
529
529
|
```
|
|
530
530
|
|
|
531
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
531
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/install/index.ts)_
|
|
532
532
|
|
|
533
533
|
## `hereya workspace uninstall PACKAGE`
|
|
534
534
|
|
|
@@ -555,5 +555,5 @@ EXAMPLES
|
|
|
555
555
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
556
556
|
```
|
|
557
557
|
|
|
558
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
558
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/uninstall/index.ts)_
|
|
559
559
|
<!-- commandsstop -->
|
package/dist/lib/log.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export declare function getLogger(task: ListrTaskWrapper<any, any, any>): {
|
|
|
6
6
|
error(message: string): void;
|
|
7
7
|
info(message: string): void;
|
|
8
8
|
};
|
|
9
|
+
export declare function getDefaultLogger(): {
|
|
10
|
+
debug(message: string): void;
|
|
11
|
+
error(message: string): void;
|
|
12
|
+
info(message: string): void;
|
|
13
|
+
};
|
|
9
14
|
export interface Logger {
|
|
10
15
|
debug(message: string): void;
|
|
11
16
|
error(message: string): void;
|
package/dist/lib/log.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
1
4
|
let debug = false;
|
|
2
5
|
export function setDebug(value) {
|
|
3
6
|
debug = value;
|
|
@@ -5,18 +8,56 @@ export function setDebug(value) {
|
|
|
5
8
|
export function isDebug() {
|
|
6
9
|
return debug;
|
|
7
10
|
}
|
|
11
|
+
const logPath = path.resolve(process.cwd(), 'hereya-debug.log');
|
|
8
12
|
export function getLogger(task) {
|
|
13
|
+
let logFile;
|
|
14
|
+
if (isDebug()) {
|
|
15
|
+
logFile = fs.createWriteStream(logPath, { encoding: 'utf8', flags: 'a' });
|
|
16
|
+
}
|
|
9
17
|
return {
|
|
10
18
|
debug(message) {
|
|
11
19
|
if (isDebug()) {
|
|
12
20
|
task.output = message;
|
|
21
|
+
logFile.write(stripVTControlCharacters(message), 'utf8');
|
|
13
22
|
}
|
|
14
23
|
},
|
|
15
24
|
error(message) {
|
|
16
25
|
task.output = message;
|
|
26
|
+
if (isDebug()) {
|
|
27
|
+
logFile.write(stripVTControlCharacters(message), 'utf8');
|
|
28
|
+
}
|
|
17
29
|
},
|
|
18
30
|
info(message) {
|
|
19
31
|
task.output = message;
|
|
32
|
+
if (isDebug()) {
|
|
33
|
+
logFile.write(stripVTControlCharacters(message), 'utf8');
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function getDefaultLogger() {
|
|
39
|
+
let logFile;
|
|
40
|
+
if (isDebug()) {
|
|
41
|
+
logFile = fs.createWriteStream(logPath, { encoding: 'utf8', flags: 'a' });
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
debug(message) {
|
|
45
|
+
if (isDebug()) {
|
|
46
|
+
console.debug(message);
|
|
47
|
+
logFile.write(stripVTControlCharacters(message), 'utf8');
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
error(message) {
|
|
51
|
+
if (isDebug()) {
|
|
52
|
+
console.error(message);
|
|
53
|
+
logFile.write(stripVTControlCharacters(message), 'utf8');
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
info(message) {
|
|
57
|
+
if (isDebug()) {
|
|
58
|
+
console.info(message);
|
|
59
|
+
logFile.write(stripVTControlCharacters(message), 'utf8');
|
|
60
|
+
}
|
|
20
61
|
},
|
|
21
62
|
};
|
|
22
63
|
}
|
package/dist/lib/shell.d.ts
CHANGED
package/dist/lib/shell.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { getDefaultLogger } from './log.js';
|
|
3
3
|
// Asynchronous runShell that logs output using the provided logger.
|
|
4
4
|
export async function runShell(cmd, args, options = {}) {
|
|
5
5
|
return new Promise((resolve, reject) => {
|
|
6
6
|
// Use the provided logger or default to console.log
|
|
7
|
-
const logger = options.logger ??
|
|
7
|
+
const logger = options.logger ?? getDefaultLogger();
|
|
8
8
|
const spawnOptions = {
|
|
9
9
|
cwd: options.directory ?? process.cwd(),
|
|
10
10
|
env: { ...process.env, ...options.env },
|
|
@@ -12,7 +12,7 @@ export async function runShell(cmd, args, options = {}) {
|
|
|
12
12
|
// If not explicitly set, use 'inherit' when debugging, or 'pipe' otherwise
|
|
13
13
|
stdio: options.stdio ?? 'pipe',
|
|
14
14
|
};
|
|
15
|
-
logger.debug(`Executing: ${cmd} ${args.join(' ')}`);
|
|
15
|
+
logger.debug(`Executing: ${cmd} ${args.join(' ')}\n`);
|
|
16
16
|
const child = spawn(cmd, args, spawnOptions);
|
|
17
17
|
// Buffers to accumulate output from the process.
|
|
18
18
|
let stdout = '';
|
|
@@ -43,7 +43,7 @@ export async function runShell(cmd, args, options = {}) {
|
|
|
43
43
|
});
|
|
44
44
|
child.on('close', () => {
|
|
45
45
|
if (exitCode !== 0) {
|
|
46
|
-
const errorMsg = `Command "${cmd} ${args.join(' ')}" failed with exit code "${exitCode}"`;
|
|
46
|
+
const errorMsg = `Command "${cmd} ${args.join(' ')}" failed with exit code "${exitCode}"\n`;
|
|
47
47
|
logger.error(errorMsg);
|
|
48
48
|
return reject(new Error(errorMsg));
|
|
49
49
|
}
|
|
@@ -65,20 +65,3 @@ export function delay(ms) {
|
|
|
65
65
|
setTimeout(resolve, ms);
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
export const defaultLogger = {
|
|
69
|
-
debug(message) {
|
|
70
|
-
if (isDebug()) {
|
|
71
|
-
console.debug(message);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
error(message) {
|
|
75
|
-
if (isDebug()) {
|
|
76
|
-
console.error(message);
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
info(message) {
|
|
80
|
-
if (isDebug()) {
|
|
81
|
-
console.info(message);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
};
|
package/oclif.manifest.json
CHANGED