generated from canopy-iiif/canopy-iiif
-
Notifications
You must be signed in to change notification settings - Fork 0
/
canopy.ts
32 lines (26 loc) · 773 Bytes
/
canopy.ts
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
require("dotenv").config();
const buildConfig = require("./src/lib/build/config");
const aggregate = require("./src/lib/build/aggregate");
const args = process.argv;
(() => {
const path = args
.find((value) => value.includes("--path="))
?.split("=")
?.pop();
const isDev = args.includes("dev");
const config = buildConfig.getConfig(path, isDev);
const url = isDev ? `http://localhost:5001` : process.env.NEXT_PUBLIC_URL;
const basePath = isDev ? `` : process.env.NEXT_PUBLIC_BASE_PATH;
const baseUrl = basePath ? `${url}${basePath}` : url;
const assetPrefix = basePath;
const env = {
CANOPY_CONFIG: {
...config,
url,
assetPrefix,
basePath,
baseUrl,
},
};
aggregate.build(env.CANOPY_CONFIG);
})();