@piserve-tech/octa-form-submission-webcomponent 1.0.24 → 1.0.26

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/copy-assets.js ADDED
@@ -0,0 +1,47 @@
1
+ // Script to copy assets for web component distribution
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ function copyRecursiveSync(src, dest) {
6
+ if (!fs.existsSync(src)) return;
7
+ const stats = fs.statSync(src);
8
+ if (stats.isDirectory()) {
9
+ if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
10
+ fs.readdirSync(src).forEach(child => {
11
+ copyRecursiveSync(path.join(src, child), path.join(dest, child));
12
+ });
13
+ } else {
14
+ fs.copyFileSync(src, dest);
15
+ }
16
+ }
17
+
18
+
19
+ // Determine source: local dist or node_modules
20
+ let srcAssets, srcBundleJs, srcBundleCss;
21
+ if (fs.existsSync(path.join(__dirname, 'dist', 'assets'))) {
22
+ srcAssets = path.join(__dirname, 'dist', 'assets');
23
+ srcBundleJs = path.join(__dirname, 'dist', 'bundle.js');
24
+ srcBundleCss = path.join(__dirname, 'dist', 'bundle.css');
25
+ } else {
26
+ srcAssets = path.join(__dirname, 'node_modules', '@piserve-tech', 'octa-form-submission-webcomponent', 'dist', 'assets');
27
+ srcBundleJs = path.join(__dirname, 'node_modules', '@piserve-tech', 'octa-form-submission-webcomponent', 'dist', 'bundle.js');
28
+ srcBundleCss = path.join(__dirname, 'node_modules', '@piserve-tech', 'octa-form-submission-webcomponent', 'dist', 'bundle.css');
29
+ }
30
+ const destAssets = path.join(process.cwd(), 'src', 'assets', 'octa-form-submission-webcomponent');
31
+
32
+ copyRecursiveSync(srcAssets, destAssets);
33
+
34
+ // Also copy bundle.js and bundle.css
35
+ const destBundleJs = path.join(destAssets, 'bundle.js');
36
+ const destBundleCss = path.join(destAssets, 'bundle.css');
37
+
38
+ if (fs.existsSync(srcBundleJs)) {
39
+ fs.copyFileSync(srcBundleJs, destBundleJs);
40
+ console.log('bundle.js copied to src/assets/octa-form-submission-webcomponent');
41
+ }
42
+ if (fs.existsSync(srcBundleCss)) {
43
+ fs.copyFileSync(srcBundleCss, destBundleCss);
44
+ console.log('bundle.css copied to src/assets/octa-form-submission-webcomponent');
45
+ }
46
+
47
+ console.log('Assets and bundles copied to src/assets/octa-form-submission-webcomponent');