express-file-cluster 0.9.2 → 0.9.3
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/cli/index.cjs +25 -23
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +76 -74
- package/dist/cli/index.js.map +1 -1
- package/dist/docs/cli/add.md +1 -1
- package/dist/docs/cli/start.md +1 -1
- package/dist/docs/guides/deployment.md +1 -1
- package/dist/docs/guides/environment-variables.md +1 -1
- package/dist/docs/index.md +1 -1
- package/dist/docs/skills/SKILL.md +1 -1
- package/dist/registry/index.json +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -29,6 +29,30 @@ var _commander = require('commander');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
32
|
+
|
|
33
|
+
// src/cli/env.ts
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function readEnvFile(cwd = process.cwd()) {
|
|
37
|
+
const envPath = _path2.default.join(cwd, ".env");
|
|
38
|
+
if (!_fs2.default.existsSync(envPath)) return {};
|
|
39
|
+
const vars = {};
|
|
40
|
+
for (const line of _fs2.default.readFileSync(envPath, "utf8").split("\n")) {
|
|
41
|
+
const trimmed = line.trim();
|
|
42
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
43
|
+
const eq = trimmed.indexOf("=");
|
|
44
|
+
if (eq === -1) continue;
|
|
45
|
+
const key = trimmed.slice(0, eq).trim();
|
|
46
|
+
const raw = trimmed.slice(eq + 1).trim();
|
|
47
|
+
vars[key] = raw.replace(/^(['"])(.*)\1$/, "$2");
|
|
48
|
+
}
|
|
49
|
+
return vars;
|
|
50
|
+
}
|
|
51
|
+
function envVar(key, cwd = process.cwd()) {
|
|
52
|
+
return process.env[key] || readEnvFile(cwd)[key] || void 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/cli/commands/start.ts
|
|
32
56
|
function startCommand() {
|
|
33
57
|
const cmd = new (0, _commander.Command)("start");
|
|
34
58
|
cmd.argument("<mode>", "dev | prod").description("Start the EFC server").action((mode) => {
|
|
@@ -145,7 +169,7 @@ function startProd() {
|
|
|
145
169
|
console.log(_picocolors2.default.cyan("[EFC] Starting production server\u2026"));
|
|
146
170
|
const child = _child_process.spawn.call(void 0, "node", [distEntry], {
|
|
147
171
|
stdio: "inherit",
|
|
148
|
-
env: { ...process.env, NODE_ENV: "production" }
|
|
172
|
+
env: { ...readEnvFile(cwd), ...process.env, NODE_ENV: "production" }
|
|
149
173
|
});
|
|
150
174
|
forwardSignals(child);
|
|
151
175
|
}
|
|
@@ -466,28 +490,6 @@ export default async function seed(${ctx}) {
|
|
|
466
490
|
|
|
467
491
|
|
|
468
492
|
|
|
469
|
-
// src/cli/env.ts
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
function readEnvFile(cwd = process.cwd()) {
|
|
473
|
-
const envPath = _path2.default.join(cwd, ".env");
|
|
474
|
-
if (!_fs2.default.existsSync(envPath)) return {};
|
|
475
|
-
const vars = {};
|
|
476
|
-
for (const line of _fs2.default.readFileSync(envPath, "utf8").split("\n")) {
|
|
477
|
-
const trimmed = line.trim();
|
|
478
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
479
|
-
const eq = trimmed.indexOf("=");
|
|
480
|
-
if (eq === -1) continue;
|
|
481
|
-
const key = trimmed.slice(0, eq).trim();
|
|
482
|
-
const raw = trimmed.slice(eq + 1).trim();
|
|
483
|
-
vars[key] = raw.replace(/^(['"])(.*)\1$/, "$2");
|
|
484
|
-
}
|
|
485
|
-
return vars;
|
|
486
|
-
}
|
|
487
|
-
function envVar(key, cwd = process.cwd()) {
|
|
488
|
-
return process.env[key] || readEnvFile(cwd)[key] || void 0;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
493
|
// src/cli/commands/task-admin.ts
|
|
492
494
|
|
|
493
495
|
|