@marvalt/digivalt-core 0.1.0 ā 0.1.2
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/bin/init.cjs +43 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +4 -0
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -2
- package/template/.dev.vars.example +11 -0
- package/template/functions/api/fetch-with-access.ts +41 -0
- package/template/functions/api/gravity-forms-submit.ts +291 -0
- package/template/functions/api/mautic-submit.ts +19 -0
- package/template/functions/api/webhook.js +78 -0
- package/template/scripts/deploy-secrets.js +85 -0
- package/template/wrangler.toml +3 -0
package/bin/init.cjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const sourceDir = path.join(__dirname, '..', 'template');
|
|
7
|
+
const targetDir = process.cwd();
|
|
8
|
+
|
|
9
|
+
console.log('š Initializing DigiVAlt Cloudflare Proxy Templates...');
|
|
10
|
+
|
|
11
|
+
function copyRecursiveSync(src, dest) {
|
|
12
|
+
const exists = fs.existsSync(src);
|
|
13
|
+
const stats = exists && fs.statSync(src);
|
|
14
|
+
const isDirectory = exists && stats.isDirectory();
|
|
15
|
+
|
|
16
|
+
if (isDirectory) {
|
|
17
|
+
if (!fs.existsSync(dest)) fs.mkdirSync(dest);
|
|
18
|
+
fs.readdirSync(src).forEach((childItemName) => {
|
|
19
|
+
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
// We only copy if it doesn't already exist to prevent overwriting user changes!
|
|
23
|
+
if (fs.existsSync(dest)) {
|
|
24
|
+
console.log(`ā ļø Skipping ${dest.replace(targetDir, '')} (Already exists)`);
|
|
25
|
+
} else {
|
|
26
|
+
fs.copyFileSync(src, dest);
|
|
27
|
+
console.log(`ā
Copied ${dest.replace(targetDir, '')}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
copyRecursiveSync(sourceDir, targetDir);
|
|
34
|
+
console.log('\nš DigiVAlt Cloudflare proxy routes installed successfully!');
|
|
35
|
+
console.log('š Next Steps:');
|
|
36
|
+
console.log('1. Copy .dev.vars.example to .dev.vars and add your API keys.');
|
|
37
|
+
console.log("2. Sync your production credentials to Cloudflare by running:");
|
|
38
|
+
console.log(" š node scripts/deploy-secrets.js");
|
|
39
|
+
console.log("3. Run `npx wrangler pages dev` to test your proxy functions locally.");
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('ā Failed to construct templates:', error);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -2497,6 +2497,10 @@ async function generateAllData() {
|
|
|
2497
2497
|
dotenv.config();
|
|
2498
2498
|
dotenv.config({ path: '.env.local' });
|
|
2499
2499
|
console.log('š Starting DigiVAlt static data generation...');
|
|
2500
|
+
if (process.env.VITE_IS_LOVABLE === 'true') {
|
|
2501
|
+
console.log('ā” Lovable Environment Detected (VITE_IS_LOVABLE). Skipping static data generation to use GitHub synced static files.');
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2500
2504
|
const wpSuccess = await generateWordPressData();
|
|
2501
2505
|
const gfSuccess = await generateGravityFormsData();
|
|
2502
2506
|
const mauticSuccess = await generateMauticData();
|