@decohere/cli 0.0.1-dev.92 → 0.0.1-dev.94
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/commonjs/src/root.command.js +15 -0
- package/es6/src/root.command.js +16 -1
- package/package.json +10 -10
|
@@ -18,6 +18,14 @@ class RootCommand extends _cli.DecohereCommand {
|
|
|
18
18
|
this.#configFile = configFile;
|
|
19
19
|
this.addOption(new _cli.ConfigFileOption());
|
|
20
20
|
this.addOption(new _cli.LogLevelOption());
|
|
21
|
+
this.addOption(new _cli.EnvFileOption());
|
|
22
|
+
this.addOption(new _cli.EnvFileIfExistsOption());
|
|
23
|
+
// Explicit opt-in: nothing reads a .env file unless the command line names one.
|
|
24
|
+
this.hook("preAction", (command)=>{
|
|
25
|
+
const { envFile, envFileIfExists } = command.opts();
|
|
26
|
+
if (envFile) process.loadEnvFile(envFile);
|
|
27
|
+
if (envFileIfExists) loadEnvFileIfExists(envFileIfExists);
|
|
28
|
+
});
|
|
21
29
|
for (const mod of modules){
|
|
22
30
|
this.addCommand(mod.command);
|
|
23
31
|
}
|
|
@@ -34,3 +42,10 @@ class RootCommand extends _cli.DecohereCommand {
|
|
|
34
42
|
return super.parseAsync(argv, options);
|
|
35
43
|
}
|
|
36
44
|
}
|
|
45
|
+
function loadEnvFileIfExists(path) {
|
|
46
|
+
try {
|
|
47
|
+
process.loadEnvFile(path);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
if (err.code !== "ENOENT") throw err;
|
|
50
|
+
}
|
|
51
|
+
}
|
package/es6/src/root.command.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkspaceFactory } from "@decohere/mesh";
|
|
2
|
-
import { ConfigFileOption, DecohereCommand, LogLevelOption } from "@decohere/nexus/cli";
|
|
2
|
+
import { ConfigFileOption, DecohereCommand, EnvFileIfExistsOption, EnvFileOption, LogLevelOption } from "@decohere/nexus/cli";
|
|
3
3
|
import { CommanderError } from "commander";
|
|
4
4
|
export class RootCommand extends DecohereCommand {
|
|
5
5
|
#configFile;
|
|
@@ -8,6 +8,14 @@ export class RootCommand extends DecohereCommand {
|
|
|
8
8
|
this.#configFile = configFile;
|
|
9
9
|
this.addOption(new ConfigFileOption());
|
|
10
10
|
this.addOption(new LogLevelOption());
|
|
11
|
+
this.addOption(new EnvFileOption());
|
|
12
|
+
this.addOption(new EnvFileIfExistsOption());
|
|
13
|
+
// Explicit opt-in: nothing reads a .env file unless the command line names one.
|
|
14
|
+
this.hook("preAction", (command)=>{
|
|
15
|
+
const { envFile, envFileIfExists } = command.opts();
|
|
16
|
+
if (envFile) process.loadEnvFile(envFile);
|
|
17
|
+
if (envFileIfExists) loadEnvFileIfExists(envFileIfExists);
|
|
18
|
+
});
|
|
11
19
|
for (const mod of modules){
|
|
12
20
|
this.addCommand(mod.command);
|
|
13
21
|
}
|
|
@@ -24,3 +32,10 @@ export class RootCommand extends DecohereCommand {
|
|
|
24
32
|
return super.parseAsync(argv, options);
|
|
25
33
|
}
|
|
26
34
|
}
|
|
35
|
+
function loadEnvFileIfExists(path) {
|
|
36
|
+
try {
|
|
37
|
+
process.loadEnvFile(path);
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (err.code !== "ENOENT") throw err;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/cli",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.94",
|
|
4
4
|
"description": "CLI for the Decohere toolchain — build, serve, publish, and manage TypeScript monorepos",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@decohere/create": "0.0.1-dev.
|
|
32
|
-
"@decohere/crucible": "0.0.1-dev.
|
|
33
|
-
"@decohere/flux": "0.0.1-dev.
|
|
34
|
-
"@decohere/forge": "0.0.1-dev.
|
|
35
|
-
"@decohere/mesh": "0.0.1-dev.
|
|
36
|
-
"@decohere/nexus": "0.0.1-dev.
|
|
37
|
-
"@decohere/scaffold": "0.0.1-dev.
|
|
38
|
-
"@decohere/scribe": "0.0.1-dev.
|
|
39
|
-
"@decohere/scribe-pino": "0.0.1-dev.
|
|
31
|
+
"@decohere/create": "0.0.1-dev.94",
|
|
32
|
+
"@decohere/crucible": "0.0.1-dev.94",
|
|
33
|
+
"@decohere/flux": "0.0.1-dev.94",
|
|
34
|
+
"@decohere/forge": "0.0.1-dev.94",
|
|
35
|
+
"@decohere/mesh": "0.0.1-dev.94",
|
|
36
|
+
"@decohere/nexus": "0.0.1-dev.94",
|
|
37
|
+
"@decohere/scaffold": "0.0.1-dev.94",
|
|
38
|
+
"@decohere/scribe": "0.0.1-dev.94",
|
|
39
|
+
"@decohere/scribe-pino": "0.0.1-dev.94",
|
|
40
40
|
"commander": "^13.1.0",
|
|
41
41
|
"pino-pretty": "^13.1.3"
|
|
42
42
|
},
|