@raisenow/tamaro-cli 1.0.10 → 1.0.13
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/{.eslintrc.js → .eslintrc.cjs} +2 -9
- package/.gitignore +3 -3
- package/.nvmrc +1 -1
- package/{.prettierrc.js → .prettierrc.cjs} +1 -0
- package/{readme.md → README.md} +36 -32
- package/dist/chunk-OXDXJ5B5.js +249 -0
- package/dist/cli.js +257 -324
- package/dist/webpack.config.js +108 -341
- package/package.json +35 -44
- package/readme.html +1 -1
- package/src/cli.ts +31 -19
- package/src/commands/build.ts +33 -28
- package/src/commands/deploy-email-config.ts +29 -21
- package/src/commands/deploy.ts +52 -39
- package/src/commands/dev.ts +29 -18
- package/src/commands/list-deployed.ts +23 -13
- package/src/commands/serve.ts +36 -12
- package/src/lib/InterpolateHtmlPlugin.ts +10 -8
- package/src/lib/aws.ts +43 -35
- package/src/lib/command.ts +27 -0
- package/src/lib/constants.ts +7 -0
- package/src/lib/env.ts +145 -0
- package/src/lib/logging.ts +32 -0
- package/src/lib/notifier.ts +22 -0
- package/src/lib/resolve.ts +144 -0
- package/src/webpack.config.ts +26 -77
- package/tsconfig.json +1 -1
- package/src/lib/helpers.ts +0 -356
- package/src/lib/polyfills.js +0 -8
package/dist/webpack.config.js
CHANGED
|
@@ -1,270 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
-
var __export = (target, all) => {
|
|
23
|
-
for (var name in all)
|
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
-
};
|
|
26
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
27
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
28
|
-
for (let key of __getOwnPropNames(module2))
|
|
29
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
30
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
|
-
var __toESM = (module2, isNodeMode) => {
|
|
35
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
36
|
-
};
|
|
37
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
-
return (module2, temp) => {
|
|
39
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
-
};
|
|
41
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues,
|
|
3
|
+
extensions,
|
|
4
|
+
getEnvVars,
|
|
5
|
+
getIfCoreFns,
|
|
6
|
+
getPaths,
|
|
7
|
+
getRelativePaths,
|
|
8
|
+
logDataTable,
|
|
9
|
+
logTitle,
|
|
10
|
+
moduleFileExtensions,
|
|
11
|
+
resolveApp
|
|
12
|
+
} from "./chunk-OXDXJ5B5.js";
|
|
42
13
|
|
|
43
14
|
// src/webpack.config.ts
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var import_css_minimizer_webpack_plugin = __toESM(require("css-minimizer-webpack-plugin"));
|
|
61
|
-
var import_eslint_webpack_plugin = __toESM(require("eslint-webpack-plugin"));
|
|
62
|
-
var import_copy_webpack_plugin = __toESM(require("copy-webpack-plugin"));
|
|
63
|
-
var import_webpack_plugin = __toESM(require("@statoscope/webpack-plugin"));
|
|
15
|
+
import { createRequire } from "module";
|
|
16
|
+
import { basename, dirname } from "path";
|
|
17
|
+
import { existsSync } from "fs";
|
|
18
|
+
import glob from "glob";
|
|
19
|
+
import { getIfUtils, removeEmpty } from "webpack-config-utils";
|
|
20
|
+
import webpack from "webpack";
|
|
21
|
+
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
22
|
+
import { CleanWebpackPlugin } from "clean-webpack-plugin";
|
|
23
|
+
import HtmlWebpackPlugin2 from "html-webpack-plugin";
|
|
24
|
+
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
|
25
|
+
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
26
|
+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
27
|
+
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
28
|
+
import ESLintPlugin from "eslint-webpack-plugin";
|
|
29
|
+
import CopyPlugin from "copy-webpack-plugin";
|
|
30
|
+
import StatoscopeWebpackPlugin from "@statoscope/webpack-plugin";
|
|
64
31
|
|
|
65
32
|
// src/lib/InterpolateHtmlPlugin.ts
|
|
66
|
-
|
|
67
|
-
|
|
33
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
34
|
+
import escapeStringRegexp from "escape-string-regexp";
|
|
35
|
+
var PLUGIN_NAME = "InterpolateHtmlPlugin";
|
|
68
36
|
var InterpolateHtmlPlugin = class {
|
|
69
37
|
replacements;
|
|
70
38
|
constructor(replacements) {
|
|
71
39
|
this.replacements = __spreadValues({}, replacements);
|
|
72
40
|
}
|
|
73
41
|
apply(compiler) {
|
|
74
|
-
compiler.hooks.compilation.tap(
|
|
75
|
-
const hooks =
|
|
76
|
-
hooks.alterAssetTagGroups.tap(
|
|
42
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
43
|
+
const hooks = HtmlWebpackPlugin.getHooks(compilation);
|
|
44
|
+
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
77
45
|
this.replacements["ENTRY"] = assets.headTags[0].attributes["src"];
|
|
78
46
|
return assets;
|
|
79
47
|
});
|
|
80
|
-
hooks.afterTemplateExecution.tap(
|
|
48
|
+
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
81
49
|
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
82
|
-
data.html = data.html.replace(new RegExp(`%${(
|
|
50
|
+
data.html = data.html.replace(new RegExp(`%${escapeStringRegexp(key)}%`, "g"), value);
|
|
83
51
|
});
|
|
84
52
|
return data;
|
|
85
53
|
});
|
|
86
54
|
});
|
|
87
55
|
}
|
|
88
56
|
};
|
|
89
|
-
var InterpolateHtmlPlugin_default = InterpolateHtmlPlugin;
|
|
90
|
-
|
|
91
|
-
// src/lib/helpers.ts
|
|
92
|
-
var import_path = require("path");
|
|
93
|
-
var import_fs = require("fs");
|
|
94
|
-
var import_chalk = __toESM(require("chalk"));
|
|
95
|
-
var import_node_notifier = __toESM(require("node-notifier"));
|
|
96
|
-
var import_webpack_config_utils = require("webpack-config-utils");
|
|
97
|
-
var import_columnify = __toESM(require("columnify"));
|
|
98
|
-
var import_boxen = __toESM(require("boxen"));
|
|
99
|
-
var import_dotenv_expand = require("dotenv-expand");
|
|
100
|
-
var import_dotenv = require("dotenv");
|
|
101
|
-
var import_open = __toESM(require("open"));
|
|
102
|
-
var import_strip_indent = __toESM(require("strip-indent"));
|
|
103
|
-
var import_execa = require("execa");
|
|
104
|
-
var TAMARO_CORE_PACKAGE_NAMES = ["@raisenow/tamaro-core"];
|
|
105
|
-
var TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ["@raisenow/tamaro-configurations"];
|
|
106
|
-
var getIfCoreFns = () => {
|
|
107
|
-
const corePkgPath = resolveApp("package.json");
|
|
108
|
-
const configsPkgPath = resolveApp("../../package.json");
|
|
109
|
-
if ((0, import_fs.existsSync)(corePkgPath)) {
|
|
110
|
-
const { name } = require(corePkgPath);
|
|
111
|
-
if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
|
|
112
|
-
return (0, import_webpack_config_utils.getIfUtils)({ core: true }, ["core"]);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if ((0, import_fs.existsSync)(configsPkgPath)) {
|
|
116
|
-
const { name } = require(configsPkgPath);
|
|
117
|
-
if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
|
|
118
|
-
return (0, import_webpack_config_utils.getIfUtils)({ core: false }, ["core"]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
logError((0, import_strip_indent.default)(` You must run "npx @raisenow/tamaro-cli" commands from:
|
|
122
|
-
1. Root of "${import_chalk.default.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
|
|
123
|
-
2. Root of particular customer configuration folder of "${import_chalk.default.bold(TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0])}" package.
|
|
124
|
-
You are currently in "${import_chalk.default.bold((0, import_fs.realpathSync)(process.cwd()))}".
|
|
125
|
-
`));
|
|
126
|
-
process.exit(1);
|
|
127
|
-
};
|
|
128
|
-
var moduleFileExtensions = ["ts", "tsx", "js", "jsx"];
|
|
129
|
-
var extensions = moduleFileExtensions.map((v) => `.${v}`);
|
|
130
|
-
var resolveApp = (relativePath) => (0, import_path.resolve)((0, import_fs.realpathSync)(process.cwd()), relativePath);
|
|
131
|
-
var resolveOwn = (relativePath) => (0, import_path.resolve)(__dirname, "..", relativePath);
|
|
132
|
-
var resolveModule = (resolveFn, filePath) => {
|
|
133
|
-
const extension = moduleFileExtensions.find((extension2) => (0, import_fs.existsSync)(resolveFn(`${filePath}.${extension2}`)));
|
|
134
|
-
if (extension) {
|
|
135
|
-
return resolveFn(`${filePath}.${extension}`);
|
|
136
|
-
}
|
|
137
|
-
return resolveFn(`${filePath}.js`);
|
|
138
|
-
};
|
|
139
|
-
var getWidgetUuid = () => (0, import_path.basename)(resolveApp("."));
|
|
140
|
-
var getPaths = (ifCore) => {
|
|
141
|
-
return ifCore({
|
|
142
|
-
app: resolveApp("."),
|
|
143
|
-
appEntry: resolveModule(resolveApp, "src/index"),
|
|
144
|
-
appDist: resolveApp("dist"),
|
|
145
|
-
appNodeModules: resolveApp("node_modules"),
|
|
146
|
-
appTsConfig: resolveApp("tsconfig.json"),
|
|
147
|
-
appHtml: resolveApp("src/*.html"),
|
|
148
|
-
appEnv: resolveApp(".env"),
|
|
149
|
-
appTailwindConfig: resolveApp("tailwind.config.js")
|
|
150
|
-
}, {
|
|
151
|
-
app: resolveApp("."),
|
|
152
|
-
appEntry: resolveModule(resolveApp, "widget"),
|
|
153
|
-
appDist: resolveApp(`../../dist/${getWidgetUuid()}`),
|
|
154
|
-
appNodeModules: resolveApp("../../node_modules"),
|
|
155
|
-
appTsConfig: resolveApp("tsconfig.json"),
|
|
156
|
-
appHtml: resolveApp("*.html"),
|
|
157
|
-
appEnv: resolveApp(".env"),
|
|
158
|
-
appTailwindConfig: void 0
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
var getRelativePaths = (paths) => {
|
|
162
|
-
const relativePaths = {};
|
|
163
|
-
for (const [type, absPath] of Object.entries(paths)) {
|
|
164
|
-
if (absPath) {
|
|
165
|
-
relativePaths[type] = (0, import_path.relative)("./", absPath) || ".";
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return relativePaths;
|
|
169
|
-
};
|
|
170
|
-
var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
171
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
172
|
-
(0, import_dotenv_expand.expand)((0, import_dotenv.config)({ path: filePath }));
|
|
173
|
-
(_b = (_a = process.env).NODE_ENV) != null ? _b : _a.NODE_ENV = ifMin("production", "development");
|
|
174
|
-
(_d = (_c = process.env).BABEL_ENV) != null ? _d : _c.BABEL_ENV = ifMin("production", "development");
|
|
175
|
-
(_f = (_e = process.env).EXPOSE_VAR) != null ? _f : _e.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro");
|
|
176
|
-
(_h = (_g = process.env).ELEMENT_ATTRIBUTE_DATA_WIDGET) != null ? _h : _g.ELEMENT_ATTRIBUTE_DATA_WIDGET = ifCore("rnw-tamaro-core", "rnw-tamaro");
|
|
177
|
-
(_j = (_i = process.env).WEBPACK_UNIQUE_NAME) != null ? _j : _i.WEBPACK_UNIQUE_NAME = ifCore("RnwTamaroCore", "RnwTamaro");
|
|
178
|
-
(_l = (_k = process.env).HMR_ENABLED) != null ? _l : _k.HMR_ENABLED = ifMin("false", "true");
|
|
179
|
-
if (ifCore()) {
|
|
180
|
-
process.env.PRODUCT_NAME = "tamaro";
|
|
181
|
-
const corePkgPath = resolveApp("package.json");
|
|
182
|
-
const { version } = require(corePkgPath);
|
|
183
|
-
process.env.PRODUCT_VERSION = version;
|
|
184
|
-
}
|
|
185
|
-
if (!ifCore()) {
|
|
186
|
-
process.env.WIDGET_UUID = getWidgetUuid();
|
|
187
|
-
if (ifLocalCore()) {
|
|
188
|
-
process.env.CORE_URL = `http://0.0.0.0:1234/index.js`;
|
|
189
|
-
} else {
|
|
190
|
-
let version = process.env.CORE_VERSION;
|
|
191
|
-
version = version ? `@${version}` : "";
|
|
192
|
-
(_n = (_m = process.env).CORE_URL) != null ? _n : _m.CORE_URL = `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const varNames = [
|
|
196
|
-
"NODE_ENV",
|
|
197
|
-
"BABEL_ENV",
|
|
198
|
-
"EXPOSE_VAR",
|
|
199
|
-
"ELEMENT_ATTRIBUTE_DATA_WIDGET",
|
|
200
|
-
"WEBPACK_UNIQUE_NAME",
|
|
201
|
-
"PRODUCT_NAME",
|
|
202
|
-
"PRODUCT_VERSION",
|
|
203
|
-
"WIDGET_UUID",
|
|
204
|
-
"CORE_URL",
|
|
205
|
-
"CORE_VERSION",
|
|
206
|
-
"IS_CREDIT_CARD_IFRAME"
|
|
207
|
-
];
|
|
208
|
-
const raw = Object.keys(process.env).filter((key) => /^PUBLIC_/.test(key) || varNames.includes(key)).reduce((env, key) => {
|
|
209
|
-
env[key] = process.env[key];
|
|
210
|
-
return env;
|
|
211
|
-
}, {});
|
|
212
|
-
const stringified = {
|
|
213
|
-
"process.env": Object.keys(raw).reduce((env, key) => {
|
|
214
|
-
env[key] = JSON.stringify(raw[key]);
|
|
215
|
-
return env;
|
|
216
|
-
}, {})
|
|
217
|
-
};
|
|
218
|
-
return { raw, stringified };
|
|
219
|
-
};
|
|
220
|
-
var logError = (message) => {
|
|
221
|
-
if (message) {
|
|
222
|
-
console.log(import_chalk.default.red(message));
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
var logDataTable = (vars, title) => {
|
|
226
|
-
logTable((0, import_columnify.default)(vars, { showHeaders: false }), title);
|
|
227
|
-
};
|
|
228
|
-
var logTable = (text, title) => {
|
|
229
|
-
let out = "";
|
|
230
|
-
const boxTitle = title ? import_chalk.default.bold(`${title}`) : void 0;
|
|
231
|
-
if (boxTitle) {
|
|
232
|
-
out += `${boxTitle}
|
|
233
|
-
`;
|
|
234
|
-
}
|
|
235
|
-
out += text;
|
|
236
|
-
console.log((0, import_boxen.default)(out, {
|
|
237
|
-
margin: 0,
|
|
238
|
-
padding: {
|
|
239
|
-
top: 0,
|
|
240
|
-
right: 1,
|
|
241
|
-
bottom: 0,
|
|
242
|
-
left: 1
|
|
243
|
-
},
|
|
244
|
-
borderColor: "green"
|
|
245
|
-
}));
|
|
246
|
-
};
|
|
247
57
|
|
|
248
58
|
// src/webpack.config.ts
|
|
59
|
+
var require2 = createRequire(import.meta.url);
|
|
249
60
|
var imageInlineSizeLimit = 0;
|
|
250
61
|
var getWebpackConfig = async (env) => {
|
|
251
|
-
const { ifMin, ifNotMin } =
|
|
252
|
-
const { ifAnalyze } =
|
|
253
|
-
const { ifLocalCore } =
|
|
62
|
+
const { ifMin, ifNotMin } = getIfUtils(env, ["min"]);
|
|
63
|
+
const { ifAnalyze } = getIfUtils(env, ["analyze"]);
|
|
64
|
+
const { ifLocalCore } = getIfUtils(env, ["localCore"]);
|
|
254
65
|
const { ifCore } = getIfCoreFns();
|
|
255
66
|
const paths = getPaths(ifCore);
|
|
256
|
-
const appHtmlFiles =
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
const useTailwind = ifCore() && paths.appTailwindConfig &&
|
|
261
|
-
|
|
262
|
-
logDataTable(
|
|
67
|
+
const appHtmlFiles = glob.sync(paths.appHtml);
|
|
68
|
+
const appEnvFiles = glob.sync(paths.appEnv);
|
|
69
|
+
const envVars = getEnvVars(appEnvFiles, ifMin, ifCore, ifLocalCore);
|
|
70
|
+
const { ifHmr } = getIfUtils({ hmr: process.env.HMR_ENABLED === "true" }, ["hmr"]);
|
|
71
|
+
const useTailwind = ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig);
|
|
72
|
+
logTitle("Paths:");
|
|
73
|
+
logDataTable(getRelativePaths(paths));
|
|
74
|
+
logTitle("Environment variables:");
|
|
75
|
+
logDataTable(envVars.raw);
|
|
263
76
|
const getCssLoaders = (cssOptions = {}) => {
|
|
264
|
-
return
|
|
265
|
-
ifMin({ loader:
|
|
77
|
+
return removeEmpty([
|
|
78
|
+
ifMin({ loader: MiniCssExtractPlugin.loader }),
|
|
266
79
|
ifNotMin({
|
|
267
|
-
loader:
|
|
80
|
+
loader: require2.resolve("style-loader"),
|
|
268
81
|
options: {
|
|
269
82
|
attributes: {
|
|
270
83
|
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
@@ -272,35 +85,35 @@ var getWebpackConfig = async (env) => {
|
|
|
272
85
|
}
|
|
273
86
|
}),
|
|
274
87
|
{
|
|
275
|
-
loader:
|
|
88
|
+
loader: require2.resolve("css-loader"),
|
|
276
89
|
options: __spreadValues({
|
|
277
90
|
sourceMap: ifNotMin(),
|
|
278
91
|
importLoaders: 3
|
|
279
92
|
}, cssOptions)
|
|
280
93
|
},
|
|
281
94
|
{
|
|
282
|
-
loader:
|
|
95
|
+
loader: require2.resolve("postcss-loader"),
|
|
283
96
|
options: {
|
|
284
97
|
postcssOptions: {
|
|
285
|
-
plugins:
|
|
98
|
+
plugins: removeEmpty([
|
|
286
99
|
useTailwind ? [
|
|
287
|
-
|
|
100
|
+
require2.resolve("tailwindcss", {
|
|
288
101
|
paths: [paths.appNodeModules]
|
|
289
102
|
}),
|
|
290
103
|
paths.appTailwindConfig
|
|
291
104
|
] : void 0,
|
|
292
|
-
|
|
293
|
-
|
|
105
|
+
require2.resolve("postcss-custom-properties"),
|
|
106
|
+
require2.resolve("autoprefixer")
|
|
294
107
|
])
|
|
295
108
|
}
|
|
296
109
|
}
|
|
297
110
|
},
|
|
298
111
|
{
|
|
299
|
-
loader:
|
|
112
|
+
loader: require2.resolve("resolve-url-loader"),
|
|
300
113
|
options: { sourceMap: ifNotMin() }
|
|
301
114
|
},
|
|
302
115
|
{
|
|
303
|
-
loader:
|
|
116
|
+
loader: require2.resolve("sass-loader"),
|
|
304
117
|
options: { sourceMap: true }
|
|
305
118
|
}
|
|
306
119
|
]);
|
|
@@ -312,13 +125,13 @@ var getWebpackConfig = async (env) => {
|
|
|
312
125
|
extensions: [...extensions, "..."],
|
|
313
126
|
modules: ["node_modules", paths.appNodeModules],
|
|
314
127
|
plugins: [
|
|
315
|
-
new
|
|
128
|
+
new TsconfigPathsPlugin({
|
|
316
129
|
configFile: paths.appTsConfig,
|
|
317
130
|
extensions
|
|
318
131
|
})
|
|
319
132
|
]
|
|
320
133
|
},
|
|
321
|
-
entry:
|
|
134
|
+
entry: paths.appEntry,
|
|
322
135
|
output: {
|
|
323
136
|
publicPath: "auto",
|
|
324
137
|
path: ifMin(paths.appDist, void 0),
|
|
@@ -340,12 +153,12 @@ var getWebpackConfig = async (env) => {
|
|
|
340
153
|
errorDetails: true
|
|
341
154
|
}),
|
|
342
155
|
module: {
|
|
343
|
-
rules:
|
|
156
|
+
rules: removeEmpty([
|
|
344
157
|
ifNotMin({
|
|
345
158
|
enforce: "pre",
|
|
346
159
|
exclude: /@babel\/runtime/,
|
|
347
160
|
test: /\.(js|jsx|ts|tsx|css|scss)$/,
|
|
348
|
-
use:
|
|
161
|
+
use: require2.resolve("source-map-loader")
|
|
349
162
|
}),
|
|
350
163
|
{
|
|
351
164
|
oneOf: [
|
|
@@ -356,42 +169,42 @@ var getWebpackConfig = async (env) => {
|
|
|
356
169
|
resolveApp("node_modules/micromark"),
|
|
357
170
|
resolveApp("node_modules/decode-named-character-reference")
|
|
358
171
|
], [resolveApp("."), resolveApp("../../src")]),
|
|
359
|
-
loader:
|
|
172
|
+
loader: require2.resolve("babel-loader"),
|
|
360
173
|
options: {
|
|
361
174
|
babelrc: false,
|
|
362
175
|
configFile: false,
|
|
363
176
|
sourceMaps: ifNotMin(),
|
|
364
177
|
inputSourceMap: ifNotMin(),
|
|
365
178
|
presets: [
|
|
366
|
-
|
|
179
|
+
require2.resolve("@babel/preset-env"),
|
|
367
180
|
[
|
|
368
|
-
|
|
181
|
+
require2.resolve("@babel/preset-typescript"),
|
|
369
182
|
{
|
|
370
183
|
allowDeclareFields: true
|
|
371
184
|
}
|
|
372
185
|
],
|
|
373
|
-
|
|
186
|
+
require2.resolve("@babel/preset-react")
|
|
374
187
|
],
|
|
375
|
-
plugins:
|
|
188
|
+
plugins: removeEmpty([
|
|
376
189
|
[
|
|
377
|
-
|
|
190
|
+
require2.resolve("@babel/plugin-transform-runtime"),
|
|
378
191
|
{
|
|
379
192
|
corejs: {
|
|
380
193
|
version: 3,
|
|
381
194
|
proposals: true
|
|
382
195
|
},
|
|
383
|
-
absoluteRuntime:
|
|
196
|
+
absoluteRuntime: dirname(require2.resolve("@babel/runtime-corejs3/package.json"))
|
|
384
197
|
}
|
|
385
198
|
],
|
|
386
199
|
[
|
|
387
|
-
|
|
200
|
+
require2.resolve("@babel/plugin-proposal-decorators"),
|
|
388
201
|
{
|
|
389
202
|
legacy: true
|
|
390
203
|
}
|
|
391
204
|
],
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
ifHmr(
|
|
205
|
+
require2.resolve("@babel/plugin-syntax-dynamic-import"),
|
|
206
|
+
require2.resolve("babel-plugin-lodash"),
|
|
207
|
+
ifHmr(require2.resolve("react-refresh/babel"))
|
|
395
208
|
])
|
|
396
209
|
}
|
|
397
210
|
},
|
|
@@ -412,47 +225,7 @@ var getWebpackConfig = async (env) => {
|
|
|
412
225
|
})
|
|
413
226
|
},
|
|
414
227
|
{
|
|
415
|
-
test: /\.svg$/,
|
|
416
|
-
issuer: [/\.html$/, /\.s?css$/],
|
|
417
|
-
type: "asset",
|
|
418
|
-
parser: {
|
|
419
|
-
dataUrlCondition: {
|
|
420
|
-
maxSize: imageInlineSizeLimit
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
test: /\.svg$/,
|
|
426
|
-
issuer: [/\.(ts|tsx|js|jsx|md|mdx)$/],
|
|
427
|
-
use: [
|
|
428
|
-
{
|
|
429
|
-
loader: require.resolve("@svgr/webpack"),
|
|
430
|
-
options: {
|
|
431
|
-
svgoConfig: {
|
|
432
|
-
plugins: [
|
|
433
|
-
{
|
|
434
|
-
removeHiddenElems: false,
|
|
435
|
-
moveGroupAttrsToElems: false,
|
|
436
|
-
collapseGroups: false
|
|
437
|
-
}
|
|
438
|
-
]
|
|
439
|
-
},
|
|
440
|
-
prettier: false,
|
|
441
|
-
titleProp: true,
|
|
442
|
-
ref: true
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
loader: require.resolve("url-loader"),
|
|
447
|
-
options: {
|
|
448
|
-
name: "assets/[name]-[contenthash:16].[ext]",
|
|
449
|
-
limit: imageInlineSizeLimit
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
]
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
test: /\.(png|jpe?g|webp|gif|ico|ttf|eot|woff2?)$/,
|
|
228
|
+
test: /\.(png|jpe?g|svg|webp|gif|ico|ttf|eot|woff2?)$/,
|
|
456
229
|
type: "asset",
|
|
457
230
|
parser: {
|
|
458
231
|
dataUrlCondition: {
|
|
@@ -463,13 +236,13 @@ var getWebpackConfig = async (env) => {
|
|
|
463
236
|
{
|
|
464
237
|
test: /\.ya?ml$/,
|
|
465
238
|
use: [
|
|
466
|
-
{ loader:
|
|
467
|
-
{ loader:
|
|
239
|
+
{ loader: require2.resolve("json-loader") },
|
|
240
|
+
{ loader: require2.resolve("yaml-loader") }
|
|
468
241
|
]
|
|
469
242
|
},
|
|
470
243
|
{
|
|
471
244
|
test: /\.html$/,
|
|
472
|
-
loader:
|
|
245
|
+
loader: require2.resolve("html-loader"),
|
|
473
246
|
options: {
|
|
474
247
|
minimize: false
|
|
475
248
|
}
|
|
@@ -484,7 +257,6 @@ var getWebpackConfig = async (env) => {
|
|
|
484
257
|
},
|
|
485
258
|
devtool: ifMin(false, "cheap-module-source-map"),
|
|
486
259
|
devServer: {
|
|
487
|
-
port,
|
|
488
260
|
static: false,
|
|
489
261
|
historyApiFallback: {
|
|
490
262
|
disableDotRule: true
|
|
@@ -502,28 +274,28 @@ var getWebpackConfig = async (env) => {
|
|
|
502
274
|
},
|
|
503
275
|
optimization: {
|
|
504
276
|
removeEmptyChunks: true,
|
|
505
|
-
minimizer: ["...", new
|
|
277
|
+
minimizer: ["...", new CssMinimizerPlugin()]
|
|
506
278
|
},
|
|
507
|
-
plugins:
|
|
508
|
-
new
|
|
509
|
-
new
|
|
279
|
+
plugins: removeEmpty([
|
|
280
|
+
new webpack.ProgressPlugin(),
|
|
281
|
+
new ESLintPlugin({
|
|
510
282
|
extensions: moduleFileExtensions,
|
|
511
|
-
eslintPath:
|
|
283
|
+
eslintPath: require2.resolve("eslint"),
|
|
512
284
|
cwd: paths.app,
|
|
513
285
|
resolvePluginsRelativeTo: paths.app
|
|
514
286
|
}),
|
|
515
|
-
ifMin(new
|
|
516
|
-
...appHtmlFiles.map((file) => new
|
|
287
|
+
ifMin(new CleanWebpackPlugin({})),
|
|
288
|
+
...appHtmlFiles.map((file) => new HtmlWebpackPlugin2({
|
|
517
289
|
template: file,
|
|
518
|
-
filename:
|
|
290
|
+
filename: basename(file),
|
|
519
291
|
inject: false,
|
|
520
292
|
minify: false
|
|
521
293
|
})),
|
|
522
|
-
new
|
|
523
|
-
new
|
|
524
|
-
new
|
|
294
|
+
new InterpolateHtmlPlugin(envVars.raw),
|
|
295
|
+
new webpack.DefinePlugin(envVars.stringified),
|
|
296
|
+
new ForkTsCheckerWebpackPlugin({
|
|
525
297
|
typescript: {
|
|
526
|
-
typescriptPath:
|
|
298
|
+
typescriptPath: require2.resolve("typescript", {
|
|
527
299
|
paths: [paths.appNodeModules]
|
|
528
300
|
}),
|
|
529
301
|
configFile: paths.appTsConfig,
|
|
@@ -536,8 +308,8 @@ var getWebpackConfig = async (env) => {
|
|
|
536
308
|
}
|
|
537
309
|
}
|
|
538
310
|
}),
|
|
539
|
-
ifHmr(new
|
|
540
|
-
ifMin(new
|
|
311
|
+
ifHmr(new ReactRefreshWebpackPlugin()),
|
|
312
|
+
ifMin(new MiniCssExtractPlugin({
|
|
541
313
|
filename: "[name]-[contenthash:16].css",
|
|
542
314
|
chunkFilename: "[name]-[contenthash:16].css",
|
|
543
315
|
ignoreOrder: true,
|
|
@@ -545,35 +317,30 @@ var getWebpackConfig = async (env) => {
|
|
|
545
317
|
"data-widget": `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`
|
|
546
318
|
}
|
|
547
319
|
})),
|
|
548
|
-
new
|
|
320
|
+
new webpack.IgnorePlugin({
|
|
549
321
|
resourceRegExp: /^\.\/locale$/,
|
|
550
322
|
contextRegExp: /moment$/
|
|
551
323
|
}),
|
|
552
|
-
ifMin(new
|
|
553
|
-
ifMin() && ifCore() ? new
|
|
554
|
-
patterns: [
|
|
555
|
-
{
|
|
556
|
-
from: "readme.md",
|
|
557
|
-
to: "readme.md"
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
from: "readme.html",
|
|
561
|
-
to: "readme.html"
|
|
562
|
-
}
|
|
563
|
-
]
|
|
324
|
+
ifMin(new webpack.ids.HashedModuleIdsPlugin()),
|
|
325
|
+
ifMin() && ifCore() ? new CopyPlugin({
|
|
326
|
+
patterns: ["README.md", "readme.html"]
|
|
564
327
|
}) : void 0,
|
|
565
|
-
ifMin() && ifAnalyze() ? new
|
|
328
|
+
ifMin() && ifAnalyze() ? new StatoscopeWebpackPlugin({
|
|
566
329
|
name: ifCore("tamaro-core", "tamaro-customer-config"),
|
|
567
330
|
saveReportTo: "reports/report.html",
|
|
568
331
|
saveStatsTo: "reports/stats-[name]-[hash].json",
|
|
569
|
-
additionalStats:
|
|
332
|
+
additionalStats: glob.sync("reports/*.json"),
|
|
570
333
|
open: false
|
|
571
334
|
}) : void 0
|
|
572
|
-
])
|
|
335
|
+
]),
|
|
336
|
+
infrastructureLogging: {
|
|
337
|
+
stream: process.stdout,
|
|
338
|
+
appendOnly: false
|
|
339
|
+
}
|
|
573
340
|
};
|
|
574
|
-
return
|
|
341
|
+
return removeEmpty(config);
|
|
575
342
|
};
|
|
576
343
|
var webpack_config_default = getWebpackConfig;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
344
|
+
export {
|
|
345
|
+
webpack_config_default as default
|
|
346
|
+
};
|