@raisenow/tamaro-cli 1.0.17 → 1.0.20
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/.eslintignore +3 -2
- package/.eslintrc.cjs +14 -9
- package/.gitignore +1 -0
- package/.prettierignore +2 -0
- package/dist/{chunk-BWJBN44Y.js → chunk-CNSEEVDD.js} +60 -61
- package/dist/cli.js +185 -117
- package/dist/webpack.config.js +59 -41
- package/package.json +37 -36
- package/src/cli.ts +2 -0
- package/src/commands/deploy-email-config.ts +3 -1
- package/src/commands/deploy.ts +3 -1
- package/src/commands/list-deployed.ts +3 -1
- package/src/lib/InterpolateHtmlPlugin.ts +3 -3
- package/src/lib/resolve.ts +13 -14
- package/src/webpack.config.ts +3 -1
- package/tsconfig.eslint.json +7 -0
- package/tsconfig.json +6 -0
package/.eslintignore
CHANGED
package/.eslintrc.cjs
CHANGED
|
@@ -5,38 +5,43 @@ module.exports = {
|
|
|
5
5
|
node: true,
|
|
6
6
|
es2021: true,
|
|
7
7
|
},
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
8
9
|
parserOptions: {
|
|
9
10
|
ecmaFeatures: {
|
|
10
11
|
jsx: true,
|
|
11
12
|
},
|
|
12
13
|
ecmaVersion: 2021,
|
|
13
14
|
sourceType: 'module',
|
|
15
|
+
tsconfigRootDir: __dirname,
|
|
16
|
+
project: './tsconfig.eslint.json',
|
|
17
|
+
extraFileExtensions: ['.cjs'],
|
|
14
18
|
},
|
|
15
19
|
extends: [
|
|
16
20
|
'eslint:recommended',
|
|
17
21
|
'plugin:node/recommended',
|
|
18
22
|
'plugin:promise/recommended',
|
|
19
23
|
'plugin:@typescript-eslint/recommended',
|
|
24
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
20
25
|
'prettier',
|
|
21
26
|
],
|
|
22
27
|
plugins: [],
|
|
23
28
|
rules: {
|
|
24
29
|
curly: 1,
|
|
30
|
+
'prefer-const': 2,
|
|
31
|
+
'require-await': 0,
|
|
32
|
+
'no-process-exit': 0,
|
|
25
33
|
'node/no-unsupported-features/es-syntax': 0,
|
|
26
34
|
'node/no-missing-import': 0,
|
|
27
35
|
'node/shebang': 0,
|
|
28
|
-
'no-process-exit': 0,
|
|
29
36
|
'@typescript-eslint/ban-ts-comment': 0,
|
|
30
37
|
'@typescript-eslint/no-explicit-any': 0,
|
|
31
38
|
'@typescript-eslint/no-non-null-assertion': 0,
|
|
32
39
|
'@typescript-eslint/prefer-optional-chain': 1,
|
|
40
|
+
'@typescript-eslint/require-await': 0,
|
|
41
|
+
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
42
|
+
'@typescript-eslint/no-unsafe-member-access': 0,
|
|
43
|
+
'@typescript-eslint/no-unsafe-call': 0,
|
|
44
|
+
'@typescript-eslint/no-unsafe-return': 0,
|
|
45
|
+
'@typescript-eslint/no-unsafe-argument': 0,
|
|
33
46
|
},
|
|
34
|
-
overrides: [
|
|
35
|
-
{
|
|
36
|
-
files: ['*.ts', '*.tsx'],
|
|
37
|
-
parserOptions: {
|
|
38
|
-
project: 'tsconfig.json',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
47
|
}
|
package/.gitignore
CHANGED
package/.prettierignore
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
1
|
// node_modules/tsup/assets/esm_shims.js
|
|
19
2
|
import { fileURLToPath } from "url";
|
|
20
3
|
import path from "path";
|
|
@@ -56,10 +39,13 @@ var moduleFileExtensions = ["ts", "tsx", "js", "jsx"];
|
|
|
56
39
|
var extensions = moduleFileExtensions.map((v) => `.${v}`);
|
|
57
40
|
var TAMARO_CORE_PACKAGE_NAMES = ["@raisenow/tamaro-core"];
|
|
58
41
|
var TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ["@raisenow/tamaro-configurations"];
|
|
42
|
+
var TAMARO_SELF_SERVICE_PACKAGE_NAMES = ["@raisenow/tamaro-self-service"];
|
|
59
43
|
var resolveApp = (relativePath) => resolve(realpathSync(process.cwd()), relativePath);
|
|
60
44
|
var resolveOwn = (relativePath) => resolve(__dirname, "..", relativePath);
|
|
61
45
|
var resolveModule = (resolveFn, filePath) => {
|
|
62
|
-
const extension = moduleFileExtensions.find(
|
|
46
|
+
const extension = moduleFileExtensions.find(
|
|
47
|
+
(extension2) => existsSync(resolveFn(`${filePath}.${extension2}`))
|
|
48
|
+
);
|
|
63
49
|
if (extension) {
|
|
64
50
|
return resolveFn(`${filePath}.${extension}`);
|
|
65
51
|
}
|
|
@@ -74,25 +60,28 @@ var resolveBin = (name) => {
|
|
|
74
60
|
};
|
|
75
61
|
var getWidgetUuid = () => basename(resolveApp("."));
|
|
76
62
|
var getPaths = (ifCore) => {
|
|
77
|
-
return ifCore(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
63
|
+
return ifCore(
|
|
64
|
+
{
|
|
65
|
+
app: resolveApp("."),
|
|
66
|
+
appEntry: resolveModule(resolveApp, "src/index"),
|
|
67
|
+
appDist: resolveApp("dist"),
|
|
68
|
+
appNodeModules: resolveApp("node_modules"),
|
|
69
|
+
appTsConfig: resolveApp("tsconfig.json"),
|
|
70
|
+
appHtml: resolveApp("src/*.html"),
|
|
71
|
+
appEnv: resolveApp(".env*"),
|
|
72
|
+
appTailwindConfig: resolveApp("tailwind.config.js")
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
app: resolveApp("."),
|
|
76
|
+
appEntry: resolveModule(resolveApp, "widget"),
|
|
77
|
+
appDist: resolveApp(`../../dist/${getWidgetUuid()}`),
|
|
78
|
+
appNodeModules: resolveApp("../../node_modules"),
|
|
79
|
+
appTsConfig: resolveApp("tsconfig.json"),
|
|
80
|
+
appHtml: resolveApp("*.html"),
|
|
81
|
+
appEnv: resolveApp(".env*"),
|
|
82
|
+
appTailwindConfig: void 0
|
|
83
|
+
}
|
|
84
|
+
);
|
|
96
85
|
};
|
|
97
86
|
var getRelativePaths = (paths) => {
|
|
98
87
|
const relativePaths = {};
|
|
@@ -106,23 +95,29 @@ var getRelativePaths = (paths) => {
|
|
|
106
95
|
var getIfCoreFns = () => {
|
|
107
96
|
const corePkgPath = resolveApp("package.json");
|
|
108
97
|
const configsPkgPath = resolveApp("../../package.json");
|
|
98
|
+
let packageName;
|
|
109
99
|
if (existsSync(corePkgPath)) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
100
|
+
packageName = require2(corePkgPath).name;
|
|
101
|
+
} else if (existsSync(configsPkgPath)) {
|
|
102
|
+
packageName = require2(configsPkgPath).name;
|
|
114
103
|
}
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
104
|
+
if (packageName) {
|
|
105
|
+
return getIfUtils({ core: TAMARO_CORE_PACKAGE_NAMES.includes(packageName) }, [
|
|
106
|
+
"core"
|
|
107
|
+
]);
|
|
120
108
|
}
|
|
121
|
-
logError(
|
|
109
|
+
logError(
|
|
110
|
+
stripIndent2(` You must run "npx @raisenow/tamaro-cli" commands from:
|
|
122
111
|
1. Root of "${chalk2.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
|
|
123
|
-
2. Root of particular customer configuration folder of "${chalk2.bold(
|
|
112
|
+
2. Root of particular customer configuration folder of "${chalk2.bold(
|
|
113
|
+
TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0]
|
|
114
|
+
)}" package.
|
|
115
|
+
3. "src/self-service" folder of "${chalk2.bold(
|
|
116
|
+
TAMARO_SELF_SERVICE_PACKAGE_NAMES[0]
|
|
117
|
+
)}" package.
|
|
124
118
|
You are currently in "${chalk2.bold(realpathSync(process.cwd()))}".
|
|
125
|
-
`)
|
|
119
|
+
`)
|
|
120
|
+
);
|
|
126
121
|
process.exit(1);
|
|
127
122
|
};
|
|
128
123
|
|
|
@@ -150,17 +145,20 @@ var runCommandSync = (cmd, options) => {
|
|
|
150
145
|
// src/lib/env.ts
|
|
151
146
|
var require3 = createRequire2(import.meta.url);
|
|
152
147
|
var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
148
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
154
149
|
const filePath = files.find((file) => basename2(file) === ".env");
|
|
155
150
|
dotenvExpand(dotenvConfig({ path: filePath }));
|
|
156
|
-
(
|
|
157
|
-
(
|
|
158
|
-
(
|
|
159
|
-
(
|
|
160
|
-
|
|
151
|
+
(_a = process.env).NODE_ENV ?? (_a.NODE_ENV = ifMin("production", "development"));
|
|
152
|
+
(_b = process.env).BABEL_ENV ?? (_b.BABEL_ENV = ifMin("production", "development"));
|
|
153
|
+
(_c = process.env).EXPOSE_VAR ?? (_c.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro"));
|
|
154
|
+
(_d = process.env).ELEMENT_ATTRIBUTE_DATA_WIDGET ?? (_d.ELEMENT_ATTRIBUTE_DATA_WIDGET = ifCore(
|
|
155
|
+
"rnw-tamaro-core",
|
|
156
|
+
"rnw-tamaro"
|
|
157
|
+
));
|
|
158
|
+
(_e = process.env).WEBPACK_UNIQUE_NAME ?? (_e.WEBPACK_UNIQUE_NAME = ifCore("RnwTamaroCore", "RnwTamaro"));
|
|
161
159
|
process.env.BUILD_DATE = new Date().toISOString();
|
|
162
|
-
(
|
|
163
|
-
(
|
|
160
|
+
(_f = process.env).PUBLIC_URL ?? (_f.PUBLIC_URL = "");
|
|
161
|
+
(_g = process.env).HMR_ENABLED ?? (_g.HMR_ENABLED = ifMin("false", "true"));
|
|
164
162
|
if (ifCore()) {
|
|
165
163
|
process.env.PRODUCT_NAME = "tamaro";
|
|
166
164
|
const corePkgPath = resolveApp("package.json");
|
|
@@ -174,7 +172,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
|
174
172
|
} else {
|
|
175
173
|
let version = process.env.CORE_VERSION;
|
|
176
174
|
version = version ? `@${version}` : "";
|
|
177
|
-
(
|
|
175
|
+
(_h = process.env).CORE_URL ?? (_h.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`);
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
178
|
const varNames = [
|
|
@@ -219,10 +217,12 @@ var assertEnvValid = (env) => {
|
|
|
219
217
|
halt("Flag \u201C--env\u201D is required.");
|
|
220
218
|
}
|
|
221
219
|
if (!envs.includes(env)) {
|
|
222
|
-
halt(
|
|
220
|
+
halt(
|
|
221
|
+
stripIndent3(`
|
|
223
222
|
Flag \u201C--env\u201D has wrong value.
|
|
224
223
|
Available values are: ${envs.map((v) => `\u201C${v}\u201D`).join(", ")}.
|
|
225
|
-
`)
|
|
224
|
+
`)
|
|
225
|
+
);
|
|
226
226
|
}
|
|
227
227
|
const filePath = files.find((file) => basename2(file) === `.env.${env}`);
|
|
228
228
|
dotenvExpand(dotenvConfig({ path: filePath }));
|
|
@@ -230,7 +230,6 @@ var assertEnvValid = (env) => {
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
export {
|
|
233
|
-
__spreadValues,
|
|
234
233
|
logTitle,
|
|
235
234
|
logError,
|
|
236
235
|
logCommand,
|
package/dist/cli.js
CHANGED
|
@@ -12,112 +12,105 @@ import {
|
|
|
12
12
|
resolveBin,
|
|
13
13
|
resolveOwn,
|
|
14
14
|
runCommandSync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CNSEEVDD.js";
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
18
18
|
import { createCommand } from "commander";
|
|
19
19
|
|
|
20
20
|
// package.json
|
|
21
|
-
var name = "@raisenow/tamaro-cli";
|
|
22
|
-
var version = "1.0.17";
|
|
23
|
-
var author = {
|
|
24
|
-
name: "RaiseNow",
|
|
25
|
-
email: "development@raisenow.com"
|
|
26
|
-
};
|
|
27
|
-
var type = "module";
|
|
28
|
-
var scripts = {
|
|
29
|
-
prepare: "npm run build",
|
|
30
|
-
start: "npm run dev",
|
|
31
|
-
build: "tsup src/cli.ts src/webpack.config.ts --clean --format esm",
|
|
32
|
-
"build:watch": "npm run build -- --watch --ignore-watch .idea",
|
|
33
|
-
docs: "npx -y http-server . --cors -o /readme.html",
|
|
34
|
-
lint: "eslint . --fix && prettier --write ."
|
|
35
|
-
};
|
|
36
|
-
var bin = "dist/cli.js";
|
|
37
|
-
var engines = {
|
|
38
|
-
node: ">=16",
|
|
39
|
-
npm: ">=8"
|
|
40
|
-
};
|
|
41
|
-
var dependencies = {
|
|
42
|
-
"@babel/cli": "^7.17.10",
|
|
43
|
-
"@babel/core": "^7.17.12",
|
|
44
|
-
"@babel/plugin-proposal-decorators": "^7.17.12",
|
|
45
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
46
|
-
"@babel/plugin-transform-runtime": "^7.17.12",
|
|
47
|
-
"@babel/preset-env": "^7.17.12",
|
|
48
|
-
"@babel/preset-react": "^7.17.12",
|
|
49
|
-
"@babel/preset-typescript": "^7.17.12",
|
|
50
|
-
"@babel/runtime-corejs3": "^7.17.9",
|
|
51
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.6",
|
|
52
|
-
"@statoscope/webpack-plugin": "^5.20.1",
|
|
53
|
-
"@types/columnify": "^1.5.1",
|
|
54
|
-
"@types/lodash": "^4.14.182",
|
|
55
|
-
"@types/node": "^17.0.34",
|
|
56
|
-
"@types/node-notifier": "^8.0.2",
|
|
57
|
-
"@types/resolve-bin": "^0.4.1",
|
|
58
|
-
"@types/webpack-config-utils": "^2.3.1",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
|
60
|
-
"@typescript-eslint/parser": "^5.25.0",
|
|
61
|
-
autoprefixer: "^10.4.7",
|
|
62
|
-
"babel-loader": "^8.2.5",
|
|
63
|
-
"babel-plugin-lodash": "^3.3.4",
|
|
64
|
-
chalk: "^5.0.1",
|
|
65
|
-
"clean-webpack-plugin": "^4.0.0",
|
|
66
|
-
columnify: "^1.6.0",
|
|
67
|
-
commander: "^9.2.0",
|
|
68
|
-
"copy-webpack-plugin": "^11.0.0",
|
|
69
|
-
"core-js": "^3.22.5",
|
|
70
|
-
"css-loader": "^6.7.1",
|
|
71
|
-
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
72
|
-
dotenv: "^16.0.1",
|
|
73
|
-
"dotenv-expand": "^8.0.3",
|
|
74
|
-
"escape-string-regexp": "^5.0.0",
|
|
75
|
-
eslint: "^8.15.0",
|
|
76
|
-
"eslint-config-prettier": "^8.5.0",
|
|
77
|
-
"eslint-plugin-node": "^11.1.0",
|
|
78
|
-
"eslint-plugin-promise": "^6.0.0",
|
|
79
|
-
"eslint-webpack-plugin": "^3.1.1",
|
|
80
|
-
execa: "^6.1.0",
|
|
81
|
-
"file-loader": "^6.2.0",
|
|
82
|
-
"fork-ts-checker-webpack-plugin": "^7.2.11",
|
|
83
|
-
glob: "^8.0.3",
|
|
84
|
-
"html-loader": "^3.1.0",
|
|
85
|
-
"html-webpack-plugin": "^5.5.0",
|
|
86
|
-
"json-loader": "^0.5.7",
|
|
87
|
-
lodash: "^4.17.21",
|
|
88
|
-
"mini-css-extract-plugin": "^2.6.0",
|
|
89
|
-
"node-notifier": "^10.0.1",
|
|
90
|
-
portfinder: "^1.0.28",
|
|
91
|
-
postcss: "^8.4.13",
|
|
92
|
-
"postcss-custom-properties": "^12.1.7",
|
|
93
|
-
"postcss-loader": "^6.2.1",
|
|
94
|
-
prettier: "^2.6.2",
|
|
95
|
-
"react-refresh": "^0.13.0",
|
|
96
|
-
"resolve-url-loader": "^5.0.0",
|
|
97
|
-
sass: "^1.51.0",
|
|
98
|
-
"sass-loader": "^12.6.0",
|
|
99
|
-
"source-map-loader": "^3.0.1",
|
|
100
|
-
"strip-indent": "^4.0.0",
|
|
101
|
-
"style-loader": "^3.3.1",
|
|
102
|
-
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
103
|
-
tsup: "^5.12.8",
|
|
104
|
-
typescript: "^4.6.4",
|
|
105
|
-
"url-loader": "^4.1.1",
|
|
106
|
-
webpack: "^5.72.1",
|
|
107
|
-
"webpack-cli": "^4.9.2",
|
|
108
|
-
"webpack-config-utils": "^2.3.1",
|
|
109
|
-
"webpack-dev-server": "^4.9.0",
|
|
110
|
-
"yaml-loader": "^0.8.0"
|
|
111
|
-
};
|
|
112
21
|
var package_default = {
|
|
113
|
-
name,
|
|
114
|
-
version,
|
|
115
|
-
author
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
22
|
+
name: "@raisenow/tamaro-cli",
|
|
23
|
+
version: "1.0.20",
|
|
24
|
+
author: {
|
|
25
|
+
name: "RaiseNow",
|
|
26
|
+
email: "development@raisenow.com"
|
|
27
|
+
},
|
|
28
|
+
type: "module",
|
|
29
|
+
scripts: {
|
|
30
|
+
prepare: "npm run build",
|
|
31
|
+
start: "npm run dev",
|
|
32
|
+
build: "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
33
|
+
"build:watch": "npm run build -- --watch --ignore-watch .idea",
|
|
34
|
+
docs: "npx -y http-server . --cors -o /readme.html",
|
|
35
|
+
lint: "eslint --fix . && prettier --write ."
|
|
36
|
+
},
|
|
37
|
+
bin: "dist/cli.js",
|
|
38
|
+
engines: {
|
|
39
|
+
node: ">=16",
|
|
40
|
+
npm: ">=8"
|
|
41
|
+
},
|
|
42
|
+
dependencies: {
|
|
43
|
+
"@babel/cli": "^7.18.9",
|
|
44
|
+
"@babel/core": "^7.18.9",
|
|
45
|
+
"@babel/plugin-proposal-decorators": "^7.18.9",
|
|
46
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
47
|
+
"@babel/plugin-transform-runtime": "^7.18.9",
|
|
48
|
+
"@babel/preset-env": "^7.18.9",
|
|
49
|
+
"@babel/preset-react": "^7.18.6",
|
|
50
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
51
|
+
"@babel/runtime-corejs3": "^7.18.9",
|
|
52
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
53
|
+
"@statoscope/webpack-plugin": "^5.24.0",
|
|
54
|
+
"@types/columnify": "^1.5.1",
|
|
55
|
+
"@types/lodash": "^4.14.182",
|
|
56
|
+
"@types/node": "^18.6.2",
|
|
57
|
+
"@types/node-notifier": "^8.0.2",
|
|
58
|
+
"@types/resolve-bin": "^0.4.1",
|
|
59
|
+
"@types/webpack-config-utils": "^2.3.1",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
61
|
+
"@typescript-eslint/parser": "^5.31.0",
|
|
62
|
+
autoprefixer: "^10.4.7",
|
|
63
|
+
"babel-loader": "^8.2.5",
|
|
64
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
65
|
+
"babel-plugin-lodash": "^3.3.4",
|
|
66
|
+
chalk: "^5.0.1",
|
|
67
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
68
|
+
columnify: "^1.6.0",
|
|
69
|
+
commander: "^9.4.0",
|
|
70
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
71
|
+
"core-js": "^3.24.0",
|
|
72
|
+
"css-loader": "^6.7.1",
|
|
73
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
74
|
+
dotenv: "^16.0.1",
|
|
75
|
+
"dotenv-expand": "^8.0.3",
|
|
76
|
+
"escape-string-regexp": "^5.0.0",
|
|
77
|
+
eslint: "^8.20.0",
|
|
78
|
+
"eslint-config-prettier": "^8.5.0",
|
|
79
|
+
"eslint-plugin-node": "^11.1.0",
|
|
80
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
81
|
+
"eslint-webpack-plugin": "^3.2.0",
|
|
82
|
+
execa: "^6.1.0",
|
|
83
|
+
"file-loader": "^6.2.0",
|
|
84
|
+
"fork-ts-checker-webpack-plugin": "^7.2.13",
|
|
85
|
+
glob: "^8.0.3",
|
|
86
|
+
"html-loader": "^4.1.0",
|
|
87
|
+
"html-webpack-plugin": "^5.5.0",
|
|
88
|
+
"json-loader": "^0.5.7",
|
|
89
|
+
lodash: "^4.17.21",
|
|
90
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
91
|
+
"node-notifier": "^10.0.1",
|
|
92
|
+
portfinder: "^1.0.28",
|
|
93
|
+
postcss: "^8.4.14",
|
|
94
|
+
"postcss-custom-properties": "^12.1.7",
|
|
95
|
+
"postcss-loader": "^7.0.1",
|
|
96
|
+
prettier: "^2.7.1",
|
|
97
|
+
"react-refresh": "^0.14.0",
|
|
98
|
+
"resolve-url-loader": "^5.0.0",
|
|
99
|
+
sass: "^1.54.0",
|
|
100
|
+
"sass-loader": "^13.0.2",
|
|
101
|
+
"source-map-loader": "^4.0.0",
|
|
102
|
+
"strip-indent": "^4.0.0",
|
|
103
|
+
"style-loader": "^3.3.1",
|
|
104
|
+
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
105
|
+
tsup: "^6.2.0",
|
|
106
|
+
typescript: "^4.7.4",
|
|
107
|
+
"url-loader": "^4.1.1",
|
|
108
|
+
webpack: "^5.74.0",
|
|
109
|
+
"webpack-cli": "^4.10.0",
|
|
110
|
+
"webpack-config-utils": "^2.3.1",
|
|
111
|
+
"webpack-dev-server": "^4.9.3",
|
|
112
|
+
"yaml-loader": "^0.8.0"
|
|
113
|
+
}
|
|
121
114
|
};
|
|
122
115
|
|
|
123
116
|
// src/lib/constants.ts
|
|
@@ -135,7 +128,10 @@ var dev = async (options) => {
|
|
|
135
128
|
assertOptionsValid(options);
|
|
136
129
|
const flags = (await prepareFlags([], options)).join(" ");
|
|
137
130
|
const { ifCore } = getIfCoreFns();
|
|
138
|
-
const title = ifCore(
|
|
131
|
+
const title = ifCore(
|
|
132
|
+
"Running dev web-server for Tamaro Core \u2026",
|
|
133
|
+
"Running dev web-server for customer configuration \u2026"
|
|
134
|
+
);
|
|
139
135
|
const wpBin = resolveBin("webpack");
|
|
140
136
|
const wpConfig = resolveOwn("dist/webpack.config.js");
|
|
141
137
|
const cmd = `
|
|
@@ -259,7 +255,10 @@ var build = async (options) => {
|
|
|
259
255
|
const { ifCore } = getIfCoreFns();
|
|
260
256
|
const paths = getPaths(ifCore);
|
|
261
257
|
const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
262
|
-
const title = ifCore(
|
|
258
|
+
const title = ifCore(
|
|
259
|
+
"Building optimised (minified) bundle of Tamaro Core \u2026",
|
|
260
|
+
`Building optimised (minified) bundle of \u201C${configName}\u201D customer configuration \u2026`
|
|
261
|
+
);
|
|
263
262
|
const wpBin = resolveBin("webpack");
|
|
264
263
|
const wpConfig = resolveOwn("dist/webpack.config.js");
|
|
265
264
|
const cmd = `
|
|
@@ -328,7 +327,10 @@ var deploy = async (options) => {
|
|
|
328
327
|
logTitle("Deploying to AWS S3 \u2026");
|
|
329
328
|
logCommand(cmdSyncAll);
|
|
330
329
|
try {
|
|
331
|
-
withAwsAuthenticate(
|
|
330
|
+
withAwsAuthenticate(
|
|
331
|
+
() => runCommandSync(cmdSyncAll, { stdout: "inherit" }),
|
|
332
|
+
options
|
|
333
|
+
);
|
|
332
334
|
} catch (error) {
|
|
333
335
|
halt(error.stderr);
|
|
334
336
|
}
|
|
@@ -340,7 +342,10 @@ var deploy = async (options) => {
|
|
|
340
342
|
`;
|
|
341
343
|
logCommand(cmdCpEntry);
|
|
342
344
|
try {
|
|
343
|
-
withAwsAuthenticate(
|
|
345
|
+
withAwsAuthenticate(
|
|
346
|
+
() => runCommandSync(cmdCpEntry, { stdout: "inherit" }),
|
|
347
|
+
options
|
|
348
|
+
);
|
|
344
349
|
} catch (error) {
|
|
345
350
|
halt(error.stderr);
|
|
346
351
|
}
|
|
@@ -383,16 +388,20 @@ var assertOptionsValid3 = (options) => {
|
|
|
383
388
|
};
|
|
384
389
|
var assertDistPathExists = (distPath) => {
|
|
385
390
|
if (!existsSync(distPath)) {
|
|
386
|
-
halt(
|
|
391
|
+
halt(
|
|
392
|
+
stripIndent3(`
|
|
387
393
|
Dist folder does not exists.
|
|
388
394
|
Make sure you have built the bundle before trying to deploy it.
|
|
389
|
-
`)
|
|
395
|
+
`)
|
|
396
|
+
);
|
|
390
397
|
}
|
|
391
398
|
};
|
|
392
399
|
var assertTagValid = (tag) => {
|
|
393
400
|
const regex = /^[a-zA-Z0-9-_.]+$/;
|
|
394
401
|
if (!regex.test(tag)) {
|
|
395
|
-
halt(
|
|
402
|
+
halt(
|
|
403
|
+
`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex.toString()}.`
|
|
404
|
+
);
|
|
396
405
|
}
|
|
397
406
|
};
|
|
398
407
|
var prepareFlags4 = (flags, options) => {
|
|
@@ -434,7 +443,7 @@ var listDeployed = async (options) => {
|
|
|
434
443
|
const flags = prepareFlags6([], options).join(" ");
|
|
435
444
|
const { config } = options;
|
|
436
445
|
const { ifCore } = getIfCoreFns();
|
|
437
|
-
const configName = config
|
|
446
|
+
const configName = config ?? ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
438
447
|
const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of \u201C${configName}\u201D customer configuration \u2026`;
|
|
439
448
|
const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/`;
|
|
440
449
|
const cmd = `aws s3 ls ${deployUrl} ${flags}`;
|
|
@@ -474,7 +483,9 @@ var assertConfigValid = (config) => {
|
|
|
474
483
|
}
|
|
475
484
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
476
485
|
if (!regex.test(config)) {
|
|
477
|
-
halt(
|
|
486
|
+
halt(
|
|
487
|
+
`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex.toString()}.`
|
|
488
|
+
);
|
|
478
489
|
}
|
|
479
490
|
};
|
|
480
491
|
var prepareFlags6 = (flags, options) => {
|
|
@@ -504,14 +515,18 @@ var deployEmailConfig = async (options) => {
|
|
|
504
515
|
--exact-timestamps
|
|
505
516
|
${flags}
|
|
506
517
|
`;
|
|
507
|
-
logTitle(
|
|
518
|
+
logTitle(
|
|
519
|
+
`Deploying email configuration for \u201C${configName}\u201D customer configuration to AWS S3 \u2026`
|
|
520
|
+
);
|
|
508
521
|
logCommand(cmd);
|
|
509
522
|
try {
|
|
510
523
|
withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }), options);
|
|
511
524
|
} catch (error) {
|
|
512
525
|
halt(error.stderr);
|
|
513
526
|
}
|
|
514
|
-
logTitle(
|
|
527
|
+
logTitle(
|
|
528
|
+
`Email configuration for \u201C${configName}\u201D customer configuration is deployed.`
|
|
529
|
+
);
|
|
515
530
|
logDataTable({ "Deploy URL:": deployUrl });
|
|
516
531
|
process.on("exit", () => {
|
|
517
532
|
notify({
|
|
@@ -533,7 +548,9 @@ var assertEmailConfigPathExists = (distPath) => {
|
|
|
533
548
|
var assertBucketValid = (tag) => {
|
|
534
549
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
535
550
|
if (!regex.test(tag)) {
|
|
536
|
-
halt(
|
|
551
|
+
halt(
|
|
552
|
+
`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex.toString()}.`
|
|
553
|
+
);
|
|
537
554
|
}
|
|
538
555
|
};
|
|
539
556
|
var assertIsNotCore = () => {
|
|
@@ -554,10 +571,34 @@ process.on("SIGINT", () => {
|
|
|
554
571
|
process.exit(1);
|
|
555
572
|
});
|
|
556
573
|
var cli = createCommand().name(package_default.name).version(package_default.version, "-v, --version");
|
|
557
|
-
cli.command("dev").description(
|
|
574
|
+
cli.command("dev").description(
|
|
575
|
+
"Run the local development server for Tamaro Core or a particular customer configuration"
|
|
576
|
+
).option(
|
|
577
|
+
"--local-core",
|
|
578
|
+
"Load Tamaro Core from localhost:1234 instead of the CDN",
|
|
579
|
+
false
|
|
580
|
+
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").action(async (options) => {
|
|
558
581
|
await dev(options);
|
|
559
582
|
});
|
|
560
|
-
cli.command("build").description(
|
|
583
|
+
cli.command("build").description(
|
|
584
|
+
"Build an optimised (minified) bundle of Tamaro Core or a customer configuration"
|
|
585
|
+
).option(
|
|
586
|
+
"--local-core",
|
|
587
|
+
"Load Tamaro Core from localhost:1234 instead of the CDN",
|
|
588
|
+
false
|
|
589
|
+
).option("--analyze", 'Generate bundle statistics to "reports" folder', false).option("--serve", "Run the generated bundle with a local web server", false).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option(
|
|
590
|
+
"--deploy",
|
|
591
|
+
"Deploy Tamaro Core or a customer configuration bundle to AWS S3",
|
|
592
|
+
false
|
|
593
|
+
).option(
|
|
594
|
+
"--tag <tag>",
|
|
595
|
+
"Tag which should be used for the deployment of the bundle",
|
|
596
|
+
DEFAULT_TAG
|
|
597
|
+
).option(
|
|
598
|
+
"--profile <profile>",
|
|
599
|
+
"AWS profile which should be used for the deployment of the bundle",
|
|
600
|
+
DEFAULT_AWS_PROFILE
|
|
601
|
+
).action(async (options) => {
|
|
561
602
|
await build(options);
|
|
562
603
|
if (options.serve) {
|
|
563
604
|
await serve(options);
|
|
@@ -569,13 +610,40 @@ cli.command("build").description("Build an optimised (minified) bundle of Tamaro
|
|
|
569
610
|
cli.command("serve").description("Run a local web server for pre-built bundle").option("--port <port>", "Web server port", `${DEFAULT_PORT}`).action(async (options) => {
|
|
570
611
|
await serve(options);
|
|
571
612
|
});
|
|
572
|
-
cli.command("deploy").description(
|
|
613
|
+
cli.command("deploy").description(
|
|
614
|
+
"Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3"
|
|
615
|
+
).option(
|
|
616
|
+
"--tag <tag>",
|
|
617
|
+
"Tag which should be used for the deployment of the bundle",
|
|
618
|
+
DEFAULT_TAG
|
|
619
|
+
).option(
|
|
620
|
+
"--profile <profile>",
|
|
621
|
+
"AWS profile which should be used for the deployment of the bundle",
|
|
622
|
+
DEFAULT_AWS_PROFILE
|
|
623
|
+
).action(async (options) => {
|
|
573
624
|
await deploy(options);
|
|
574
625
|
});
|
|
575
|
-
cli.command("list-deployed").description(
|
|
626
|
+
cli.command("list-deployed").description(
|
|
627
|
+
"List deployments of Tamaro Core or a particular customer configuration"
|
|
628
|
+
).option(
|
|
629
|
+
"--config <config>",
|
|
630
|
+
"Configuration name (default: current customer configuration)"
|
|
631
|
+
).option(
|
|
632
|
+
"--profile <profile>",
|
|
633
|
+
"AWS profile which should be used for fetching deployments",
|
|
634
|
+
DEFAULT_AWS_PROFILE
|
|
635
|
+
).action(async (options) => {
|
|
576
636
|
await listDeployed(options);
|
|
577
637
|
});
|
|
578
|
-
cli.command("deploy-email-config").description("Deploy a widget\u2019s email configuration to AWS S3").option(
|
|
638
|
+
cli.command("deploy-email-config").description("Deploy a widget\u2019s email configuration to AWS S3").option(
|
|
639
|
+
"--bucket <bucket>",
|
|
640
|
+
"AWS S3 bucket where it should be deployed",
|
|
641
|
+
DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET
|
|
642
|
+
).option(
|
|
643
|
+
"--profile <profile>",
|
|
644
|
+
"AWS profile which should be used for the deployment of email configuration",
|
|
645
|
+
DEFAULT_AWS_PROFILE
|
|
646
|
+
).action(async (options) => {
|
|
579
647
|
await deployEmailConfig(options);
|
|
580
648
|
});
|
|
581
649
|
(async () => {
|
package/dist/webpack.config.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues,
|
|
3
2
|
extensions,
|
|
4
3
|
getEnvVars,
|
|
5
4
|
getIfCoreFns,
|
|
@@ -9,7 +8,7 @@ import {
|
|
|
9
8
|
logTitle,
|
|
10
9
|
moduleFileExtensions,
|
|
11
10
|
resolveApp
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CNSEEVDD.js";
|
|
13
12
|
|
|
14
13
|
// src/webpack.config.ts
|
|
15
14
|
import { createRequire } from "module";
|
|
@@ -36,21 +35,23 @@ var PLUGIN_NAME = "InterpolateHtmlPlugin";
|
|
|
36
35
|
var InterpolateHtmlPlugin = class {
|
|
37
36
|
replacements;
|
|
38
37
|
constructor(replacements) {
|
|
39
|
-
this.replacements =
|
|
38
|
+
this.replacements = { ...replacements };
|
|
40
39
|
}
|
|
41
40
|
apply(compiler) {
|
|
42
41
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
43
42
|
const hooks = HtmlWebpackPlugin.getHooks(compilation);
|
|
44
43
|
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
45
|
-
|
|
46
|
-
const publicUrl = (_a = this.replacements["PUBLIC_URL"]) != null ? _a : "";
|
|
44
|
+
const publicUrl = this.replacements["PUBLIC_URL"] ?? "";
|
|
47
45
|
const entry = assets.headTags[0].attributes["src"];
|
|
48
46
|
this.replacements["ENTRY"] = `${publicUrl}${entry}`;
|
|
49
47
|
return assets;
|
|
50
48
|
});
|
|
51
49
|
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
52
50
|
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
53
|
-
data.html = data.html.replace(
|
|
51
|
+
data.html = data.html.replace(
|
|
52
|
+
new RegExp(`%${escapeStringRegexp(key)}%`, "g"),
|
|
53
|
+
value || ""
|
|
54
|
+
);
|
|
54
55
|
});
|
|
55
56
|
return data;
|
|
56
57
|
});
|
|
@@ -89,10 +90,11 @@ var getWebpackConfig = async (env) => {
|
|
|
89
90
|
}),
|
|
90
91
|
{
|
|
91
92
|
loader: require2.resolve("css-loader"),
|
|
92
|
-
options:
|
|
93
|
+
options: {
|
|
93
94
|
sourceMap: ifNotMin(),
|
|
94
|
-
importLoaders: 3
|
|
95
|
-
|
|
95
|
+
importLoaders: 3,
|
|
96
|
+
...cssOptions
|
|
97
|
+
}
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
100
|
loader: require2.resolve("postcss-loader"),
|
|
@@ -145,16 +147,19 @@ var getWebpackConfig = async (env) => {
|
|
|
145
147
|
crossOriginLoading: "anonymous",
|
|
146
148
|
uniqueName: process.env.WEBPACK_UNIQUE_NAME
|
|
147
149
|
},
|
|
148
|
-
stats: ifAnalyze(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
stats: ifAnalyze(
|
|
151
|
+
{
|
|
152
|
+
all: void 0
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
modules: false,
|
|
156
|
+
children: false,
|
|
157
|
+
chunks: false,
|
|
158
|
+
env: true,
|
|
159
|
+
entrypoints: true,
|
|
160
|
+
errorDetails: true
|
|
161
|
+
}
|
|
162
|
+
),
|
|
158
163
|
module: {
|
|
159
164
|
rules: removeEmpty([
|
|
160
165
|
ifNotMin({
|
|
@@ -167,11 +172,14 @@ var getWebpackConfig = async (env) => {
|
|
|
167
172
|
oneOf: [
|
|
168
173
|
{
|
|
169
174
|
test: /\.(js|ts)x?$/,
|
|
170
|
-
include: ifCore(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
+
include: ifCore(
|
|
176
|
+
[
|
|
177
|
+
resolveApp("src"),
|
|
178
|
+
resolveApp("node_modules/micromark"),
|
|
179
|
+
resolveApp("node_modules/decode-named-character-reference")
|
|
180
|
+
],
|
|
181
|
+
[resolveApp("."), resolveApp("../../src")]
|
|
182
|
+
),
|
|
175
183
|
loader: require2.resolve("babel-loader"),
|
|
176
184
|
options: {
|
|
177
185
|
babelrc: false,
|
|
@@ -196,7 +204,9 @@ var getWebpackConfig = async (env) => {
|
|
|
196
204
|
version: 3,
|
|
197
205
|
proposals: true
|
|
198
206
|
},
|
|
199
|
-
absoluteRuntime: dirname(
|
|
207
|
+
absoluteRuntime: dirname(
|
|
208
|
+
require2.resolve("@babel/runtime-corejs3/package.json")
|
|
209
|
+
)
|
|
200
210
|
}
|
|
201
211
|
],
|
|
202
212
|
[
|
|
@@ -207,7 +217,8 @@ var getWebpackConfig = async (env) => {
|
|
|
207
217
|
],
|
|
208
218
|
require2.resolve("@babel/plugin-syntax-dynamic-import"),
|
|
209
219
|
require2.resolve("babel-plugin-lodash"),
|
|
210
|
-
ifHmr(require2.resolve("react-refresh/babel"))
|
|
220
|
+
ifHmr(require2.resolve("react-refresh/babel")),
|
|
221
|
+
ifNotMin(require2.resolve("babel-plugin-istanbul"))
|
|
211
222
|
])
|
|
212
223
|
}
|
|
213
224
|
},
|
|
@@ -271,6 +282,7 @@ var getWebpackConfig = async (env) => {
|
|
|
271
282
|
headers: {
|
|
272
283
|
"Access-Control-Allow-Origin": "*"
|
|
273
284
|
},
|
|
285
|
+
allowedHosts: "all",
|
|
274
286
|
client: {
|
|
275
287
|
overlay: {
|
|
276
288
|
warnings: false,
|
|
@@ -290,13 +302,17 @@ var getWebpackConfig = async (env) => {
|
|
|
290
302
|
cwd: paths.app,
|
|
291
303
|
resolvePluginsRelativeTo: paths.app
|
|
292
304
|
}),
|
|
293
|
-
ifMin(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
305
|
+
ifMin(
|
|
306
|
+
new CleanWebpackPlugin({})
|
|
307
|
+
),
|
|
308
|
+
...appHtmlFiles.map(
|
|
309
|
+
(file) => new HtmlWebpackPlugin2({
|
|
310
|
+
template: file,
|
|
311
|
+
filename: basename(file),
|
|
312
|
+
inject: false,
|
|
313
|
+
minify: false
|
|
314
|
+
})
|
|
315
|
+
),
|
|
300
316
|
new InterpolateHtmlPlugin(envVars.raw),
|
|
301
317
|
new webpack.DefinePlugin(envVars.stringified),
|
|
302
318
|
new ForkTsCheckerWebpackPlugin({
|
|
@@ -315,14 +331,16 @@ var getWebpackConfig = async (env) => {
|
|
|
315
331
|
}
|
|
316
332
|
}),
|
|
317
333
|
ifHmr(new ReactRefreshWebpackPlugin()),
|
|
318
|
-
ifMin(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
334
|
+
ifMin(
|
|
335
|
+
new MiniCssExtractPlugin({
|
|
336
|
+
filename: "[name]-[contenthash:16].css",
|
|
337
|
+
chunkFilename: "[name]-[contenthash:16].css",
|
|
338
|
+
ignoreOrder: true,
|
|
339
|
+
attributes: {
|
|
340
|
+
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
),
|
|
326
344
|
new webpack.IgnorePlugin({
|
|
327
345
|
resourceRegExp: /^\.\/locale$/,
|
|
328
346
|
contextRegExp: /moment$/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "RaiseNow",
|
|
6
6
|
"email": "development@raisenow.com"
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"prepare": "npm run build",
|
|
11
11
|
"start": "npm run dev",
|
|
12
|
-
"build": "tsup src/cli.ts src/webpack.config.ts --clean --format esm",
|
|
12
|
+
"build": "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
13
13
|
"build:watch": "npm run build -- --watch --ignore-watch .idea",
|
|
14
14
|
"docs": "npx -y http-server . --cors -o /readme.html",
|
|
15
|
-
"lint": "eslint
|
|
15
|
+
"lint": "eslint --fix . && prettier --write ."
|
|
16
16
|
},
|
|
17
17
|
"bin": "dist/cli.js",
|
|
18
18
|
"engines": {
|
|
@@ -20,74 +20,75 @@
|
|
|
20
20
|
"npm": ">=8"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/cli": "^7.
|
|
24
|
-
"@babel/core": "^7.
|
|
25
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
23
|
+
"@babel/cli": "^7.18.9",
|
|
24
|
+
"@babel/core": "^7.18.9",
|
|
25
|
+
"@babel/plugin-proposal-decorators": "^7.18.9",
|
|
26
26
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
28
|
-
"@babel/preset-env": "^7.
|
|
29
|
-
"@babel/preset-react": "^7.
|
|
30
|
-
"@babel/preset-typescript": "^7.
|
|
31
|
-
"@babel/runtime-corejs3": "^7.
|
|
32
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.
|
|
33
|
-
"@statoscope/webpack-plugin": "^5.
|
|
27
|
+
"@babel/plugin-transform-runtime": "^7.18.9",
|
|
28
|
+
"@babel/preset-env": "^7.18.9",
|
|
29
|
+
"@babel/preset-react": "^7.18.6",
|
|
30
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
31
|
+
"@babel/runtime-corejs3": "^7.18.9",
|
|
32
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
33
|
+
"@statoscope/webpack-plugin": "^5.24.0",
|
|
34
34
|
"@types/columnify": "^1.5.1",
|
|
35
35
|
"@types/lodash": "^4.14.182",
|
|
36
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^18.6.2",
|
|
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.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.31.0",
|
|
42
42
|
"autoprefixer": "^10.4.7",
|
|
43
43
|
"babel-loader": "^8.2.5",
|
|
44
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
44
45
|
"babel-plugin-lodash": "^3.3.4",
|
|
45
46
|
"chalk": "^5.0.1",
|
|
46
47
|
"clean-webpack-plugin": "^4.0.0",
|
|
47
48
|
"columnify": "^1.6.0",
|
|
48
|
-
"commander": "^9.
|
|
49
|
+
"commander": "^9.4.0",
|
|
49
50
|
"copy-webpack-plugin": "^11.0.0",
|
|
50
|
-
"core-js": "^3.
|
|
51
|
+
"core-js": "^3.24.0",
|
|
51
52
|
"css-loader": "^6.7.1",
|
|
52
|
-
"css-minimizer-webpack-plugin": "^
|
|
53
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
53
54
|
"dotenv": "^16.0.1",
|
|
54
55
|
"dotenv-expand": "^8.0.3",
|
|
55
56
|
"escape-string-regexp": "^5.0.0",
|
|
56
|
-
"eslint": "^8.
|
|
57
|
+
"eslint": "^8.20.0",
|
|
57
58
|
"eslint-config-prettier": "^8.5.0",
|
|
58
59
|
"eslint-plugin-node": "^11.1.0",
|
|
59
60
|
"eslint-plugin-promise": "^6.0.0",
|
|
60
|
-
"eslint-webpack-plugin": "^3.
|
|
61
|
+
"eslint-webpack-plugin": "^3.2.0",
|
|
61
62
|
"execa": "^6.1.0",
|
|
62
63
|
"file-loader": "^6.2.0",
|
|
63
|
-
"fork-ts-checker-webpack-plugin": "^7.2.
|
|
64
|
+
"fork-ts-checker-webpack-plugin": "^7.2.13",
|
|
64
65
|
"glob": "^8.0.3",
|
|
65
|
-
"html-loader": "^
|
|
66
|
+
"html-loader": "^4.1.0",
|
|
66
67
|
"html-webpack-plugin": "^5.5.0",
|
|
67
68
|
"json-loader": "^0.5.7",
|
|
68
69
|
"lodash": "^4.17.21",
|
|
69
|
-
"mini-css-extract-plugin": "^2.6.
|
|
70
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
70
71
|
"node-notifier": "^10.0.1",
|
|
71
72
|
"portfinder": "^1.0.28",
|
|
72
|
-
"postcss": "^8.4.
|
|
73
|
+
"postcss": "^8.4.14",
|
|
73
74
|
"postcss-custom-properties": "^12.1.7",
|
|
74
|
-
"postcss-loader": "^
|
|
75
|
-
"prettier": "^2.
|
|
76
|
-
"react-refresh": "^0.
|
|
75
|
+
"postcss-loader": "^7.0.1",
|
|
76
|
+
"prettier": "^2.7.1",
|
|
77
|
+
"react-refresh": "^0.14.0",
|
|
77
78
|
"resolve-url-loader": "^5.0.0",
|
|
78
|
-
"sass": "^1.
|
|
79
|
-
"sass-loader": "^
|
|
80
|
-
"source-map-loader": "^
|
|
79
|
+
"sass": "^1.54.0",
|
|
80
|
+
"sass-loader": "^13.0.2",
|
|
81
|
+
"source-map-loader": "^4.0.0",
|
|
81
82
|
"strip-indent": "^4.0.0",
|
|
82
83
|
"style-loader": "^3.3.1",
|
|
83
84
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
84
|
-
"tsup": "^
|
|
85
|
-
"typescript": "^4.
|
|
85
|
+
"tsup": "^6.2.0",
|
|
86
|
+
"typescript": "^4.7.4",
|
|
86
87
|
"url-loader": "^4.1.1",
|
|
87
|
-
"webpack": "^5.
|
|
88
|
-
"webpack-cli": "^4.
|
|
88
|
+
"webpack": "^5.74.0",
|
|
89
|
+
"webpack-cli": "^4.10.0",
|
|
89
90
|
"webpack-config-utils": "^2.3.1",
|
|
90
|
-
"webpack-dev-server": "^4.9.
|
|
91
|
+
"webpack-dev-server": "^4.9.3",
|
|
91
92
|
"yaml-loader": "^0.8.0"
|
|
92
93
|
}
|
|
93
94
|
}
|
package/src/cli.ts
CHANGED
|
@@ -159,11 +159,13 @@ cli
|
|
|
159
159
|
})
|
|
160
160
|
|
|
161
161
|
///////////////////////////////////////////////////////////////////////////////
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
162
163
|
;(async () => {
|
|
163
164
|
try {
|
|
164
165
|
await cli.parseAsync(process.argv)
|
|
165
166
|
} catch (error: any) {
|
|
166
167
|
if (error.signal === 'SIGINT' && error.signalDescription) {
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
167
169
|
logError(`\n${error.signalDescription}`)
|
|
168
170
|
} else {
|
|
169
171
|
console.log('')
|
|
@@ -91,7 +91,9 @@ const assertBucketValid = (tag: string) => {
|
|
|
91
91
|
const regex = /^[a-zA-Z0-9-_]+$/
|
|
92
92
|
|
|
93
93
|
if (!regex.test(tag)) {
|
|
94
|
-
halt(
|
|
94
|
+
halt(
|
|
95
|
+
`Flag “--bucket” has forbidden format. Allowed format: ${regex.toString()}.`,
|
|
96
|
+
)
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
|
package/src/commands/deploy.ts
CHANGED
|
@@ -154,7 +154,9 @@ const assertTagValid = (tag: string) => {
|
|
|
154
154
|
const regex = /^[a-zA-Z0-9-_.]+$/
|
|
155
155
|
|
|
156
156
|
if (!regex.test(tag)) {
|
|
157
|
-
halt(
|
|
157
|
+
halt(
|
|
158
|
+
`Flag “--tag” has forbidden format. Allowed format: ${regex.toString()}.`,
|
|
159
|
+
)
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -88,7 +88,9 @@ const assertConfigValid = (config: string | undefined) => {
|
|
|
88
88
|
const regex = /^[a-zA-Z0-9-_]+$/
|
|
89
89
|
|
|
90
90
|
if (!regex.test(config)) {
|
|
91
|
-
halt(
|
|
91
|
+
halt(
|
|
92
|
+
`Flag “--config” has forbidden format. Allowed format: ${regex.toString()}.`,
|
|
93
|
+
)
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
|
|
@@ -4,7 +4,7 @@ import escapeStringRegexp from 'escape-string-regexp'
|
|
|
4
4
|
|
|
5
5
|
///////////////////////////////////////////////////////////////////////////////
|
|
6
6
|
|
|
7
|
-
export type Replacements = {[key: string]:
|
|
7
|
+
export type Replacements = {[key: string]: string | undefined}
|
|
8
8
|
|
|
9
9
|
///////////////////////////////////////////////////////////////////////////////
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ export class InterpolateHtmlPlugin {
|
|
|
25
25
|
|
|
26
26
|
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
27
27
|
const publicUrl = this.replacements['PUBLIC_URL'] ?? ''
|
|
28
|
-
const entry = assets.headTags[0].attributes['src']
|
|
28
|
+
const entry = assets.headTags[0].attributes['src'] as string
|
|
29
29
|
this.replacements['ENTRY'] = `${publicUrl}${entry}`
|
|
30
30
|
|
|
31
31
|
return assets
|
|
@@ -36,7 +36,7 @@ export class InterpolateHtmlPlugin {
|
|
|
36
36
|
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
37
37
|
data.html = data.html.replace(
|
|
38
38
|
new RegExp(`%${escapeStringRegexp(key)}%`, 'g'),
|
|
39
|
-
value,
|
|
39
|
+
value || '',
|
|
40
40
|
)
|
|
41
41
|
})
|
|
42
42
|
|
package/src/lib/resolve.ts
CHANGED
|
@@ -20,6 +20,7 @@ export const extensions = moduleFileExtensions.map((v) => `.${v}`)
|
|
|
20
20
|
|
|
21
21
|
const TAMARO_CORE_PACKAGE_NAMES = ['@raisenow/tamaro-core']
|
|
22
22
|
const TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ['@raisenow/tamaro-configurations']
|
|
23
|
+
const TAMARO_SELF_SERVICE_PACKAGE_NAMES = ['@raisenow/tamaro-self-service']
|
|
23
24
|
|
|
24
25
|
///////////////////////////////////////////////////////////////////////////////
|
|
25
26
|
|
|
@@ -52,7 +53,7 @@ export const resolveBin = (name: string) => {
|
|
|
52
53
|
const pkgPath = require.resolve(`${name}/package.json`)
|
|
53
54
|
const {bin} = require(pkgPath)
|
|
54
55
|
const dir = dirname(pkgPath)
|
|
55
|
-
const binPath = typeof bin === 'object' ? bin[name] : bin
|
|
56
|
+
const binPath: string = typeof bin === 'object' ? bin[name] : bin
|
|
56
57
|
|
|
57
58
|
return join(dir, binPath)
|
|
58
59
|
}
|
|
@@ -111,23 +112,18 @@ export const getRelativePaths = (paths: Paths): Paths => {
|
|
|
111
112
|
export const getIfCoreFns = (): IfUtils => {
|
|
112
113
|
const corePkgPath = resolveApp('package.json')
|
|
113
114
|
const configsPkgPath = resolveApp('../../package.json')
|
|
115
|
+
let packageName
|
|
114
116
|
|
|
115
117
|
if (existsSync(corePkgPath)) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
|
|
120
|
-
return getIfUtils({core: true}, ['core'])
|
|
121
|
-
}
|
|
118
|
+
packageName = require(corePkgPath).name
|
|
119
|
+
} else if (existsSync(configsPkgPath)) {
|
|
120
|
+
packageName = require(configsPkgPath).name
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
|
|
129
|
-
return getIfUtils({core: false}, ['core'])
|
|
130
|
-
}
|
|
123
|
+
if (packageName) {
|
|
124
|
+
return getIfUtils({core: TAMARO_CORE_PACKAGE_NAMES.includes(packageName)}, [
|
|
125
|
+
'core',
|
|
126
|
+
])
|
|
131
127
|
}
|
|
132
128
|
|
|
133
129
|
logError(
|
|
@@ -137,6 +133,9 @@ export const getIfCoreFns = (): IfUtils => {
|
|
|
137
133
|
2. Root of particular customer configuration folder of "${chalk.bold(
|
|
138
134
|
TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0],
|
|
139
135
|
)}" package.
|
|
136
|
+
3. "src/self-service" folder of "${chalk.bold(
|
|
137
|
+
TAMARO_SELF_SERVICE_PACKAGE_NAMES[0],
|
|
138
|
+
)}" package.
|
|
140
139
|
You are currently in "${chalk.bold(realpathSync(process.cwd()))}".
|
|
141
140
|
`),
|
|
142
141
|
)
|
package/src/webpack.config.ts
CHANGED
|
@@ -206,6 +206,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
|
|
|
206
206
|
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
|
207
207
|
require.resolve('babel-plugin-lodash'),
|
|
208
208
|
ifHmr(require.resolve('react-refresh/babel')),
|
|
209
|
+
ifNotMin(require.resolve('babel-plugin-istanbul')),
|
|
209
210
|
]),
|
|
210
211
|
},
|
|
211
212
|
},
|
|
@@ -286,6 +287,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
|
|
|
286
287
|
headers: {
|
|
287
288
|
'Access-Control-Allow-Origin': '*',
|
|
288
289
|
},
|
|
290
|
+
allowedHosts: 'all',
|
|
289
291
|
client: {
|
|
290
292
|
overlay: {
|
|
291
293
|
warnings: false,
|
|
@@ -366,7 +368,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
|
|
|
366
368
|
chunkFilename: '[name]-[contenthash:16].css',
|
|
367
369
|
ignoreOrder: true,
|
|
368
370
|
attributes: {
|
|
369
|
-
'data-widget':
|
|
371
|
+
'data-widget': process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET!,
|
|
370
372
|
},
|
|
371
373
|
}),
|
|
372
374
|
),
|