@raisenow/tamaro-cli 1.0.15 → 1.0.18
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/.nvmrc +1 -1
- package/.prettierignore +2 -0
- package/dist/{chunk-BWJBN44Y.js → chunk-XKMRWPOF.js} +19 -18
- package/dist/cli.js +39 -41
- package/dist/webpack.config.js +5 -6
- package/package.json +34 -34
- package/readme.html +2 -1
- package/src/cli.ts +2 -0
- package/src/commands/deploy-email-config.ts +3 -1
- package/src/commands/deploy.ts +3 -3
- 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 +2 -2
- 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/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
16.
|
|
1
|
+
16.15.0
|
package/.prettierignore
CHANGED
|
@@ -56,6 +56,7 @@ var moduleFileExtensions = ["ts", "tsx", "js", "jsx"];
|
|
|
56
56
|
var extensions = moduleFileExtensions.map((v) => `.${v}`);
|
|
57
57
|
var TAMARO_CORE_PACKAGE_NAMES = ["@raisenow/tamaro-core"];
|
|
58
58
|
var TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ["@raisenow/tamaro-configurations"];
|
|
59
|
+
var TAMARO_SELF_SERVICE_PACKAGE_NAMES = ["@raisenow/tamaro-self-service"];
|
|
59
60
|
var resolveApp = (relativePath) => resolve(realpathSync(process.cwd()), relativePath);
|
|
60
61
|
var resolveOwn = (relativePath) => resolve(__dirname, "..", relativePath);
|
|
61
62
|
var resolveModule = (resolveFn, filePath) => {
|
|
@@ -106,21 +107,21 @@ var getRelativePaths = (paths) => {
|
|
|
106
107
|
var getIfCoreFns = () => {
|
|
107
108
|
const corePkgPath = resolveApp("package.json");
|
|
108
109
|
const configsPkgPath = resolveApp("../../package.json");
|
|
110
|
+
let packageName;
|
|
109
111
|
if (existsSync(corePkgPath)) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
112
|
+
packageName = require2(corePkgPath).name;
|
|
113
|
+
} else if (existsSync(configsPkgPath)) {
|
|
114
|
+
packageName = require2(configsPkgPath).name;
|
|
114
115
|
}
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
116
|
+
if (packageName) {
|
|
117
|
+
return getIfUtils({ core: TAMARO_CORE_PACKAGE_NAMES.includes(packageName) }, [
|
|
118
|
+
"core"
|
|
119
|
+
]);
|
|
120
120
|
}
|
|
121
121
|
logError(stripIndent2(` You must run "npx @raisenow/tamaro-cli" commands from:
|
|
122
122
|
1. Root of "${chalk2.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
|
|
123
123
|
2. Root of particular customer configuration folder of "${chalk2.bold(TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0])}" package.
|
|
124
|
+
3. "src/self-service" folder of "${chalk2.bold(TAMARO_SELF_SERVICE_PACKAGE_NAMES[0])}" package.
|
|
124
125
|
You are currently in "${chalk2.bold(realpathSync(process.cwd()))}".
|
|
125
126
|
`));
|
|
126
127
|
process.exit(1);
|
|
@@ -150,17 +151,17 @@ var runCommandSync = (cmd, options) => {
|
|
|
150
151
|
// src/lib/env.ts
|
|
151
152
|
var require3 = createRequire2(import.meta.url);
|
|
152
153
|
var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
154
155
|
const filePath = files.find((file) => basename2(file) === ".env");
|
|
155
156
|
dotenvExpand(dotenvConfig({ path: filePath }));
|
|
156
|
-
(
|
|
157
|
-
(
|
|
158
|
-
(
|
|
159
|
-
(
|
|
160
|
-
(
|
|
157
|
+
(_a = process.env).NODE_ENV ?? (_a.NODE_ENV = ifMin("production", "development"));
|
|
158
|
+
(_b = process.env).BABEL_ENV ?? (_b.BABEL_ENV = ifMin("production", "development"));
|
|
159
|
+
(_c = process.env).EXPOSE_VAR ?? (_c.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro"));
|
|
160
|
+
(_d = process.env).ELEMENT_ATTRIBUTE_DATA_WIDGET ?? (_d.ELEMENT_ATTRIBUTE_DATA_WIDGET = ifCore("rnw-tamaro-core", "rnw-tamaro"));
|
|
161
|
+
(_e = process.env).WEBPACK_UNIQUE_NAME ?? (_e.WEBPACK_UNIQUE_NAME = ifCore("RnwTamaroCore", "RnwTamaro"));
|
|
161
162
|
process.env.BUILD_DATE = new Date().toISOString();
|
|
162
|
-
(
|
|
163
|
-
(
|
|
163
|
+
(_f = process.env).PUBLIC_URL ?? (_f.PUBLIC_URL = "");
|
|
164
|
+
(_g = process.env).HMR_ENABLED ?? (_g.HMR_ENABLED = ifMin("false", "true"));
|
|
164
165
|
if (ifCore()) {
|
|
165
166
|
process.env.PRODUCT_NAME = "tamaro";
|
|
166
167
|
const corePkgPath = resolveApp("package.json");
|
|
@@ -174,7 +175,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
|
|
|
174
175
|
} else {
|
|
175
176
|
let version = process.env.CORE_VERSION;
|
|
176
177
|
version = version ? `@${version}` : "";
|
|
177
|
-
(
|
|
178
|
+
(_h = process.env).CORE_URL ?? (_h.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`);
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
const varNames = [
|
package/dist/cli.js
CHANGED
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
resolveBin,
|
|
13
13
|
resolveOwn,
|
|
14
14
|
runCommandSync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XKMRWPOF.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.18";
|
|
23
23
|
var author = {
|
|
24
24
|
name: "RaiseNow",
|
|
25
25
|
email: "development@raisenow.com"
|
|
@@ -28,10 +28,10 @@ var type = "module";
|
|
|
28
28
|
var scripts = {
|
|
29
29
|
prepare: "npm run build",
|
|
30
30
|
start: "npm run dev",
|
|
31
|
-
build: "tsup src/cli.ts src/webpack.config.ts --clean --format esm",
|
|
31
|
+
build: "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
32
32
|
"build:watch": "npm run build -- --watch --ignore-watch .idea",
|
|
33
33
|
docs: "npx -y http-server . --cors -o /readme.html",
|
|
34
|
-
lint: "eslint
|
|
34
|
+
lint: "eslint --fix . && prettier --write ."
|
|
35
35
|
};
|
|
36
36
|
var bin = "dist/cli.js";
|
|
37
37
|
var engines = {
|
|
@@ -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.
|
|
44
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
42
|
+
"@babel/cli": "^7.17.10",
|
|
43
|
+
"@babel/core": "^7.18.2",
|
|
44
|
+
"@babel/plugin-proposal-decorators": "^7.18.2",
|
|
45
45
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
46
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"@babel/preset-react": "^7.
|
|
49
|
-
"@babel/preset-typescript": "^7.
|
|
50
|
-
"@babel/runtime-corejs3": "^7.
|
|
51
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.
|
|
46
|
+
"@babel/plugin-transform-runtime": "^7.18.2",
|
|
47
|
+
"@babel/preset-env": "^7.18.2",
|
|
48
|
+
"@babel/preset-react": "^7.17.12",
|
|
49
|
+
"@babel/preset-typescript": "^7.17.12",
|
|
50
|
+
"@babel/runtime-corejs3": "^7.18.3",
|
|
51
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
52
52
|
"@statoscope/webpack-plugin": "^5.20.1",
|
|
53
53
|
"@types/columnify": "^1.5.1",
|
|
54
54
|
"@types/lodash": "^4.14.182",
|
|
55
|
-
"@types/node": "^17.0.
|
|
55
|
+
"@types/node": "^17.0.41",
|
|
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.
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
60
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
61
|
+
autoprefixer: "^10.4.7",
|
|
62
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.
|
|
68
|
-
"copy-webpack-plugin": "^
|
|
69
|
-
"core-js": "^3.22.
|
|
67
|
+
commander: "^9.3.0",
|
|
68
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
69
|
+
"core-js": "^3.22.8",
|
|
70
70
|
"css-loader": "^6.7.1",
|
|
71
|
-
"css-minimizer-webpack-plugin": "^
|
|
72
|
-
dotenv: "^16.0.
|
|
71
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
72
|
+
dotenv: "^16.0.1",
|
|
73
73
|
"dotenv-expand": "^8.0.3",
|
|
74
74
|
"escape-string-regexp": "^5.0.0",
|
|
75
|
-
eslint: "^8.
|
|
75
|
+
eslint: "^8.17.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: "^8.0.
|
|
82
|
+
"fork-ts-checker-webpack-plugin": "^7.2.11",
|
|
83
|
+
glob: "^8.0.3",
|
|
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.
|
|
91
|
+
postcss: "^8.4.14",
|
|
92
92
|
"postcss-custom-properties": "^12.1.7",
|
|
93
|
-
"postcss-loader": "^
|
|
93
|
+
"postcss-loader": "^7.0.0",
|
|
94
94
|
prettier: "^2.6.2",
|
|
95
|
-
"react-refresh": "^0.
|
|
95
|
+
"react-refresh": "^0.13.0",
|
|
96
96
|
"resolve-url-loader": "^5.0.0",
|
|
97
|
-
sass: "^1.
|
|
98
|
-
"sass-loader": "^
|
|
97
|
+
sass: "^1.52.3",
|
|
98
|
+
"sass-loader": "^13.0.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: "^
|
|
104
|
-
typescript: "^4.
|
|
103
|
+
tsup: "^6.1.0",
|
|
104
|
+
typescript: "^4.7.3",
|
|
105
105
|
"url-loader": "^4.1.1",
|
|
106
|
-
webpack: "^5.
|
|
106
|
+
webpack: "^5.73.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.9.2",
|
|
110
|
+
"yaml-loader": "^0.8.0"
|
|
111
111
|
};
|
|
112
112
|
var package_default = {
|
|
113
113
|
name,
|
|
@@ -320,7 +320,6 @@ var deploy = async (options) => {
|
|
|
320
320
|
const entryFilename = ifCore("index.js", "widget.js");
|
|
321
321
|
const cmdSyncAll = `
|
|
322
322
|
aws s3 sync ${paths.appDist} ${deployUrl}
|
|
323
|
-
--quiet
|
|
324
323
|
--acl public-read
|
|
325
324
|
--exclude ${paths.appDist}/${entryFilename}
|
|
326
325
|
--cache-control max-age=31536000
|
|
@@ -335,7 +334,6 @@ var deploy = async (options) => {
|
|
|
335
334
|
}
|
|
336
335
|
const cmdCpEntry = `
|
|
337
336
|
aws s3 cp ${paths.appDist}/${entryFilename} ${deployUrl}/${entryFilename}
|
|
338
|
-
--quiet
|
|
339
337
|
--acl public-read
|
|
340
338
|
--cache-control max-age=64800
|
|
341
339
|
${flags}
|
|
@@ -394,7 +392,7 @@ var assertDistPathExists = (distPath) => {
|
|
|
394
392
|
var assertTagValid = (tag) => {
|
|
395
393
|
const regex = /^[a-zA-Z0-9-_.]+$/;
|
|
396
394
|
if (!regex.test(tag)) {
|
|
397
|
-
halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex}.`);
|
|
395
|
+
halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
|
|
398
396
|
}
|
|
399
397
|
};
|
|
400
398
|
var prepareFlags4 = (flags, options) => {
|
|
@@ -436,7 +434,7 @@ var listDeployed = async (options) => {
|
|
|
436
434
|
const flags = prepareFlags6([], options).join(" ");
|
|
437
435
|
const { config } = options;
|
|
438
436
|
const { ifCore } = getIfCoreFns();
|
|
439
|
-
const configName = config
|
|
437
|
+
const configName = config ?? ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
440
438
|
const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of \u201C${configName}\u201D customer configuration \u2026`;
|
|
441
439
|
const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/`;
|
|
442
440
|
const cmd = `aws s3 ls ${deployUrl} ${flags}`;
|
|
@@ -476,7 +474,7 @@ var assertConfigValid = (config) => {
|
|
|
476
474
|
}
|
|
477
475
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
478
476
|
if (!regex.test(config)) {
|
|
479
|
-
halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex}.`);
|
|
477
|
+
halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
|
|
480
478
|
}
|
|
481
479
|
};
|
|
482
480
|
var prepareFlags6 = (flags, options) => {
|
|
@@ -535,7 +533,7 @@ var assertEmailConfigPathExists = (distPath) => {
|
|
|
535
533
|
var assertBucketValid = (tag) => {
|
|
536
534
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
537
535
|
if (!regex.test(tag)) {
|
|
538
|
-
halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex}.`);
|
|
536
|
+
halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
|
|
539
537
|
}
|
|
540
538
|
};
|
|
541
539
|
var assertIsNotCore = () => {
|
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-XKMRWPOF.js";
|
|
13
13
|
|
|
14
14
|
// src/webpack.config.ts
|
|
15
15
|
import { createRequire } from "module";
|
|
@@ -42,15 +42,14 @@ 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
|
-
|
|
46
|
-
const publicUrl = (_a = this.replacements["PUBLIC_URL"]) != null ? _a : "";
|
|
45
|
+
const publicUrl = this.replacements["PUBLIC_URL"] ?? "";
|
|
47
46
|
const entry = assets.headTags[0].attributes["src"];
|
|
48
47
|
this.replacements["ENTRY"] = `${publicUrl}${entry}`;
|
|
49
48
|
return assets;
|
|
50
49
|
});
|
|
51
50
|
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
52
51
|
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
53
|
-
data.html = data.html.replace(new RegExp(`%${escapeStringRegexp(key)}%`, "g"), value);
|
|
52
|
+
data.html = data.html.replace(new RegExp(`%${escapeStringRegexp(key)}%`, "g"), value || "");
|
|
54
53
|
});
|
|
55
54
|
return data;
|
|
56
55
|
});
|
|
@@ -320,7 +319,7 @@ var getWebpackConfig = async (env) => {
|
|
|
320
319
|
chunkFilename: "[name]-[contenthash:16].css",
|
|
321
320
|
ignoreOrder: true,
|
|
322
321
|
attributes: {
|
|
323
|
-
"data-widget":
|
|
322
|
+
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
324
323
|
}
|
|
325
324
|
})),
|
|
326
325
|
new webpack.IgnorePlugin({
|
|
@@ -329,7 +328,7 @@ var getWebpackConfig = async (env) => {
|
|
|
329
328
|
}),
|
|
330
329
|
ifMin(new webpack.ids.HashedModuleIdsPlugin()),
|
|
331
330
|
ifMin() && ifCore() ? new CopyPlugin({
|
|
332
|
-
patterns: ["
|
|
331
|
+
patterns: ["*.md", "*.html"]
|
|
333
332
|
}) : void 0,
|
|
334
333
|
ifMin() && ifAnalyze() ? new StatoscopeWebpackPlugin({
|
|
335
334
|
name: ifCore("tamaro-core", "tamaro-customer-config"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
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,48 +20,48 @@
|
|
|
20
20
|
"npm": ">=8"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/cli": "^7.17.
|
|
24
|
-
"@babel/core": "^7.
|
|
25
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
23
|
+
"@babel/cli": "^7.17.10",
|
|
24
|
+
"@babel/core": "^7.18.2",
|
|
25
|
+
"@babel/plugin-proposal-decorators": "^7.18.2",
|
|
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.
|
|
27
|
+
"@babel/plugin-transform-runtime": "^7.18.2",
|
|
28
|
+
"@babel/preset-env": "^7.18.2",
|
|
29
|
+
"@babel/preset-react": "^7.17.12",
|
|
30
|
+
"@babel/preset-typescript": "^7.17.12",
|
|
31
|
+
"@babel/runtime-corejs3": "^7.18.3",
|
|
32
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
33
33
|
"@statoscope/webpack-plugin": "^5.20.1",
|
|
34
34
|
"@types/columnify": "^1.5.1",
|
|
35
35
|
"@types/lodash": "^4.14.182",
|
|
36
|
-
"@types/node": "^17.0.
|
|
36
|
+
"@types/node": "^17.0.41",
|
|
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.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
41
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
42
|
+
"autoprefixer": "^10.4.7",
|
|
43
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.
|
|
49
|
-
"copy-webpack-plugin": "^
|
|
50
|
-
"core-js": "^3.22.
|
|
48
|
+
"commander": "^9.3.0",
|
|
49
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
50
|
+
"core-js": "^3.22.8",
|
|
51
51
|
"css-loader": "^6.7.1",
|
|
52
|
-
"css-minimizer-webpack-plugin": "^
|
|
53
|
-
"dotenv": "^16.0.
|
|
52
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
53
|
+
"dotenv": "^16.0.1",
|
|
54
54
|
"dotenv-expand": "^8.0.3",
|
|
55
55
|
"escape-string-regexp": "^5.0.0",
|
|
56
|
-
"eslint": "^8.
|
|
56
|
+
"eslint": "^8.17.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": "^8.0.
|
|
63
|
+
"fork-ts-checker-webpack-plugin": "^7.2.11",
|
|
64
|
+
"glob": "^8.0.3",
|
|
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.
|
|
72
|
+
"postcss": "^8.4.14",
|
|
73
73
|
"postcss-custom-properties": "^12.1.7",
|
|
74
|
-
"postcss-loader": "^
|
|
74
|
+
"postcss-loader": "^7.0.0",
|
|
75
75
|
"prettier": "^2.6.2",
|
|
76
|
-
"react-refresh": "^0.
|
|
76
|
+
"react-refresh": "^0.13.0",
|
|
77
77
|
"resolve-url-loader": "^5.0.0",
|
|
78
|
-
"sass": "^1.
|
|
79
|
-
"sass-loader": "^
|
|
78
|
+
"sass": "^1.52.3",
|
|
79
|
+
"sass-loader": "^13.0.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": "^
|
|
85
|
-
"typescript": "^4.
|
|
84
|
+
"tsup": "^6.1.0",
|
|
85
|
+
"typescript": "^4.7.3",
|
|
86
86
|
"url-loader": "^4.1.1",
|
|
87
|
-
"webpack": "^5.
|
|
87
|
+
"webpack": "^5.73.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.9.2",
|
|
91
|
+
"yaml-loader": "^0.8.0"
|
|
92
92
|
}
|
|
93
93
|
}
|
package/readme.html
CHANGED
|
@@ -39,9 +39,10 @@
|
|
|
39
39
|
window.$docsify = {
|
|
40
40
|
name: '@raisenow/tamaro-cli',
|
|
41
41
|
// themeColor: '#537397',
|
|
42
|
+
|
|
43
|
+
coverpage: false,
|
|
42
44
|
maxLevel: 2,
|
|
43
45
|
homepage: './README.md',
|
|
44
|
-
coverpage: false,
|
|
45
46
|
}
|
|
46
47
|
</script>
|
|
47
48
|
<script src="https://cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
|
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
|
@@ -43,7 +43,6 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
43
43
|
|
|
44
44
|
const cmdSyncAll = `
|
|
45
45
|
aws s3 sync ${paths.appDist} ${deployUrl}
|
|
46
|
-
--quiet
|
|
47
46
|
--acl public-read
|
|
48
47
|
--exclude ${paths.appDist}/${entryFilename}
|
|
49
48
|
--cache-control max-age=31536000
|
|
@@ -67,7 +66,6 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
67
66
|
|
|
68
67
|
const cmdCpEntry = `
|
|
69
68
|
aws s3 cp ${paths.appDist}/${entryFilename} ${deployUrl}/${entryFilename}
|
|
70
|
-
--quiet
|
|
71
69
|
--acl public-read
|
|
72
70
|
--cache-control max-age=64800
|
|
73
71
|
${flags}
|
|
@@ -156,7 +154,9 @@ const assertTagValid = (tag: string) => {
|
|
|
156
154
|
const regex = /^[a-zA-Z0-9-_.]+$/
|
|
157
155
|
|
|
158
156
|
if (!regex.test(tag)) {
|
|
159
|
-
halt(
|
|
157
|
+
halt(
|
|
158
|
+
`Flag “--tag” has forbidden format. Allowed format: ${regex.toString()}.`,
|
|
159
|
+
)
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
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
|
@@ -366,7 +366,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
|
|
|
366
366
|
chunkFilename: '[name]-[contenthash:16].css',
|
|
367
367
|
ignoreOrder: true,
|
|
368
368
|
attributes: {
|
|
369
|
-
'data-widget':
|
|
369
|
+
'data-widget': process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET!,
|
|
370
370
|
},
|
|
371
371
|
}),
|
|
372
372
|
),
|
|
@@ -380,7 +380,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
|
|
|
380
380
|
|
|
381
381
|
ifMin() && ifCore()
|
|
382
382
|
? new CopyPlugin({
|
|
383
|
-
patterns: ['
|
|
383
|
+
patterns: ['*.md', '*.html'],
|
|
384
384
|
})
|
|
385
385
|
: undefined,
|
|
386
386
|
|