@raisenow/tamaro-cli 1.0.17 → 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 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/.prettierignore CHANGED
@@ -1,3 +1,5 @@
1
1
  dist/*
2
2
  node_modules/*
3
+ tsconfig.eslint.json
3
4
  tsconfig.json
5
+ *.md
@@ -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
- const { name } = require2(corePkgPath);
111
- if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
112
- return getIfUtils({ core: true }, ["core"]);
113
- }
112
+ packageName = require2(corePkgPath).name;
113
+ } else if (existsSync(configsPkgPath)) {
114
+ packageName = require2(configsPkgPath).name;
114
115
  }
115
- if (existsSync(configsPkgPath)) {
116
- const { name } = require2(configsPkgPath);
117
- if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
118
- return getIfUtils({ core: false }, ["core"]);
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, _i, _j, _k, _l, _m, _n, _o, _p;
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
- (_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");
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
- (_l = (_k = process.env).PUBLIC_URL) != null ? _l : _k.PUBLIC_URL = "";
163
- (_n = (_m = process.env).HMR_ENABLED) != null ? _n : _m.HMR_ENABLED = ifMin("false", "true");
163
+ (_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
- (_p = (_o = process.env).CORE_URL) != null ? _p : _o.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`;
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-BWJBN44Y.js";
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.17";
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 . --fix && prettier --write ."
34
+ lint: "eslint --fix . && prettier --write ."
35
35
  };
36
36
  var bin = "dist/cli.js";
37
37
  var engines = {
@@ -40,39 +40,39 @@ var engines = {
40
40
  };
41
41
  var dependencies = {
42
42
  "@babel/cli": "^7.17.10",
43
- "@babel/core": "^7.17.12",
44
- "@babel/plugin-proposal-decorators": "^7.17.12",
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.17.12",
47
- "@babel/preset-env": "^7.17.12",
46
+ "@babel/plugin-transform-runtime": "^7.18.2",
47
+ "@babel/preset-env": "^7.18.2",
48
48
  "@babel/preset-react": "^7.17.12",
49
49
  "@babel/preset-typescript": "^7.17.12",
50
- "@babel/runtime-corejs3": "^7.17.9",
51
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.6",
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.34",
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.25.0",
60
- "@typescript-eslint/parser": "^5.25.0",
59
+ "@typescript-eslint/eslint-plugin": "^5.27.1",
60
+ "@typescript-eslint/parser": "^5.27.1",
61
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.2.0",
67
+ commander: "^9.3.0",
68
68
  "copy-webpack-plugin": "^11.0.0",
69
- "core-js": "^3.22.5",
69
+ "core-js": "^3.22.8",
70
70
  "css-loader": "^6.7.1",
71
- "css-minimizer-webpack-plugin": "^3.4.1",
71
+ "css-minimizer-webpack-plugin": "^4.0.0",
72
72
  dotenv: "^16.0.1",
73
73
  "dotenv-expand": "^8.0.3",
74
74
  "escape-string-regexp": "^5.0.0",
75
- eslint: "^8.15.0",
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",
@@ -88,25 +88,25 @@ 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.13",
91
+ postcss: "^8.4.14",
92
92
  "postcss-custom-properties": "^12.1.7",
93
- "postcss-loader": "^6.2.1",
93
+ "postcss-loader": "^7.0.0",
94
94
  prettier: "^2.6.2",
95
95
  "react-refresh": "^0.13.0",
96
96
  "resolve-url-loader": "^5.0.0",
97
- sass: "^1.51.0",
98
- "sass-loader": "^12.6.0",
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: "^5.12.8",
104
- typescript: "^4.6.4",
103
+ tsup: "^6.1.0",
104
+ typescript: "^4.7.3",
105
105
  "url-loader": "^4.1.1",
106
- webpack: "^5.72.1",
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.9.0",
109
+ "webpack-dev-server": "^4.9.2",
110
110
  "yaml-loader": "^0.8.0"
111
111
  };
112
112
  var package_default = {
@@ -392,7 +392,7 @@ var assertDistPathExists = (distPath) => {
392
392
  var assertTagValid = (tag) => {
393
393
  const regex = /^[a-zA-Z0-9-_.]+$/;
394
394
  if (!regex.test(tag)) {
395
- halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex}.`);
395
+ halt(`Flag \u201C--tag\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
396
396
  }
397
397
  };
398
398
  var prepareFlags4 = (flags, options) => {
@@ -434,7 +434,7 @@ var listDeployed = async (options) => {
434
434
  const flags = prepareFlags6([], options).join(" ");
435
435
  const { config } = options;
436
436
  const { ifCore } = getIfCoreFns();
437
- const configName = config != null ? config : ifCore(CORE_CONFIG_NAME, getWidgetUuid());
437
+ const configName = config ?? ifCore(CORE_CONFIG_NAME, getWidgetUuid());
438
438
  const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of \u201C${configName}\u201D customer configuration \u2026`;
439
439
  const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/`;
440
440
  const cmd = `aws s3 ls ${deployUrl} ${flags}`;
@@ -474,7 +474,7 @@ var assertConfigValid = (config) => {
474
474
  }
475
475
  const regex = /^[a-zA-Z0-9-_]+$/;
476
476
  if (!regex.test(config)) {
477
- halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex}.`);
477
+ halt(`Flag \u201C--config\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
478
478
  }
479
479
  };
480
480
  var prepareFlags6 = (flags, options) => {
@@ -533,7 +533,7 @@ var assertEmailConfigPathExists = (distPath) => {
533
533
  var assertBucketValid = (tag) => {
534
534
  const regex = /^[a-zA-Z0-9-_]+$/;
535
535
  if (!regex.test(tag)) {
536
- halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex}.`);
536
+ halt(`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex.toString()}.`);
537
537
  }
538
538
  };
539
539
  var assertIsNotCore = () => {
@@ -9,7 +9,7 @@ import {
9
9
  logTitle,
10
10
  moduleFileExtensions,
11
11
  resolveApp
12
- } from "./chunk-BWJBN44Y.js";
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
- var _a;
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": `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`
322
+ "data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
324
323
  }
325
324
  })),
326
325
  new webpack.IgnorePlugin({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raisenow/tamaro-cli",
3
- "version": "1.0.17",
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 . --fix && prettier --write ."
15
+ "lint": "eslint --fix . && prettier --write ."
16
16
  },
17
17
  "bin": "dist/cli.js",
18
18
  "engines": {
@@ -21,39 +21,39 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@babel/cli": "^7.17.10",
24
- "@babel/core": "^7.17.12",
25
- "@babel/plugin-proposal-decorators": "^7.17.12",
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.17.12",
28
- "@babel/preset-env": "^7.17.12",
27
+ "@babel/plugin-transform-runtime": "^7.18.2",
28
+ "@babel/preset-env": "^7.18.2",
29
29
  "@babel/preset-react": "^7.17.12",
30
30
  "@babel/preset-typescript": "^7.17.12",
31
- "@babel/runtime-corejs3": "^7.17.9",
32
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.6",
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.34",
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.25.0",
41
- "@typescript-eslint/parser": "^5.25.0",
40
+ "@typescript-eslint/eslint-plugin": "^5.27.1",
41
+ "@typescript-eslint/parser": "^5.27.1",
42
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.2.0",
48
+ "commander": "^9.3.0",
49
49
  "copy-webpack-plugin": "^11.0.0",
50
- "core-js": "^3.22.5",
50
+ "core-js": "^3.22.8",
51
51
  "css-loader": "^6.7.1",
52
- "css-minimizer-webpack-plugin": "^3.4.1",
52
+ "css-minimizer-webpack-plugin": "^4.0.0",
53
53
  "dotenv": "^16.0.1",
54
54
  "dotenv-expand": "^8.0.3",
55
55
  "escape-string-regexp": "^5.0.0",
56
- "eslint": "^8.15.0",
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",
@@ -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.13",
72
+ "postcss": "^8.4.14",
73
73
  "postcss-custom-properties": "^12.1.7",
74
- "postcss-loader": "^6.2.1",
74
+ "postcss-loader": "^7.0.0",
75
75
  "prettier": "^2.6.2",
76
76
  "react-refresh": "^0.13.0",
77
77
  "resolve-url-loader": "^5.0.0",
78
- "sass": "^1.51.0",
79
- "sass-loader": "^12.6.0",
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": "^5.12.8",
85
- "typescript": "^4.6.4",
84
+ "tsup": "^6.1.0",
85
+ "typescript": "^4.7.3",
86
86
  "url-loader": "^4.1.1",
87
- "webpack": "^5.72.1",
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.9.0",
90
+ "webpack-dev-server": "^4.9.2",
91
91
  "yaml-loader": "^0.8.0"
92
92
  }
93
93
  }
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
  )
@@ -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': `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`,
369
+ 'data-widget': process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET!,
370
370
  },
371
371
  }),
372
372
  ),
@@ -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
  }