@marvalt/digivalt-core 0.1.2 → 0.1.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marvalt/digivalt-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Core glue logic and shared context for DigiVAlt frontend applications",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "main": "dist/index.cjs",
@@ -52,22 +52,28 @@ fs.writeFileSync(tmpJsonPath, JSON.stringify(secrets, null, 2));
52
52
  try {
53
53
  console.log(`🚀 Uploading ${secretCount} secrets to Cloudflare Pages...`);
54
54
 
55
+ // Extract Cloudflare Account ID directly from the parsed environment variables!
56
+ const accountId = secrets['CLOUDFLARE_ACCOUNT_ID'] || secrets['VITE_CLOUDFLARE_ACCOUNT_ID'] || '';
57
+
55
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
61
 
59
62
  if (fs.existsSync(tomlPath)) {
60
63
  const tomlContent = fs.readFileSync(tomlPath, 'utf8');
64
+
65
+ // Parse Project Name
61
66
  const nameMatch = tomlContent.match(/^name\s*=\s*"([^"]+)"/m);
62
- if (nameMatch) {
63
- projectName = nameMatch[1];
64
- console.log(`📦 Targeted Cloudflare Project: ${projectName}`);
65
- }
67
+ if (nameMatch) projectName = nameMatch[1];
68
+
69
+ if (projectName) console.log(`📦 Targeted Cloudflare Project: ${projectName}`);
70
+ if (accountId) console.log(`🏢 Targeted Cloudflare Account: ${accountId}`);
66
71
  }
67
72
 
68
- const cmd = projectName
69
- ? `npx wrangler pages secret bulk .tmp-cloudflare-secrets.json --project-name ${projectName}`
70
- : `npx wrangler pages secret bulk .tmp-cloudflare-secrets.json`;
73
+ // Construct the command string tightly bound to the exact workspace
74
+ let cmd = `npx wrangler pages secret bulk .tmp-cloudflare-secrets.json`;
75
+ if (projectName) cmd += ` --project-name ${projectName}`;
76
+ if (accountId) cmd += ` --account-id ${accountId}`;
71
77
 
72
78
  // Execute Wrangler natively
73
79
  execSync(cmd, { stdio: 'inherit' });