clefbase 2.0.9 → 2.1.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/dist/cli-src/cli/commands/init.js +13 -1
- package/dist/cli.js +14 -2
- package/package.json +1 -1
|
@@ -665,11 +665,17 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
665
665
|
|
|
666
666
|
// ── Load .env ─────────────────────────────────────────────────────────────────
|
|
667
667
|
|
|
668
|
+
const envVars = {};
|
|
668
669
|
const envPath = join(__dirname, ".env");
|
|
669
670
|
if (existsSync(envPath)) {
|
|
670
671
|
for (const line of readFileSync(envPath, "utf8").split("\\n")) {
|
|
671
672
|
const match = line.match(/^\\s*([^#][^=]*)=(.*)$/);
|
|
672
|
-
if (match)
|
|
673
|
+
if (match) {
|
|
674
|
+
const key = match[1].trim();
|
|
675
|
+
const value = match[2].trim();
|
|
676
|
+
envVars[key] = value;
|
|
677
|
+
process.env[key] = value;
|
|
678
|
+
}
|
|
673
679
|
}
|
|
674
680
|
}
|
|
675
681
|
|
|
@@ -683,6 +689,11 @@ let passed = 0;
|
|
|
683
689
|
let failed = 0;
|
|
684
690
|
|
|
685
691
|
for (const fn of functions) {
|
|
692
|
+
// Build environment variable flags
|
|
693
|
+
const envFlags = Object.entries(envVars)
|
|
694
|
+
.map(([k, v]) => \`--env \${k}=\${v}\`)
|
|
695
|
+
.join(" ");
|
|
696
|
+
|
|
686
697
|
const args = [
|
|
687
698
|
\`--name \${fn.name}\`,
|
|
688
699
|
\`--file \${fn.file}\`,
|
|
@@ -690,6 +701,7 @@ for (const fn of functions) {
|
|
|
690
701
|
\`--trigger \${fn.trigger}\`,
|
|
691
702
|
fn.cron ? \`--cron "\${fn.cron}"\` : "",
|
|
692
703
|
fn.collection ? \`--collection "\${fn.collection}"\` : "",
|
|
704
|
+
envFlags,
|
|
693
705
|
].filter(Boolean).join(" ");
|
|
694
706
|
|
|
695
707
|
console.log(\`\\n→ Deploying "\${fn.name}"…\`);
|
package/dist/cli.js
CHANGED
|
@@ -34500,11 +34500,17 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
34500
34500
|
|
|
34501
34501
|
// \u2500\u2500 Load .env \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
34502
34502
|
|
|
34503
|
+
const envVars = {};
|
|
34503
34504
|
const envPath = join(__dirname, ".env");
|
|
34504
34505
|
if (existsSync(envPath)) {
|
|
34505
34506
|
for (const line of readFileSync(envPath, "utf8").split("\\n")) {
|
|
34506
34507
|
const match = line.match(/^\\s*([^#][^=]*)=(.*)$/);
|
|
34507
|
-
if (match)
|
|
34508
|
+
if (match) {
|
|
34509
|
+
const key = match[1].trim();
|
|
34510
|
+
const value = match[2].trim();
|
|
34511
|
+
envVars[key] = value;
|
|
34512
|
+
process.env[key] = value;
|
|
34513
|
+
}
|
|
34508
34514
|
}
|
|
34509
34515
|
}
|
|
34510
34516
|
|
|
@@ -34518,6 +34524,11 @@ let passed = 0;
|
|
|
34518
34524
|
let failed = 0;
|
|
34519
34525
|
|
|
34520
34526
|
for (const fn of functions) {
|
|
34527
|
+
// Build environment variable flags
|
|
34528
|
+
const envFlags = Object.entries(envVars)
|
|
34529
|
+
.map(([k, v]) => \`--env \${k}=\${v}\`)
|
|
34530
|
+
.join(" ");
|
|
34531
|
+
|
|
34521
34532
|
const args = [
|
|
34522
34533
|
\`--name \${fn.name}\`,
|
|
34523
34534
|
\`--file \${fn.file}\`,
|
|
@@ -34525,6 +34536,7 @@ for (const fn of functions) {
|
|
|
34525
34536
|
\`--trigger \${fn.trigger}\`,
|
|
34526
34537
|
fn.cron ? \`--cron "\${fn.cron}"\` : "",
|
|
34527
34538
|
fn.collection ? \`--collection "\${fn.collection}"\` : "",
|
|
34539
|
+
envFlags,
|
|
34528
34540
|
].filter(Boolean).join(" ");
|
|
34529
34541
|
|
|
34530
34542
|
console.log(\`\\n\u2192 Deploying "\${fn.name}"\u2026\`);
|
|
@@ -35578,7 +35590,7 @@ async function promptRequired(message) {
|
|
|
35578
35590
|
}
|
|
35579
35591
|
|
|
35580
35592
|
// package.json
|
|
35581
|
-
var version = "2.0
|
|
35593
|
+
var version = "2.1.0";
|
|
35582
35594
|
|
|
35583
35595
|
// src/cli/index.ts
|
|
35584
35596
|
var program2 = new Command();
|