@raisenow/tamaro-cli 1.0.16 → 1.0.19

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 CHANGED
@@ -1,3 +1,4 @@
1
- dist/*
2
- node_modules/*
1
+ dist
2
+ node_modules
3
+ tsconfig.eslint.json
3
4
  tsconfig.json
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
@@ -8,6 +8,7 @@
8
8
  !.prettierrc.cjs
9
9
  !package.json
10
10
  !package-lock.json
11
+ !tsconfig.eslint.json
11
12
  !tsconfig.json
12
13
  !readme.html
13
14
  !README.md
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.14.2
1
+ 16.15.0
package/.prettierignore CHANGED
@@ -1,3 +1,5 @@
1
1
  dist/*
2
2
  node_modules/*
3
+ tsconfig.eslint.json
3
4
  tsconfig.json
5
+ *.md
@@ -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,6 +39,7 @@ 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) => {
@@ -106,21 +90,21 @@ var getRelativePaths = (paths) => {
106
90
  var getIfCoreFns = () => {
107
91
  const corePkgPath = resolveApp("package.json");
108
92
  const configsPkgPath = resolveApp("../../package.json");
93
+ let packageName;
109
94
  if (existsSync(corePkgPath)) {
110
- const { name } = require2(corePkgPath);
111
- if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
112
- return getIfUtils({ core: true }, ["core"]);
113
- }
95
+ packageName = require2(corePkgPath).name;
96
+ } else if (existsSync(configsPkgPath)) {
97
+ packageName = require2(configsPkgPath).name;
114
98
  }
115
- if (existsSync(configsPkgPath)) {
116
- const { name } = require2(configsPkgPath);
117
- if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
118
- return getIfUtils({ core: false }, ["core"]);
119
- }
99
+ if (packageName) {
100
+ return getIfUtils({ core: TAMARO_CORE_PACKAGE_NAMES.includes(packageName) }, [
101
+ "core"
102
+ ]);
120
103
  }
121
104
  logError(stripIndent2(` You must run "npx @raisenow/tamaro-cli" commands from:
122
105
  1. Root of "${chalk2.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
123
106
  2. Root of particular customer configuration folder of "${chalk2.bold(TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0])}" package.
107
+ 3. "src/self-service" folder of "${chalk2.bold(TAMARO_SELF_SERVICE_PACKAGE_NAMES[0])}" package.
124
108
  You are currently in "${chalk2.bold(realpathSync(process.cwd()))}".
125
109
  `));
126
110
  process.exit(1);
@@ -150,17 +134,17 @@ var runCommandSync = (cmd, options) => {
150
134
  // src/lib/env.ts
151
135
  var require3 = createRequire2(import.meta.url);
152
136
  var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
153
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
137
+ var _a, _b, _c, _d, _e, _f, _g, _h;
154
138
  const filePath = files.find((file) => basename2(file) === ".env");
155
139
  dotenvExpand(dotenvConfig({ path: filePath }));
156
- (_b = (_a = process.env).NODE_ENV) != null ? _b : _a.NODE_ENV = ifMin("production", "development");
157
- (_d = (_c = process.env).BABEL_ENV) != null ? _d : _c.BABEL_ENV = ifMin("production", "development");
158
- (_f = (_e = process.env).EXPOSE_VAR) != null ? _f : _e.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro");
159
- (_h = (_g = process.env).ELEMENT_ATTRIBUTE_DATA_WIDGET) != null ? _h : _g.ELEMENT_ATTRIBUTE_DATA_WIDGET = ifCore("rnw-tamaro-core", "rnw-tamaro");
160
- (_j = (_i = process.env).WEBPACK_UNIQUE_NAME) != null ? _j : _i.WEBPACK_UNIQUE_NAME = ifCore("RnwTamaroCore", "RnwTamaro");
140
+ (_a = process.env).NODE_ENV ?? (_a.NODE_ENV = ifMin("production", "development"));
141
+ (_b = process.env).BABEL_ENV ?? (_b.BABEL_ENV = ifMin("production", "development"));
142
+ (_c = process.env).EXPOSE_VAR ?? (_c.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro"));
143
+ (_d = process.env).ELEMENT_ATTRIBUTE_DATA_WIDGET ?? (_d.ELEMENT_ATTRIBUTE_DATA_WIDGET = ifCore("rnw-tamaro-core", "rnw-tamaro"));
144
+ (_e = process.env).WEBPACK_UNIQUE_NAME ?? (_e.WEBPACK_UNIQUE_NAME = ifCore("RnwTamaroCore", "RnwTamaro"));
161
145
  process.env.BUILD_DATE = new Date().toISOString();
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");
146
+ (_f = process.env).PUBLIC_URL ?? (_f.PUBLIC_URL = "");
147
+ (_g = process.env).HMR_ENABLED ?? (_g.HMR_ENABLED = ifMin("false", "true"));
164
148
  if (ifCore()) {
165
149
  process.env.PRODUCT_NAME = "tamaro";
166
150
  const corePkgPath = resolveApp("package.json");
@@ -174,7 +158,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore) => {
174
158
  } else {
175
159
  let version = process.env.CORE_VERSION;
176
160
  version = version ? `@${version}` : "";
177
- (_p = (_o = process.env).CORE_URL) != null ? _p : _o.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`;
161
+ (_h = process.env).CORE_URL ?? (_h.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`);
178
162
  }
179
163
  }
180
164
  const varNames = [
@@ -230,7 +214,6 @@ var assertEnvValid = (env) => {
230
214
  };
231
215
 
232
216
  export {
233
- __spreadValues,
234
217
  logTitle,
235
218
  logError,
236
219
  logCommand,
package/dist/cli.js CHANGED
@@ -12,112 +12,105 @@ import {
12
12
  resolveBin,
13
13
  resolveOwn,
14
14
  runCommandSync
15
- } from "./chunk-BWJBN44Y.js";
15
+ } from "./chunk-6RQVBAWK.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.16";
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.10",
44
- "@babel/plugin-proposal-decorators": "^7.17.9",
45
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
46
- "@babel/plugin-transform-runtime": "^7.17.10",
47
- "@babel/preset-env": "^7.17.10",
48
- "@babel/preset-react": "^7.16.7",
49
- "@babel/preset-typescript": "^7.16.7",
50
- "@babel/runtime-corejs3": "^7.17.9",
51
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
52
- "@statoscope/webpack-plugin": "^5.20.1",
53
- "@types/columnify": "^1.5.1",
54
- "@types/lodash": "^4.14.182",
55
- "@types/node": "^17.0.31",
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.22.0",
60
- "@typescript-eslint/parser": "^5.22.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": "^10.2.4",
69
- "core-js": "^3.22.4",
70
- "css-loader": "^6.7.1",
71
- "css-minimizer-webpack-plugin": "^3.4.1",
72
- dotenv: "^16.0.0",
73
- "dotenv-expand": "^8.0.3",
74
- "escape-string-regexp": "^5.0.0",
75
- eslint: "^8.14.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.1",
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.6",
104
- typescript: "^4.6.4",
105
- "url-loader": "^4.1.1",
106
- webpack: "^5.72.0",
107
- "webpack-cli": "^4.9.2",
108
- "webpack-config-utils": "^2.3.1",
109
- "webpack-dev-server": "^4.8.1",
110
- "yaml-loader": "^0.8.0"
111
- };
112
21
  var package_default = {
113
- name,
114
- version,
115
- author,
116
- type,
117
- scripts,
118
- bin,
119
- engines,
120
- dependencies
22
+ name: "@raisenow/tamaro-cli",
23
+ version: "1.0.19",
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.6",
44
+ "@babel/core": "^7.18.6",
45
+ "@babel/plugin-proposal-decorators": "^7.18.6",
46
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
47
+ "@babel/plugin-transform-runtime": "^7.18.6",
48
+ "@babel/preset-env": "^7.18.6",
49
+ "@babel/preset-react": "^7.18.6",
50
+ "@babel/preset-typescript": "^7.18.6",
51
+ "@babel/runtime-corejs3": "^7.18.6",
52
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
53
+ "@statoscope/webpack-plugin": "^5.22.0",
54
+ "@types/columnify": "^1.5.1",
55
+ "@types/lodash": "^4.14.182",
56
+ "@types/node": "^18.0.1",
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.30.4",
61
+ "@typescript-eslint/parser": "^5.30.4",
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.3.0",
70
+ "copy-webpack-plugin": "^11.0.0",
71
+ "core-js": "^3.23.3",
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.19.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.11",
85
+ glob: "^8.0.3",
86
+ "html-loader": "^3.1.2",
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.0",
96
+ prettier: "^2.7.1",
97
+ "react-refresh": "^0.14.0",
98
+ "resolve-url-loader": "^5.0.0",
99
+ sass: "^1.53.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.1.3",
106
+ typescript: "^4.7.4",
107
+ "url-loader": "^4.1.1",
108
+ webpack: "^5.73.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
@@ -392,7 +385,7 @@ var assertDistPathExists = (distPath) => {
392
385
  var assertTagValid = (tag) => {
393
386
  const regex = /^[a-zA-Z0-9-_.]+$/;
394
387
  if (!regex.test(tag)) {
395
- halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex}.`);
388
+ halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
396
389
  }
397
390
  };
398
391
  var prepareFlags4 = (flags, options) => {
@@ -434,7 +427,7 @@ var listDeployed = async (options) => {
434
427
  const flags = prepareFlags6([], options).join(" ");
435
428
  const { config } = options;
436
429
  const { ifCore } = getIfCoreFns();
437
- const configName = config != null ? config : ifCore(CORE_CONFIG_NAME, getWidgetUuid());
430
+ const configName = config ?? ifCore(CORE_CONFIG_NAME, getWidgetUuid());
438
431
  const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of \u201C${configName}\u201D customer configuration \u2026`;
439
432
  const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/`;
440
433
  const cmd = `aws s3 ls ${deployUrl} ${flags}`;
@@ -474,7 +467,7 @@ var assertConfigValid = (config) => {
474
467
  }
475
468
  const regex = /^[a-zA-Z0-9-_]+$/;
476
469
  if (!regex.test(config)) {
477
- halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex}.`);
470
+ halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
478
471
  }
479
472
  };
480
473
  var prepareFlags6 = (flags, options) => {
@@ -533,7 +526,7 @@ var assertEmailConfigPathExists = (distPath) => {
533
526
  var assertBucketValid = (tag) => {
534
527
  const regex = /^[a-zA-Z0-9-_]+$/;
535
528
  if (!regex.test(tag)) {
536
- halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex}.`);
529
+ halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
537
530
  }
538
531
  };
539
532
  var assertIsNotCore = () => {
@@ -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-BWJBN44Y.js";
11
+ } from "./chunk-6RQVBAWK.js";
13
12
 
14
13
  // src/webpack.config.ts
15
14
  import { createRequire } from "module";
@@ -36,21 +35,20 @@ var PLUGIN_NAME = "InterpolateHtmlPlugin";
36
35
  var InterpolateHtmlPlugin = class {
37
36
  replacements;
38
37
  constructor(replacements) {
39
- this.replacements = __spreadValues({}, 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
- var _a;
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(new RegExp(`%${escapeStringRegexp(key)}%`, "g"), value);
51
+ data.html = data.html.replace(new RegExp(`%${escapeStringRegexp(key)}%`, "g"), value || "");
54
52
  });
55
53
  return data;
56
54
  });
@@ -89,10 +87,11 @@ var getWebpackConfig = async (env) => {
89
87
  }),
90
88
  {
91
89
  loader: require2.resolve("css-loader"),
92
- options: __spreadValues({
90
+ options: {
93
91
  sourceMap: ifNotMin(),
94
- importLoaders: 3
95
- }, cssOptions)
92
+ importLoaders: 3,
93
+ ...cssOptions
94
+ }
96
95
  },
97
96
  {
98
97
  loader: require2.resolve("postcss-loader"),
@@ -207,7 +206,8 @@ var getWebpackConfig = async (env) => {
207
206
  ],
208
207
  require2.resolve("@babel/plugin-syntax-dynamic-import"),
209
208
  require2.resolve("babel-plugin-lodash"),
210
- ifHmr(require2.resolve("react-refresh/babel"))
209
+ ifHmr(require2.resolve("react-refresh/babel")),
210
+ ifNotMin(require2.resolve("babel-plugin-istanbul"))
211
211
  ])
212
212
  }
213
213
  },
@@ -320,7 +320,7 @@ var getWebpackConfig = async (env) => {
320
320
  chunkFilename: "[name]-[contenthash:16].css",
321
321
  ignoreOrder: true,
322
322
  attributes: {
323
- "data-widget": `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`
323
+ "data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
324
324
  }
325
325
  })),
326
326
  new webpack.IgnorePlugin({
@@ -329,7 +329,7 @@ var getWebpackConfig = async (env) => {
329
329
  }),
330
330
  ifMin(new webpack.ids.HashedModuleIdsPlugin()),
331
331
  ifMin() && ifCore() ? new CopyPlugin({
332
- patterns: ["README.md", "readme.html"]
332
+ patterns: ["*.md", "*.html"]
333
333
  }) : void 0,
334
334
  ifMin() && ifAnalyze() ? new StatoscopeWebpackPlugin({
335
335
  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.16",
3
+ "version": "1.0.19",
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 . --fix && prettier --write ."
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.17.10",
24
- "@babel/core": "^7.17.10",
25
- "@babel/plugin-proposal-decorators": "^7.17.9",
23
+ "@babel/cli": "^7.18.6",
24
+ "@babel/core": "^7.18.6",
25
+ "@babel/plugin-proposal-decorators": "^7.18.6",
26
26
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
27
- "@babel/plugin-transform-runtime": "^7.17.10",
28
- "@babel/preset-env": "^7.17.10",
29
- "@babel/preset-react": "^7.16.7",
30
- "@babel/preset-typescript": "^7.16.7",
31
- "@babel/runtime-corejs3": "^7.17.9",
32
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
33
- "@statoscope/webpack-plugin": "^5.20.1",
27
+ "@babel/plugin-transform-runtime": "^7.18.6",
28
+ "@babel/preset-env": "^7.18.6",
29
+ "@babel/preset-react": "^7.18.6",
30
+ "@babel/preset-typescript": "^7.18.6",
31
+ "@babel/runtime-corejs3": "^7.18.6",
32
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
33
+ "@statoscope/webpack-plugin": "^5.22.0",
34
34
  "@types/columnify": "^1.5.1",
35
35
  "@types/lodash": "^4.14.182",
36
- "@types/node": "^17.0.31",
36
+ "@types/node": "^18.0.1",
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.22.0",
41
- "@typescript-eslint/parser": "^5.22.0",
40
+ "@typescript-eslint/eslint-plugin": "^5.30.4",
41
+ "@typescript-eslint/parser": "^5.30.4",
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.2.0",
49
- "copy-webpack-plugin": "^10.2.4",
50
- "core-js": "^3.22.4",
49
+ "commander": "^9.3.0",
50
+ "copy-webpack-plugin": "^11.0.0",
51
+ "core-js": "^3.23.3",
51
52
  "css-loader": "^6.7.1",
52
- "css-minimizer-webpack-plugin": "^3.4.1",
53
- "dotenv": "^16.0.0",
53
+ "css-minimizer-webpack-plugin": "^4.0.0",
54
+ "dotenv": "^16.0.1",
54
55
  "dotenv-expand": "^8.0.3",
55
56
  "escape-string-regexp": "^5.0.0",
56
- "eslint": "^8.14.0",
57
+ "eslint": "^8.19.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.1.1",
61
+ "eslint-webpack-plugin": "^3.2.0",
61
62
  "execa": "^6.1.0",
62
63
  "file-loader": "^6.2.0",
63
64
  "fork-ts-checker-webpack-plugin": "^7.2.11",
64
- "glob": "^8.0.1",
65
- "html-loader": "^3.1.0",
65
+ "glob": "^8.0.3",
66
+ "html-loader": "^3.1.2",
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.0",
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.13",
73
+ "postcss": "^8.4.14",
73
74
  "postcss-custom-properties": "^12.1.7",
74
- "postcss-loader": "^6.2.1",
75
- "prettier": "^2.6.2",
76
- "react-refresh": "^0.13.0",
75
+ "postcss-loader": "^7.0.0",
76
+ "prettier": "^2.7.1",
77
+ "react-refresh": "^0.14.0",
77
78
  "resolve-url-loader": "^5.0.0",
78
- "sass": "^1.51.0",
79
- "sass-loader": "^12.6.0",
80
- "source-map-loader": "^3.0.1",
79
+ "sass": "^1.53.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": "^5.12.6",
85
- "typescript": "^4.6.4",
85
+ "tsup": "^6.1.3",
86
+ "typescript": "^4.7.4",
86
87
  "url-loader": "^4.1.1",
87
- "webpack": "^5.72.0",
88
- "webpack-cli": "^4.9.2",
88
+ "webpack": "^5.73.0",
89
+ "webpack-cli": "^4.10.0",
89
90
  "webpack-config-utils": "^2.3.1",
90
- "webpack-dev-server": "^4.8.1",
91
+ "webpack-dev-server": "^4.9.3",
91
92
  "yaml-loader": "^0.8.0"
92
93
  }
93
94
  }
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(`Flag “--bucket” has forbidden format. Allowed format: ${regex}.`)
94
+ halt(
95
+ `Flag “--bucket” has forbidden format. Allowed format: ${regex.toString()}.`,
96
+ )
95
97
  }
96
98
  }
97
99
 
@@ -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(`Flag “--tag” has forbidden format. Allowed format: ${regex}.`)
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(`Flag “--config” has forbidden format. Allowed format: ${regex}.`)
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]: any}
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
 
@@ -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
- // eslint-disable-next-line @typescript-eslint/no-var-requires
117
- const {name} = require(corePkgPath)
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 (existsSync(configsPkgPath)) {
125
- // eslint-disable-next-line @typescript-eslint/no-var-requires
126
- const {name} = require(configsPkgPath)
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
  )
@@ -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
  },
@@ -366,7 +367,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
366
367
  chunkFilename: '[name]-[contenthash:16].css',
367
368
  ignoreOrder: true,
368
369
  attributes: {
369
- 'data-widget': `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`,
370
+ 'data-widget': process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET!,
370
371
  },
371
372
  }),
372
373
  ),
@@ -380,7 +381,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
380
381
 
381
382
  ifMin() && ifCore()
382
383
  ? new CopyPlugin({
383
- patterns: ['README.md', 'readme.html'],
384
+ patterns: ['*.md', '*.html'],
384
385
  })
385
386
  : undefined,
386
387
 
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": [
4
+ "**/*",
5
+ "./.eslintrc.cjs",
6
+ ],
7
+ }
package/tsconfig.json CHANGED
@@ -73,4 +73,10 @@
73
73
  /* Allow imports from json files */
74
74
  "resolveJsonModule": true,
75
75
  },
76
+ "include": [
77
+ "**/*",
78
+ ],
79
+ "exclude": [
80
+ "./dist/**/*",
81
+ ]
76
82
  }