@raisenow/tamaro-cli 1.0.13 → 1.0.16
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/dist/{chunk-OXDXJ5B5.js → chunk-BWJBN44Y.js} +10 -8
- package/dist/cli.js +54 -55
- package/dist/webpack.config.js +9 -3
- package/package.json +29 -29
- package/src/commands/build.ts +3 -3
- package/src/commands/deploy-email-config.ts +6 -6
- package/src/commands/deploy.ts +12 -11
- package/src/commands/dev.ts +3 -3
- package/src/commands/list-deployed.ts +3 -3
- package/src/commands/serve.ts +2 -2
- package/src/lib/InterpolateHtmlPlugin.ts +3 -1
- package/src/lib/aws.ts +3 -3
- package/src/lib/command.ts +2 -2
- package/src/lib/env.ts +5 -3
- package/src/webpack.config.ts +4 -1
|
@@ -136,9 +136,9 @@ import stripIndent3 from "strip-indent";
|
|
|
136
136
|
|
|
137
137
|
// src/lib/command.ts
|
|
138
138
|
import { execaCommandSync } from "execa";
|
|
139
|
-
var
|
|
139
|
+
var halt = (message, exitCode = 1) => {
|
|
140
140
|
logError(message);
|
|
141
|
-
process.exit(
|
|
141
|
+
process.exit(exitCode);
|
|
142
142
|
};
|
|
143
143
|
var prepareCommand = (cmd) => {
|
|
144
144
|
return cmd.replace(/\n/gm, " ").replace(/[ \t]{2,}/gm, " ").trim();
|
|
@@ -150,7 +150,7 @@ var runCommandSync = (cmd, options) => {
|
|
|
150
150
|
// src/lib/env.ts
|
|
151
151
|
var require3 = createRequire2(import.meta.url);
|
|
152
152
|
var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
153
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
154
154
|
const filePath = files.find((file) => basename2(file) === ".env");
|
|
155
155
|
dotenvExpand(dotenvConfig({ path: filePath }));
|
|
156
156
|
(_b = (_a = process.env).NODE_ENV) != null ? _b : _a.NODE_ENV = ifMin("production", "development");
|
|
@@ -159,7 +159,8 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
|
159
159
|
(_h = (_g = process.env).ELEMENT_ATTRIBUTE_DATA_WIDGET) != null ? _h : _g.ELEMENT_ATTRIBUTE_DATA_WIDGET = ifCore("rnw-tamaro-core", "rnw-tamaro");
|
|
160
160
|
(_j = (_i = process.env).WEBPACK_UNIQUE_NAME) != null ? _j : _i.WEBPACK_UNIQUE_NAME = ifCore("RnwTamaroCore", "RnwTamaro");
|
|
161
161
|
process.env.BUILD_DATE = new Date().toISOString();
|
|
162
|
-
(_l = (_k = process.env).
|
|
162
|
+
(_l = (_k = process.env).PUBLIC_URL) != null ? _l : _k.PUBLIC_URL = "";
|
|
163
|
+
(_n = (_m = process.env).HMR_ENABLED) != null ? _n : _m.HMR_ENABLED = ifMin("false", "true");
|
|
163
164
|
if (ifCore()) {
|
|
164
165
|
process.env.PRODUCT_NAME = "tamaro";
|
|
165
166
|
const corePkgPath = resolveApp("package.json");
|
|
@@ -173,7 +174,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
|
173
174
|
} else {
|
|
174
175
|
let version = process.env.CORE_VERSION;
|
|
175
176
|
version = version ? `@${version}` : "";
|
|
176
|
-
(
|
|
177
|
+
(_p = (_o = process.env).CORE_URL) != null ? _p : _o.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`;
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
const varNames = [
|
|
@@ -183,6 +184,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
|
183
184
|
"ELEMENT_ATTRIBUTE_DATA_WIDGET",
|
|
184
185
|
"WEBPACK_UNIQUE_NAME",
|
|
185
186
|
"BUILD_DATE",
|
|
187
|
+
"PUBLIC_URL",
|
|
186
188
|
"PRODUCT_NAME",
|
|
187
189
|
"PRODUCT_VERSION",
|
|
188
190
|
"WIDGET_UUID",
|
|
@@ -214,10 +216,10 @@ var assertEnvValid = (env) => {
|
|
|
214
216
|
}
|
|
215
217
|
if (envs.length !== 0) {
|
|
216
218
|
if (!env) {
|
|
217
|
-
|
|
219
|
+
halt("Flag \u201C--env\u201D is required.");
|
|
218
220
|
}
|
|
219
221
|
if (!envs.includes(env)) {
|
|
220
|
-
|
|
222
|
+
halt(stripIndent3(`
|
|
221
223
|
Flag \u201C--env\u201D has wrong value.
|
|
222
224
|
Available values are: ${envs.map((v) => `\u201C${v}\u201D`).join(", ")}.
|
|
223
225
|
`));
|
|
@@ -242,7 +244,7 @@ export {
|
|
|
242
244
|
getPaths,
|
|
243
245
|
getRelativePaths,
|
|
244
246
|
getIfCoreFns,
|
|
245
|
-
|
|
247
|
+
halt,
|
|
246
248
|
runCommandSync,
|
|
247
249
|
getEnvVars,
|
|
248
250
|
assertEnvValid
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
assertEnvValid,
|
|
4
|
-
fail,
|
|
5
4
|
getIfCoreFns,
|
|
6
5
|
getPaths,
|
|
7
6
|
getWidgetUuid,
|
|
7
|
+
halt,
|
|
8
8
|
logCommand,
|
|
9
9
|
logDataTable,
|
|
10
10
|
logError,
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
resolveBin,
|
|
13
13
|
resolveOwn,
|
|
14
14
|
runCommandSync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BWJBN44Y.js";
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
18
18
|
import { createCommand } from "commander";
|
|
19
19
|
|
|
20
20
|
// package.json
|
|
21
21
|
var name = "@raisenow/tamaro-cli";
|
|
22
|
-
var version = "1.0.
|
|
22
|
+
var version = "1.0.16";
|
|
23
23
|
var author = {
|
|
24
24
|
name: "RaiseNow",
|
|
25
25
|
email: "development@raisenow.com"
|
|
@@ -39,48 +39,48 @@ var engines = {
|
|
|
39
39
|
npm: ">=8"
|
|
40
40
|
};
|
|
41
41
|
var dependencies = {
|
|
42
|
-
"@babel/cli": "^7.17.
|
|
43
|
-
"@babel/core": "^7.17.
|
|
44
|
-
"@babel/plugin-proposal-decorators": "^7.17.
|
|
42
|
+
"@babel/cli": "^7.17.10",
|
|
43
|
+
"@babel/core": "^7.17.10",
|
|
44
|
+
"@babel/plugin-proposal-decorators": "^7.17.9",
|
|
45
45
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
46
|
-
"@babel/plugin-transform-runtime": "^7.17.
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
46
|
+
"@babel/plugin-transform-runtime": "^7.17.10",
|
|
47
|
+
"@babel/preset-env": "^7.17.10",
|
|
48
48
|
"@babel/preset-react": "^7.16.7",
|
|
49
49
|
"@babel/preset-typescript": "^7.16.7",
|
|
50
|
-
"@babel/runtime-corejs3": "^7.17.
|
|
51
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.
|
|
50
|
+
"@babel/runtime-corejs3": "^7.17.9",
|
|
51
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
|
52
52
|
"@statoscope/webpack-plugin": "^5.20.1",
|
|
53
53
|
"@types/columnify": "^1.5.1",
|
|
54
|
-
"@types/lodash": "^4.14.
|
|
55
|
-
"@types/node": "^17.0.
|
|
54
|
+
"@types/lodash": "^4.14.182",
|
|
55
|
+
"@types/node": "^17.0.31",
|
|
56
56
|
"@types/node-notifier": "^8.0.2",
|
|
57
57
|
"@types/resolve-bin": "^0.4.1",
|
|
58
58
|
"@types/webpack-config-utils": "^2.3.1",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
60
|
-
"@typescript-eslint/parser": "^5.
|
|
61
|
-
autoprefixer: "^10.4.
|
|
62
|
-
"babel-loader": "^8.2.
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
60
|
+
"@typescript-eslint/parser": "^5.22.0",
|
|
61
|
+
autoprefixer: "^10.4.7",
|
|
62
|
+
"babel-loader": "^8.2.5",
|
|
63
63
|
"babel-plugin-lodash": "^3.3.4",
|
|
64
64
|
chalk: "^5.0.1",
|
|
65
65
|
"clean-webpack-plugin": "^4.0.0",
|
|
66
66
|
columnify: "^1.6.0",
|
|
67
|
-
commander: "^9.
|
|
67
|
+
commander: "^9.2.0",
|
|
68
68
|
"copy-webpack-plugin": "^10.2.4",
|
|
69
|
-
"core-js": "^3.
|
|
69
|
+
"core-js": "^3.22.4",
|
|
70
70
|
"css-loader": "^6.7.1",
|
|
71
71
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
72
72
|
dotenv: "^16.0.0",
|
|
73
73
|
"dotenv-expand": "^8.0.3",
|
|
74
74
|
"escape-string-regexp": "^5.0.0",
|
|
75
|
-
eslint: "^8.
|
|
75
|
+
eslint: "^8.14.0",
|
|
76
76
|
"eslint-config-prettier": "^8.5.0",
|
|
77
77
|
"eslint-plugin-node": "^11.1.0",
|
|
78
78
|
"eslint-plugin-promise": "^6.0.0",
|
|
79
79
|
"eslint-webpack-plugin": "^3.1.1",
|
|
80
80
|
execa: "^6.1.0",
|
|
81
81
|
"file-loader": "^6.2.0",
|
|
82
|
-
"fork-ts-checker-webpack-plugin": "^7.2.
|
|
83
|
-
glob: "^
|
|
82
|
+
"fork-ts-checker-webpack-plugin": "^7.2.11",
|
|
83
|
+
glob: "^8.0.1",
|
|
84
84
|
"html-loader": "^3.1.0",
|
|
85
85
|
"html-webpack-plugin": "^5.5.0",
|
|
86
86
|
"json-loader": "^0.5.7",
|
|
@@ -88,26 +88,26 @@ var dependencies = {
|
|
|
88
88
|
"mini-css-extract-plugin": "^2.6.0",
|
|
89
89
|
"node-notifier": "^10.0.1",
|
|
90
90
|
portfinder: "^1.0.28",
|
|
91
|
-
postcss: "^8.4.
|
|
92
|
-
"postcss-custom-properties": "^12.1.
|
|
91
|
+
postcss: "^8.4.13",
|
|
92
|
+
"postcss-custom-properties": "^12.1.7",
|
|
93
93
|
"postcss-loader": "^6.2.1",
|
|
94
|
-
prettier: "^2.6.
|
|
95
|
-
"react-refresh": "^0.
|
|
94
|
+
prettier: "^2.6.2",
|
|
95
|
+
"react-refresh": "^0.13.0",
|
|
96
96
|
"resolve-url-loader": "^5.0.0",
|
|
97
|
-
sass: "^1.
|
|
97
|
+
sass: "^1.51.0",
|
|
98
98
|
"sass-loader": "^12.6.0",
|
|
99
99
|
"source-map-loader": "^3.0.1",
|
|
100
100
|
"strip-indent": "^4.0.0",
|
|
101
101
|
"style-loader": "^3.3.1",
|
|
102
102
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
103
|
-
tsup: "^5.12.
|
|
104
|
-
typescript: "^4.6.
|
|
103
|
+
tsup: "^5.12.6",
|
|
104
|
+
typescript: "^4.6.4",
|
|
105
105
|
"url-loader": "^4.1.1",
|
|
106
|
-
webpack: "^5.
|
|
106
|
+
webpack: "^5.72.0",
|
|
107
107
|
"webpack-cli": "^4.9.2",
|
|
108
108
|
"webpack-config-utils": "^2.3.1",
|
|
109
|
-
"webpack-dev-server": "^4.
|
|
110
|
-
"yaml-loader": "^0.
|
|
109
|
+
"webpack-dev-server": "^4.8.1",
|
|
110
|
+
"yaml-loader": "^0.8.0"
|
|
111
111
|
};
|
|
112
112
|
var package_default = {
|
|
113
113
|
name,
|
|
@@ -151,10 +151,10 @@ var assertOptionsValid = (options) => {
|
|
|
151
151
|
const { localCore, port, env } = options;
|
|
152
152
|
const { ifCore } = getIfCoreFns();
|
|
153
153
|
if (ifCore() && localCore) {
|
|
154
|
-
|
|
154
|
+
halt("Flag \u201C--local-core\u201D is redundant if running in Tamaro Core context.");
|
|
155
155
|
}
|
|
156
156
|
if (isNaN(Number(port))) {
|
|
157
|
-
|
|
157
|
+
halt("Flag \u201C--port\u201D should be a number.");
|
|
158
158
|
}
|
|
159
159
|
assertEnvValid(env);
|
|
160
160
|
};
|
|
@@ -211,7 +211,7 @@ var assertProfileValid = (profile) => {
|
|
|
211
211
|
Check the wiki for more information:
|
|
212
212
|
https://raisenow.atlassian.net/wiki/x/lIrWvg
|
|
213
213
|
`);
|
|
214
|
-
|
|
214
|
+
halt(message);
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
var getAvailableProfiles = () => {
|
|
@@ -228,7 +228,7 @@ var login = (options) => {
|
|
|
228
228
|
execaCommandSync(`aws sso login ${flags}`, { stdio: "inherit" });
|
|
229
229
|
console.log("");
|
|
230
230
|
} catch (error) {
|
|
231
|
-
|
|
231
|
+
halt("Login failed.");
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
var prepareFlags2 = (flags, options) => {
|
|
@@ -286,10 +286,10 @@ var assertOptionsValid2 = (options) => {
|
|
|
286
286
|
const { localCore, deploy: deploy2, profile, env } = options;
|
|
287
287
|
const { ifCore } = getIfCoreFns();
|
|
288
288
|
if (ifCore() && localCore) {
|
|
289
|
-
|
|
289
|
+
halt("Flag \u201C--local-core\u201D is redundant if running in Tamaro Core context.");
|
|
290
290
|
}
|
|
291
291
|
if (localCore && deploy2) {
|
|
292
|
-
|
|
292
|
+
halt("Flags \u201C--local-core\u201D and \u201C--deploy\u201D must not be used together.");
|
|
293
293
|
}
|
|
294
294
|
assertProfileValid(profile);
|
|
295
295
|
assertEnvValid(env);
|
|
@@ -307,6 +307,7 @@ var prepareFlags3 = (flags, options) => {
|
|
|
307
307
|
|
|
308
308
|
// src/commands/deploy.ts
|
|
309
309
|
import { existsSync } from "fs";
|
|
310
|
+
import stripIndent3 from "strip-indent";
|
|
310
311
|
var deploy = async (options) => {
|
|
311
312
|
const { ifCore } = getIfCoreFns();
|
|
312
313
|
const paths = getPaths(ifCore);
|
|
@@ -319,7 +320,6 @@ var deploy = async (options) => {
|
|
|
319
320
|
const entryFilename = ifCore("index.js", "widget.js");
|
|
320
321
|
const cmdSyncAll = `
|
|
321
322
|
aws s3 sync ${paths.appDist} ${deployUrl}
|
|
322
|
-
--quiet
|
|
323
323
|
--acl public-read
|
|
324
324
|
--exclude ${paths.appDist}/${entryFilename}
|
|
325
325
|
--cache-control max-age=31536000
|
|
@@ -330,11 +330,10 @@ var deploy = async (options) => {
|
|
|
330
330
|
try {
|
|
331
331
|
withAwsAuthenticate(() => runCommandSync(cmdSyncAll, { stdout: "inherit" }), options);
|
|
332
332
|
} catch (error) {
|
|
333
|
-
|
|
333
|
+
halt(error.stderr);
|
|
334
334
|
}
|
|
335
335
|
const cmdCpEntry = `
|
|
336
336
|
aws s3 cp ${paths.appDist}/${entryFilename} ${deployUrl}/${entryFilename}
|
|
337
|
-
--quiet
|
|
338
337
|
--acl public-read
|
|
339
338
|
--cache-control max-age=64800
|
|
340
339
|
${flags}
|
|
@@ -343,7 +342,7 @@ var deploy = async (options) => {
|
|
|
343
342
|
try {
|
|
344
343
|
withAwsAuthenticate(() => runCommandSync(cmdCpEntry, { stdout: "inherit" }), options);
|
|
345
344
|
} catch (error) {
|
|
346
|
-
|
|
345
|
+
halt(error.stderr);
|
|
347
346
|
}
|
|
348
347
|
const cmdInvalidateCache = `
|
|
349
348
|
aws cloudfront create-invalidation
|
|
@@ -356,7 +355,7 @@ var deploy = async (options) => {
|
|
|
356
355
|
try {
|
|
357
356
|
withAwsAuthenticate(() => runCommandSync(cmdInvalidateCache), options);
|
|
358
357
|
} catch (error) {
|
|
359
|
-
|
|
358
|
+
halt(error.stderr);
|
|
360
359
|
}
|
|
361
360
|
const demoPage = `https://${AWS_S3_BUCKET}/${configName}/${tag}/index.html`;
|
|
362
361
|
const entryPoint = `https://${AWS_S3_BUCKET}/${configName}/${tag}/${entryFilename}`;
|
|
@@ -384,16 +383,16 @@ var assertOptionsValid3 = (options) => {
|
|
|
384
383
|
};
|
|
385
384
|
var assertDistPathExists = (distPath) => {
|
|
386
385
|
if (!existsSync(distPath)) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
386
|
+
halt(stripIndent3(`
|
|
387
|
+
Dist folder does not exists.
|
|
388
|
+
Make sure you have built the bundle before trying to deploy it.
|
|
389
|
+
`));
|
|
391
390
|
}
|
|
392
391
|
};
|
|
393
392
|
var assertTagValid = (tag) => {
|
|
394
393
|
const regex = /^[a-zA-Z0-9-_.]+$/;
|
|
395
394
|
if (!regex.test(tag)) {
|
|
396
|
-
|
|
395
|
+
halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex}.`);
|
|
397
396
|
}
|
|
398
397
|
};
|
|
399
398
|
var prepareFlags4 = (flags, options) => {
|
|
@@ -419,7 +418,7 @@ var serve = async (options) => {
|
|
|
419
418
|
var assertOptionsValid4 = (options) => {
|
|
420
419
|
const { port } = options;
|
|
421
420
|
if (isNaN(Number(port))) {
|
|
422
|
-
|
|
421
|
+
halt('Flag "--port" should be a number.');
|
|
423
422
|
}
|
|
424
423
|
};
|
|
425
424
|
var prepareFlags5 = async (flags, options) => {
|
|
@@ -448,7 +447,7 @@ var listDeployed = async (options) => {
|
|
|
448
447
|
} catch (error) {
|
|
449
448
|
out = error.stdout;
|
|
450
449
|
if (error.stderr) {
|
|
451
|
-
|
|
450
|
+
halt(error.stderr);
|
|
452
451
|
}
|
|
453
452
|
}
|
|
454
453
|
const lines = out.split("\n");
|
|
@@ -475,7 +474,7 @@ var assertConfigValid = (config) => {
|
|
|
475
474
|
}
|
|
476
475
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
477
476
|
if (!regex.test(config)) {
|
|
478
|
-
|
|
477
|
+
halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex}.`);
|
|
479
478
|
}
|
|
480
479
|
};
|
|
481
480
|
var prepareFlags6 = (flags, options) => {
|
|
@@ -493,8 +492,8 @@ var deployEmailConfig = async (options) => {
|
|
|
493
492
|
const paths = getPaths(ifCore);
|
|
494
493
|
const emailConfigPath = `${paths.app}/email-config`;
|
|
495
494
|
assertOptionsValid6(options);
|
|
496
|
-
assertEmailConfigPathExists(emailConfigPath);
|
|
497
495
|
assertIsNotCore();
|
|
496
|
+
assertEmailConfigPathExists(emailConfigPath);
|
|
498
497
|
const flags = prepareFlags7([], options).join(" ");
|
|
499
498
|
const { bucket } = options;
|
|
500
499
|
const configName = getWidgetUuid();
|
|
@@ -510,7 +509,7 @@ var deployEmailConfig = async (options) => {
|
|
|
510
509
|
try {
|
|
511
510
|
withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }), options);
|
|
512
511
|
} catch (error) {
|
|
513
|
-
|
|
512
|
+
halt(error.stderr);
|
|
514
513
|
}
|
|
515
514
|
logTitle(`Email configuration for \u201C${configName}\u201D customer configuration is deployed.`);
|
|
516
515
|
logDataTable({ "Deploy URL:": deployUrl });
|
|
@@ -528,19 +527,19 @@ var assertOptionsValid6 = (options) => {
|
|
|
528
527
|
};
|
|
529
528
|
var assertEmailConfigPathExists = (distPath) => {
|
|
530
529
|
if (!existsSync2(distPath)) {
|
|
531
|
-
|
|
530
|
+
halt("Email config folder does not exists. Nothing to deploy.", 0);
|
|
532
531
|
}
|
|
533
532
|
};
|
|
534
533
|
var assertBucketValid = (tag) => {
|
|
535
534
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
536
535
|
if (!regex.test(tag)) {
|
|
537
|
-
|
|
536
|
+
halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex}.`);
|
|
538
537
|
}
|
|
539
538
|
};
|
|
540
539
|
var assertIsNotCore = () => {
|
|
541
540
|
const { ifCore } = getIfCoreFns();
|
|
542
541
|
if (ifCore()) {
|
|
543
|
-
|
|
542
|
+
halt("You cannot deploy widget email configuration for Tamaro Core.");
|
|
544
543
|
}
|
|
545
544
|
};
|
|
546
545
|
var prepareFlags7 = (flags, options) => {
|
package/dist/webpack.config.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
logTitle,
|
|
10
10
|
moduleFileExtensions,
|
|
11
11
|
resolveApp
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BWJBN44Y.js";
|
|
13
13
|
|
|
14
14
|
// src/webpack.config.ts
|
|
15
15
|
import { createRequire } from "module";
|
|
@@ -42,7 +42,10 @@ var InterpolateHtmlPlugin = class {
|
|
|
42
42
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
43
43
|
const hooks = HtmlWebpackPlugin.getHooks(compilation);
|
|
44
44
|
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
45
|
-
|
|
45
|
+
var _a;
|
|
46
|
+
const publicUrl = (_a = this.replacements["PUBLIC_URL"]) != null ? _a : "";
|
|
47
|
+
const entry = assets.headTags[0].attributes["src"];
|
|
48
|
+
this.replacements["ENTRY"] = `${publicUrl}${entry}`;
|
|
46
49
|
return assets;
|
|
47
50
|
});
|
|
48
51
|
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
@@ -237,7 +240,10 @@ var getWebpackConfig = async (env) => {
|
|
|
237
240
|
test: /\.ya?ml$/,
|
|
238
241
|
use: [
|
|
239
242
|
{ loader: require2.resolve("json-loader") },
|
|
240
|
-
{
|
|
243
|
+
{
|
|
244
|
+
loader: require2.resolve("yaml-loader"),
|
|
245
|
+
options: { asJSON: true }
|
|
246
|
+
}
|
|
241
247
|
]
|
|
242
248
|
},
|
|
243
249
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "RaiseNow",
|
|
6
6
|
"email": "development@raisenow.com"
|
|
@@ -20,48 +20,48 @@
|
|
|
20
20
|
"npm": ">=8"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/cli": "^7.17.
|
|
24
|
-
"@babel/core": "^7.17.
|
|
25
|
-
"@babel/plugin-proposal-decorators": "^7.17.
|
|
23
|
+
"@babel/cli": "^7.17.10",
|
|
24
|
+
"@babel/core": "^7.17.10",
|
|
25
|
+
"@babel/plugin-proposal-decorators": "^7.17.9",
|
|
26
26
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.17.
|
|
28
|
-
"@babel/preset-env": "^7.
|
|
27
|
+
"@babel/plugin-transform-runtime": "^7.17.10",
|
|
28
|
+
"@babel/preset-env": "^7.17.10",
|
|
29
29
|
"@babel/preset-react": "^7.16.7",
|
|
30
30
|
"@babel/preset-typescript": "^7.16.7",
|
|
31
|
-
"@babel/runtime-corejs3": "^7.17.
|
|
32
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.
|
|
31
|
+
"@babel/runtime-corejs3": "^7.17.9",
|
|
32
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
|
33
33
|
"@statoscope/webpack-plugin": "^5.20.1",
|
|
34
34
|
"@types/columnify": "^1.5.1",
|
|
35
|
-
"@types/lodash": "^4.14.
|
|
36
|
-
"@types/node": "^17.0.
|
|
35
|
+
"@types/lodash": "^4.14.182",
|
|
36
|
+
"@types/node": "^17.0.31",
|
|
37
37
|
"@types/node-notifier": "^8.0.2",
|
|
38
38
|
"@types/resolve-bin": "^0.4.1",
|
|
39
39
|
"@types/webpack-config-utils": "^2.3.1",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
41
|
-
"@typescript-eslint/parser": "^5.
|
|
42
|
-
"autoprefixer": "^10.4.
|
|
43
|
-
"babel-loader": "^8.2.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.22.0",
|
|
42
|
+
"autoprefixer": "^10.4.7",
|
|
43
|
+
"babel-loader": "^8.2.5",
|
|
44
44
|
"babel-plugin-lodash": "^3.3.4",
|
|
45
45
|
"chalk": "^5.0.1",
|
|
46
46
|
"clean-webpack-plugin": "^4.0.0",
|
|
47
47
|
"columnify": "^1.6.0",
|
|
48
|
-
"commander": "^9.
|
|
48
|
+
"commander": "^9.2.0",
|
|
49
49
|
"copy-webpack-plugin": "^10.2.4",
|
|
50
|
-
"core-js": "^3.
|
|
50
|
+
"core-js": "^3.22.4",
|
|
51
51
|
"css-loader": "^6.7.1",
|
|
52
52
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
53
53
|
"dotenv": "^16.0.0",
|
|
54
54
|
"dotenv-expand": "^8.0.3",
|
|
55
55
|
"escape-string-regexp": "^5.0.0",
|
|
56
|
-
"eslint": "^8.
|
|
56
|
+
"eslint": "^8.14.0",
|
|
57
57
|
"eslint-config-prettier": "^8.5.0",
|
|
58
58
|
"eslint-plugin-node": "^11.1.0",
|
|
59
59
|
"eslint-plugin-promise": "^6.0.0",
|
|
60
60
|
"eslint-webpack-plugin": "^3.1.1",
|
|
61
61
|
"execa": "^6.1.0",
|
|
62
62
|
"file-loader": "^6.2.0",
|
|
63
|
-
"fork-ts-checker-webpack-plugin": "^7.2.
|
|
64
|
-
"glob": "^
|
|
63
|
+
"fork-ts-checker-webpack-plugin": "^7.2.11",
|
|
64
|
+
"glob": "^8.0.1",
|
|
65
65
|
"html-loader": "^3.1.0",
|
|
66
66
|
"html-webpack-plugin": "^5.5.0",
|
|
67
67
|
"json-loader": "^0.5.7",
|
|
@@ -69,25 +69,25 @@
|
|
|
69
69
|
"mini-css-extract-plugin": "^2.6.0",
|
|
70
70
|
"node-notifier": "^10.0.1",
|
|
71
71
|
"portfinder": "^1.0.28",
|
|
72
|
-
"postcss": "^8.4.
|
|
73
|
-
"postcss-custom-properties": "^12.1.
|
|
72
|
+
"postcss": "^8.4.13",
|
|
73
|
+
"postcss-custom-properties": "^12.1.7",
|
|
74
74
|
"postcss-loader": "^6.2.1",
|
|
75
|
-
"prettier": "^2.6.
|
|
76
|
-
"react-refresh": "^0.
|
|
75
|
+
"prettier": "^2.6.2",
|
|
76
|
+
"react-refresh": "^0.13.0",
|
|
77
77
|
"resolve-url-loader": "^5.0.0",
|
|
78
|
-
"sass": "^1.
|
|
78
|
+
"sass": "^1.51.0",
|
|
79
79
|
"sass-loader": "^12.6.0",
|
|
80
80
|
"source-map-loader": "^3.0.1",
|
|
81
81
|
"strip-indent": "^4.0.0",
|
|
82
82
|
"style-loader": "^3.3.1",
|
|
83
83
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
84
|
-
"tsup": "^5.12.
|
|
85
|
-
"typescript": "^4.6.
|
|
84
|
+
"tsup": "^5.12.6",
|
|
85
|
+
"typescript": "^4.6.4",
|
|
86
86
|
"url-loader": "^4.1.1",
|
|
87
|
-
"webpack": "^5.
|
|
87
|
+
"webpack": "^5.72.0",
|
|
88
88
|
"webpack-cli": "^4.9.2",
|
|
89
89
|
"webpack-config-utils": "^2.3.1",
|
|
90
|
-
"webpack-dev-server": "^4.
|
|
91
|
-
"yaml-loader": "^0.
|
|
90
|
+
"webpack-dev-server": "^4.8.1",
|
|
91
|
+
"yaml-loader": "^0.8.0"
|
|
92
92
|
}
|
|
93
93
|
}
|
package/src/commands/build.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {assertEnvValid} from 'lib/env'
|
|
11
11
|
import {logCommand, logTitle} from 'lib/logging'
|
|
12
12
|
import {notify} from 'lib/notifier'
|
|
13
|
-
import {
|
|
13
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
14
14
|
import {DeployOptions} from 'commands/deploy'
|
|
15
15
|
|
|
16
16
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -74,11 +74,11 @@ const assertOptionsValid = (options: BuildOptions & DeployOptions) => {
|
|
|
74
74
|
const {ifCore} = getIfCoreFns()
|
|
75
75
|
|
|
76
76
|
if (ifCore() && localCore) {
|
|
77
|
-
|
|
77
|
+
halt('Flag “--local-core” is redundant if running in Tamaro Core context.')
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (localCore && deploy) {
|
|
81
|
-
|
|
81
|
+
halt('Flags “--local-core” and “--deploy” must not be used together.')
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
assertProfileValid(profile)
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {logCommand, logDataTable, logTitle} from 'lib/logging'
|
|
9
9
|
import {getIfCoreFns, getPaths, getWidgetUuid} from 'lib/resolve'
|
|
10
10
|
import {notify} from 'lib/notifier'
|
|
11
|
-
import {
|
|
11
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
12
12
|
|
|
13
13
|
///////////////////////////////////////////////////////////////////////////////
|
|
14
14
|
|
|
@@ -26,8 +26,8 @@ export const deployEmailConfig = async (
|
|
|
26
26
|
const emailConfigPath = `${paths.app}/email-config`
|
|
27
27
|
|
|
28
28
|
assertOptionsValid(options)
|
|
29
|
-
assertEmailConfigPathExists(emailConfigPath)
|
|
30
29
|
assertIsNotCore()
|
|
30
|
+
assertEmailConfigPathExists(emailConfigPath)
|
|
31
31
|
|
|
32
32
|
const flags = prepareFlags([], options).join(' ')
|
|
33
33
|
const {bucket} = options
|
|
@@ -48,7 +48,7 @@ export const deployEmailConfig = async (
|
|
|
48
48
|
try {
|
|
49
49
|
withAwsAuthenticate(() => runCommandSync(cmd, {stdout: 'inherit'}), options)
|
|
50
50
|
} catch (error: any) {
|
|
51
|
-
|
|
51
|
+
halt(error.stderr)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -81,7 +81,7 @@ const assertOptionsValid = (options: DeployEmailConfigOptions) => {
|
|
|
81
81
|
|
|
82
82
|
const assertEmailConfigPathExists = (distPath: string) => {
|
|
83
83
|
if (!existsSync(distPath)) {
|
|
84
|
-
|
|
84
|
+
halt('Email config folder does not exists. Nothing to deploy.', 0)
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -91,7 +91,7 @@ const assertBucketValid = (tag: string) => {
|
|
|
91
91
|
const regex = /^[a-zA-Z0-9-_]+$/
|
|
92
92
|
|
|
93
93
|
if (!regex.test(tag)) {
|
|
94
|
-
|
|
94
|
+
halt(`Flag “--bucket” has forbidden format. Allowed format: ${regex}.`)
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -101,7 +101,7 @@ const assertIsNotCore = () => {
|
|
|
101
101
|
const {ifCore} = getIfCoreFns()
|
|
102
102
|
|
|
103
103
|
if (ifCore()) {
|
|
104
|
-
|
|
104
|
+
halt('You cannot deploy widget email configuration for Tamaro Core.')
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
package/src/commands/deploy.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {existsSync} from 'fs'
|
|
2
|
+
import stripIndent from 'strip-indent'
|
|
2
3
|
import {
|
|
3
4
|
AWS_CLOUDFRONT_DISTRIBUTION_ID,
|
|
4
5
|
AWS_S3_BUCKET,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
import {getIfCoreFns, getPaths, getWidgetUuid} from 'lib/resolve'
|
|
14
15
|
import {logCommand, logDataTable, logTitle} from 'lib/logging'
|
|
15
16
|
import {notify} from 'lib/notifier'
|
|
16
|
-
import {
|
|
17
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
17
18
|
|
|
18
19
|
///////////////////////////////////////////////////////////////////////////////
|
|
19
20
|
|
|
@@ -42,7 +43,6 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
42
43
|
|
|
43
44
|
const cmdSyncAll = `
|
|
44
45
|
aws s3 sync ${paths.appDist} ${deployUrl}
|
|
45
|
-
--quiet
|
|
46
46
|
--acl public-read
|
|
47
47
|
--exclude ${paths.appDist}/${entryFilename}
|
|
48
48
|
--cache-control max-age=31536000
|
|
@@ -57,7 +57,7 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
57
57
|
options,
|
|
58
58
|
)
|
|
59
59
|
} catch (error: any) {
|
|
60
|
-
|
|
60
|
+
halt(error.stderr)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -66,7 +66,6 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
66
66
|
|
|
67
67
|
const cmdCpEntry = `
|
|
68
68
|
aws s3 cp ${paths.appDist}/${entryFilename} ${deployUrl}/${entryFilename}
|
|
69
|
-
--quiet
|
|
70
69
|
--acl public-read
|
|
71
70
|
--cache-control max-age=64800
|
|
72
71
|
${flags}
|
|
@@ -79,7 +78,7 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
79
78
|
options,
|
|
80
79
|
)
|
|
81
80
|
} catch (error: any) {
|
|
82
|
-
|
|
81
|
+
halt(error.stderr)
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -99,7 +98,7 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
99
98
|
// ignore output
|
|
100
99
|
withAwsAuthenticate(() => runCommandSync(cmdInvalidateCache), options)
|
|
101
100
|
} catch (error: any) {
|
|
102
|
-
|
|
101
|
+
halt(error.stderr)
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -140,10 +139,12 @@ const assertOptionsValid = (options: DeployOptions) => {
|
|
|
140
139
|
|
|
141
140
|
const assertDistPathExists = (distPath: string) => {
|
|
142
141
|
if (!existsSync(distPath)) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
halt(
|
|
143
|
+
stripIndent(`
|
|
144
|
+
Dist folder does not exists.
|
|
145
|
+
Make sure you have built the bundle before trying to deploy it.
|
|
146
|
+
`),
|
|
147
|
+
)
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -153,7 +154,7 @@ const assertTagValid = (tag: string) => {
|
|
|
153
154
|
const regex = /^[a-zA-Z0-9-_.]+$/
|
|
154
155
|
|
|
155
156
|
if (!regex.test(tag)) {
|
|
156
|
-
|
|
157
|
+
halt(`Flag “--tag” has forbidden format. Allowed format: ${regex}.`)
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
package/src/commands/dev.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {getPortPromise} from 'portfinder'
|
|
2
2
|
import {getIfCoreFns, resolveBin, resolveOwn} from 'lib/resolve'
|
|
3
3
|
import {logCommand, logTitle} from 'lib/logging'
|
|
4
|
-
import {
|
|
4
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
5
5
|
import {assertEnvValid} from 'lib/env'
|
|
6
6
|
|
|
7
7
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -43,11 +43,11 @@ const assertOptionsValid = (options: DevOptions) => {
|
|
|
43
43
|
const {ifCore} = getIfCoreFns()
|
|
44
44
|
|
|
45
45
|
if (ifCore() && localCore) {
|
|
46
|
-
|
|
46
|
+
halt('Flag “--local-core” is redundant if running in Tamaro Core context.')
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (isNaN(Number(port))) {
|
|
50
|
-
|
|
50
|
+
halt('Flag “--port” should be a number.')
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
assertEnvValid(env)
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from 'lib/aws'
|
|
8
8
|
import {getIfCoreFns, getWidgetUuid} from 'lib/resolve'
|
|
9
9
|
import {logCommand, logTitle} from 'lib/logging'
|
|
10
|
-
import {
|
|
10
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
11
11
|
|
|
12
12
|
///////////////////////////////////////////////////////////////////////////////
|
|
13
13
|
|
|
@@ -47,7 +47,7 @@ export const listDeployed = async (
|
|
|
47
47
|
out = error.stdout
|
|
48
48
|
|
|
49
49
|
if (error.stderr) {
|
|
50
|
-
|
|
50
|
+
halt(error.stderr)
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -88,7 +88,7 @@ const assertConfigValid = (config: string | undefined) => {
|
|
|
88
88
|
const regex = /^[a-zA-Z0-9-_]+$/
|
|
89
89
|
|
|
90
90
|
if (!regex.test(config)) {
|
|
91
|
-
|
|
91
|
+
halt(`Flag “--config” has forbidden format. Allowed format: ${regex}.`)
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
package/src/commands/serve.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {getPortPromise} from 'portfinder'
|
|
2
2
|
import {getIfCoreFns, getPaths} from 'lib/resolve'
|
|
3
3
|
import {logCommand, logTitle} from 'lib/logging'
|
|
4
|
-
import {
|
|
4
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
5
5
|
|
|
6
6
|
///////////////////////////////////////////////////////////////////////////////
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ const assertOptionsValid = (options: ServeOptions) => {
|
|
|
34
34
|
const {port} = options
|
|
35
35
|
|
|
36
36
|
if (isNaN(Number(port))) {
|
|
37
|
-
|
|
37
|
+
halt('Flag "--port" should be a number.')
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -24,7 +24,9 @@ export class InterpolateHtmlPlugin {
|
|
|
24
24
|
const hooks = HtmlWebpackPlugin.getHooks(compilation)
|
|
25
25
|
|
|
26
26
|
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
27
|
-
this.replacements['
|
|
27
|
+
const publicUrl = this.replacements['PUBLIC_URL'] ?? ''
|
|
28
|
+
const entry = assets.headTags[0].attributes['src']
|
|
29
|
+
this.replacements['ENTRY'] = `${publicUrl}${entry}`
|
|
28
30
|
|
|
29
31
|
return assets
|
|
30
32
|
})
|
package/src/lib/aws.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {execaCommandSync} from 'execa'
|
|
2
2
|
import stripIndent from 'strip-indent'
|
|
3
|
-
import {
|
|
3
|
+
import {halt} from 'lib/command'
|
|
4
4
|
|
|
5
5
|
///////////////////////////////////////////////////////////////////////////////
|
|
6
6
|
|
|
@@ -74,7 +74,7 @@ export const assertProfileValid = (profile: string) => {
|
|
|
74
74
|
https://raisenow.atlassian.net/wiki/x/lIrWvg
|
|
75
75
|
`)
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
halt(message)
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -107,7 +107,7 @@ const login = (options: AwsOptions) => {
|
|
|
107
107
|
execaCommandSync(`aws sso login ${flags}`, {stdio: 'inherit'})
|
|
108
108
|
console.log('')
|
|
109
109
|
} catch (error) {
|
|
110
|
-
|
|
110
|
+
halt('Login failed.')
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
package/src/lib/command.ts
CHANGED
|
@@ -3,9 +3,9 @@ import {logError} from 'lib/logging'
|
|
|
3
3
|
|
|
4
4
|
///////////////////////////////////////////////////////////////////////////////
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const halt = (message?: string, exitCode = 1) => {
|
|
7
7
|
logError(message)
|
|
8
|
-
process.exit(
|
|
8
|
+
process.exit(exitCode)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
///////////////////////////////////////////////////////////////////////////////
|
package/src/lib/env.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {expand as dotenvExpand} from 'dotenv-expand'
|
|
|
6
6
|
import {config as dotenvConfig} from 'dotenv'
|
|
7
7
|
import stripIndent from 'strip-indent'
|
|
8
8
|
import {getIfCoreFns, getPaths, getWidgetUuid, resolveApp} from 'lib/resolve'
|
|
9
|
-
import {
|
|
9
|
+
import {halt} from 'lib/command'
|
|
10
10
|
|
|
11
11
|
///////////////////////////////////////////////////////////////////////////////
|
|
12
12
|
|
|
@@ -39,6 +39,7 @@ export const getEnvVars = (
|
|
|
39
39
|
)
|
|
40
40
|
process.env.WEBPACK_UNIQUE_NAME ??= ifCore('RnwTamaroCore', 'RnwTamaro')
|
|
41
41
|
process.env.BUILD_DATE = new Date().toISOString()
|
|
42
|
+
process.env.PUBLIC_URL ??= ''
|
|
42
43
|
|
|
43
44
|
// HMR doesn't work in ie11, it breaks everything.
|
|
44
45
|
// If you want to run dev-server and test in ie11, set HMR_ENABLED to 'false'
|
|
@@ -76,6 +77,7 @@ export const getEnvVars = (
|
|
|
76
77
|
'ELEMENT_ATTRIBUTE_DATA_WIDGET',
|
|
77
78
|
'WEBPACK_UNIQUE_NAME',
|
|
78
79
|
'BUILD_DATE',
|
|
80
|
+
'PUBLIC_URL',
|
|
79
81
|
|
|
80
82
|
// core
|
|
81
83
|
'PRODUCT_NAME',
|
|
@@ -127,11 +129,11 @@ export const assertEnvValid = (env: string) => {
|
|
|
127
129
|
|
|
128
130
|
if (envs.length !== 0) {
|
|
129
131
|
if (!env) {
|
|
130
|
-
|
|
132
|
+
halt('Flag “--env” is required.')
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
if (!envs.includes(env)) {
|
|
134
|
-
|
|
136
|
+
halt(
|
|
135
137
|
stripIndent(`
|
|
136
138
|
Flag “--env” has wrong value.
|
|
137
139
|
Available values are: ${envs.map((v) => `“${v}”`).join(', ')}.
|
package/src/webpack.config.ts
CHANGED
|
@@ -248,7 +248,10 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
|
|
|
248
248
|
test: /\.ya?ml$/,
|
|
249
249
|
use: [
|
|
250
250
|
{loader: require.resolve('json-loader')},
|
|
251
|
-
{
|
|
251
|
+
{
|
|
252
|
+
loader: require.resolve('yaml-loader'),
|
|
253
|
+
options: {asJSON: true},
|
|
254
|
+
},
|
|
252
255
|
],
|
|
253
256
|
},
|
|
254
257
|
|