Repository navigation
Expand file tree
/
Copy pathbuild.js
More file actions
70 lines (62 loc) · 1.97 KB
/
Copy pathbuild.js
File metadata and controls
70 lines (62 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");
const { version } = require("./package.json");
// Output directories
const distCoreDir = path.join(__dirname, "dist/core");
const distConsentDir = path.join(__dirname, "dist/consent-adapters");
fs.mkdirSync(distCoreDir, { recursive: true });
fs.mkdirSync(distConsentDir, { recursive: true });
// Banners
const coreBanner = `/* ViaBill Helper Core | vb-helper v${version} */`;
const shopifyAdapterBanner =
`/* ViaBill Helper – Consent Adapter (Shopify) | vb-helper v${version} */`;
// --------------------
// CORE – modern build
// --------------------
execSync(
`npx esbuild src/core/index.js \
--minify \
--global-name=vbHelper \
--outdir=dist/core \
--entry-names=vb-helper.min \
--banner:js="${coreBanner}"`,
{ stdio: "inherit" }
);
// --------------------
// CORE – ES2015 build
// --------------------
execSync(
`npx esbuild src/core/index.js \
--minify \
--target=es2015 \
--global-name=vbHelper \
--outdir=dist/core \
--entry-names=vb-helper.min.es2015 \
--banner:js="${coreBanner}"`,
{ stdio: "inherit" }
);
// ---------------------------------------
// SHOPIFY CONSENT ADAPTER – modern build
// ---------------------------------------
execSync(
`npx esbuild src/consent-adapters/shopify-consent-adapter.js \
--minify \
--outdir=dist/consent-adapters \
--entry-names=shopify-consent-adapter.min \
--banner:js="${shopifyAdapterBanner}"`,
{ stdio: "inherit" }
);
// ---------------------------------------
// SHOPIFY CONSENT ADAPTER – ES2015 build
// ---------------------------------------
execSync(
`npx esbuild src/consent-adapters/shopify-consent-adapter.js \
--minify \
--target=es2015 \
--outdir=dist/consent-adapters \
--entry-names=shopify-consent-adapter.min.es2015 \
--banner:js="${shopifyAdapterBanner}"`,
{ stdio: "inherit" }
);
console.log("✔ ViaBill helper build complete");