@marvalt/digivalt-core 0.1.3 → 0.1.5
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/package.json
CHANGED
|
@@ -52,10 +52,12 @@ fs.writeFileSync(tmpJsonPath, JSON.stringify(secrets, null, 2));
|
|
|
52
52
|
try {
|
|
53
53
|
console.log(`🚀 Uploading ${secretCount} secrets to Cloudflare Pages...`);
|
|
54
54
|
|
|
55
|
-
//
|
|
55
|
+
// Extract Cloudflare Account ID directly from the parsed environment variables!
|
|
56
|
+
const accountId = secrets['CLOUDFLARE_ACCOUNT_ID'] || secrets['VITE_CLOUDFLARE_ACCOUNT_ID'] || '';
|
|
57
|
+
|
|
58
|
+
// Try to read the Cloudflare project name from wrangler.toml
|
|
56
59
|
const tomlPath = path.resolve(process.cwd(), 'wrangler.toml');
|
|
57
60
|
let projectName = '';
|
|
58
|
-
let accountId = '';
|
|
59
61
|
|
|
60
62
|
if (fs.existsSync(tomlPath)) {
|
|
61
63
|
const tomlContent = fs.readFileSync(tomlPath, 'utf8');
|
|
@@ -64,10 +66,6 @@ try {
|
|
|
64
66
|
const nameMatch = tomlContent.match(/^name\s*=\s*"([^"]+)"/m);
|
|
65
67
|
if (nameMatch) projectName = nameMatch[1];
|
|
66
68
|
|
|
67
|
-
// Parse Account ID
|
|
68
|
-
const accountMatch = tomlContent.match(/^account_id\s*=\s*"([^"]+)"/m);
|
|
69
|
-
if (accountMatch) accountId = accountMatch[1];
|
|
70
|
-
|
|
71
69
|
if (projectName) console.log(`📦 Targeted Cloudflare Project: ${projectName}`);
|
|
72
70
|
if (accountId) console.log(`🏢 Targeted Cloudflare Account: ${accountId}`);
|
|
73
71
|
}
|
|
@@ -75,10 +73,14 @@ try {
|
|
|
75
73
|
// Construct the command string tightly bound to the exact workspace
|
|
76
74
|
let cmd = `npx wrangler pages secret bulk .tmp-cloudflare-secrets.json`;
|
|
77
75
|
if (projectName) cmd += ` --project-name ${projectName}`;
|
|
78
|
-
if (accountId) cmd += ` --account-id ${accountId}`;
|
|
79
76
|
|
|
80
|
-
// Execute Wrangler natively
|
|
81
|
-
|
|
77
|
+
// Execute Wrangler natively with the Account ID passed through the strict environment scope
|
|
78
|
+
const env = { ...process.env };
|
|
79
|
+
if (accountId) {
|
|
80
|
+
env.CLOUDFLARE_ACCOUNT_ID = accountId;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
execSync(cmd, { stdio: 'inherit', env });
|
|
82
84
|
console.log("✅ All secrets deployed successfully to Cloudflare!");
|
|
83
85
|
|
|
84
86
|
} catch (error) {
|