@marvalt/digivalt-core 0.1.2 → 0.1.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/package.json
CHANGED
|
@@ -52,22 +52,30 @@ fs.writeFileSync(tmpJsonPath, JSON.stringify(secrets, null, 2));
|
|
|
52
52
|
try {
|
|
53
53
|
console.log(`🚀 Uploading ${secretCount} secrets to Cloudflare Pages...`);
|
|
54
54
|
|
|
55
|
-
// Try to read the Cloudflare project name from wrangler.toml
|
|
55
|
+
// Try to read the Cloudflare project name and account ID from wrangler.toml
|
|
56
56
|
const tomlPath = path.resolve(process.cwd(), 'wrangler.toml');
|
|
57
57
|
let projectName = '';
|
|
58
|
+
let accountId = '';
|
|
58
59
|
|
|
59
60
|
if (fs.existsSync(tomlPath)) {
|
|
60
61
|
const tomlContent = fs.readFileSync(tomlPath, 'utf8');
|
|
62
|
+
|
|
63
|
+
// Parse Project Name
|
|
61
64
|
const nameMatch = tomlContent.match(/^name\s*=\s*"([^"]+)"/m);
|
|
62
|
-
if (nameMatch)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
if (nameMatch) projectName = nameMatch[1];
|
|
66
|
+
|
|
67
|
+
// Parse Account ID
|
|
68
|
+
const accountMatch = tomlContent.match(/^account_id\s*=\s*"([^"]+)"/m);
|
|
69
|
+
if (accountMatch) accountId = accountMatch[1];
|
|
70
|
+
|
|
71
|
+
if (projectName) console.log(`📦 Targeted Cloudflare Project: ${projectName}`);
|
|
72
|
+
if (accountId) console.log(`🏢 Targeted Cloudflare Account: ${accountId}`);
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
// Construct the command string tightly bound to the exact workspace
|
|
76
|
+
let cmd = `npx wrangler pages secret bulk .tmp-cloudflare-secrets.json`;
|
|
77
|
+
if (projectName) cmd += ` --project-name ${projectName}`;
|
|
78
|
+
if (accountId) cmd += ` --account-id ${accountId}`;
|
|
71
79
|
|
|
72
80
|
// Execute Wrangler natively
|
|
73
81
|
execSync(cmd, { stdio: 'inherit' });
|