@raisenow/tamaro-cli 1.0.9 → 1.0.12
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 +1 -0
- package/{.eslintrc.js → .eslintrc.cjs} +2 -8
- package/.gitignore +3 -3
- package/.nvmrc +1 -1
- package/{.prettierrc.js → .prettierrc.cjs} +1 -0
- package/{readme.md → README.md} +34 -32
- package/dist/chunk-PIEFLCDU.js +144 -0
- package/dist/cli.js +256 -310
- package/dist/webpack.config.js +114 -248
- package/package.json +34 -40
- package/readme.html +1 -1
- package/src/cli.ts +29 -19
- package/src/commands/build.ts +27 -25
- package/src/commands/deploy-email-config.ts +28 -20
- package/src/commands/deploy.ts +51 -38
- package/src/commands/dev.ts +24 -17
- package/src/commands/list-deployed.ts +22 -12
- 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 +102 -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 +23 -27
- 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,175 +1,68 @@
|
|
|
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
|
+
getIfCoreFns,
|
|
5
|
+
getPaths,
|
|
6
|
+
getRelativePaths,
|
|
7
|
+
getWidgetUuid,
|
|
8
|
+
logDataTable,
|
|
9
|
+
logTitle,
|
|
10
|
+
moduleFileExtensions,
|
|
11
|
+
resolveApp
|
|
12
|
+
} from "./chunk-PIEFLCDU.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 as createRequire2 } 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
57
|
|
|
91
|
-
// src/lib/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var
|
|
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
|
-
};
|
|
58
|
+
// src/lib/env.ts
|
|
59
|
+
import { createRequire } from "module";
|
|
60
|
+
import { expand as dotenvExpand } from "dotenv-expand";
|
|
61
|
+
import { config as dotenvConfig } from "dotenv";
|
|
62
|
+
var require2 = createRequire(import.meta.url);
|
|
170
63
|
var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
171
64
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
172
|
-
(
|
|
65
|
+
dotenvExpand(dotenvConfig({ path: filePath }));
|
|
173
66
|
(_b = (_a = process.env).NODE_ENV) != null ? _b : _a.NODE_ENV = ifMin("production", "development");
|
|
174
67
|
(_d = (_c = process.env).BABEL_ENV) != null ? _d : _c.BABEL_ENV = ifMin("production", "development");
|
|
175
68
|
(_f = (_e = process.env).EXPOSE_VAR) != null ? _f : _e.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro");
|
|
@@ -179,7 +72,7 @@ var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
|
179
72
|
if (ifCore()) {
|
|
180
73
|
process.env.PRODUCT_NAME = "tamaro";
|
|
181
74
|
const corePkgPath = resolveApp("package.json");
|
|
182
|
-
const { version } =
|
|
75
|
+
const { version } = require2(corePkgPath);
|
|
183
76
|
process.env.PRODUCT_VERSION = version;
|
|
184
77
|
}
|
|
185
78
|
if (!ifCore()) {
|
|
@@ -217,54 +110,29 @@ var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
|
217
110
|
};
|
|
218
111
|
return { raw, stringified };
|
|
219
112
|
};
|
|
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
113
|
|
|
248
114
|
// src/webpack.config.ts
|
|
115
|
+
var require3 = createRequire2(import.meta.url);
|
|
249
116
|
var imageInlineSizeLimit = 0;
|
|
250
117
|
var getWebpackConfig = async (env) => {
|
|
251
|
-
const { ifMin, ifNotMin } =
|
|
252
|
-
const { ifAnalyze } =
|
|
253
|
-
const { ifLocalCore } =
|
|
118
|
+
const { ifMin, ifNotMin } = getIfUtils(env, ["min"]);
|
|
119
|
+
const { ifAnalyze } = getIfUtils(env, ["analyze"]);
|
|
120
|
+
const { ifLocalCore } = getIfUtils(env, ["localCore"]);
|
|
254
121
|
const { ifCore } = getIfCoreFns();
|
|
255
122
|
const paths = getPaths(ifCore);
|
|
256
|
-
const appHtmlFiles =
|
|
123
|
+
const appHtmlFiles = glob.sync(paths.appHtml);
|
|
257
124
|
const envVars = getEnvVars(paths.appEnv, ifMin, ifCore, ifLocalCore);
|
|
258
|
-
const { ifHmr } =
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
logDataTable(getRelativePaths(paths)
|
|
262
|
-
|
|
125
|
+
const { ifHmr } = getIfUtils({ hmr: process.env.HMR_ENABLED === "true" }, ["hmr"]);
|
|
126
|
+
const useTailwind = ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig);
|
|
127
|
+
logTitle("Paths:");
|
|
128
|
+
logDataTable(getRelativePaths(paths));
|
|
129
|
+
logTitle("Environment variables:");
|
|
130
|
+
logDataTable(envVars.raw);
|
|
263
131
|
const getCssLoaders = (cssOptions = {}) => {
|
|
264
|
-
return
|
|
265
|
-
ifMin({ loader:
|
|
132
|
+
return removeEmpty([
|
|
133
|
+
ifMin({ loader: MiniCssExtractPlugin.loader }),
|
|
266
134
|
ifNotMin({
|
|
267
|
-
loader:
|
|
135
|
+
loader: require3.resolve("style-loader"),
|
|
268
136
|
options: {
|
|
269
137
|
attributes: {
|
|
270
138
|
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
@@ -272,35 +140,35 @@ var getWebpackConfig = async (env) => {
|
|
|
272
140
|
}
|
|
273
141
|
}),
|
|
274
142
|
{
|
|
275
|
-
loader:
|
|
143
|
+
loader: require3.resolve("css-loader"),
|
|
276
144
|
options: __spreadValues({
|
|
277
145
|
sourceMap: ifNotMin(),
|
|
278
146
|
importLoaders: 3
|
|
279
147
|
}, cssOptions)
|
|
280
148
|
},
|
|
281
149
|
{
|
|
282
|
-
loader:
|
|
150
|
+
loader: require3.resolve("postcss-loader"),
|
|
283
151
|
options: {
|
|
284
152
|
postcssOptions: {
|
|
285
|
-
plugins:
|
|
153
|
+
plugins: removeEmpty([
|
|
286
154
|
useTailwind ? [
|
|
287
|
-
|
|
155
|
+
require3.resolve("tailwindcss", {
|
|
288
156
|
paths: [paths.appNodeModules]
|
|
289
157
|
}),
|
|
290
158
|
paths.appTailwindConfig
|
|
291
159
|
] : void 0,
|
|
292
|
-
|
|
293
|
-
|
|
160
|
+
require3.resolve("postcss-custom-properties"),
|
|
161
|
+
require3.resolve("autoprefixer")
|
|
294
162
|
])
|
|
295
163
|
}
|
|
296
164
|
}
|
|
297
165
|
},
|
|
298
166
|
{
|
|
299
|
-
loader:
|
|
167
|
+
loader: require3.resolve("resolve-url-loader"),
|
|
300
168
|
options: { sourceMap: ifNotMin() }
|
|
301
169
|
},
|
|
302
170
|
{
|
|
303
|
-
loader:
|
|
171
|
+
loader: require3.resolve("sass-loader"),
|
|
304
172
|
options: { sourceMap: true }
|
|
305
173
|
}
|
|
306
174
|
]);
|
|
@@ -312,13 +180,13 @@ var getWebpackConfig = async (env) => {
|
|
|
312
180
|
extensions: [...extensions, "..."],
|
|
313
181
|
modules: ["node_modules", paths.appNodeModules],
|
|
314
182
|
plugins: [
|
|
315
|
-
new
|
|
183
|
+
new TsconfigPathsPlugin({
|
|
316
184
|
configFile: paths.appTsConfig,
|
|
317
185
|
extensions
|
|
318
186
|
})
|
|
319
187
|
]
|
|
320
188
|
},
|
|
321
|
-
entry:
|
|
189
|
+
entry: paths.appEntry,
|
|
322
190
|
output: {
|
|
323
191
|
publicPath: "auto",
|
|
324
192
|
path: ifMin(paths.appDist, void 0),
|
|
@@ -340,12 +208,12 @@ var getWebpackConfig = async (env) => {
|
|
|
340
208
|
errorDetails: true
|
|
341
209
|
}),
|
|
342
210
|
module: {
|
|
343
|
-
rules:
|
|
211
|
+
rules: removeEmpty([
|
|
344
212
|
ifNotMin({
|
|
345
213
|
enforce: "pre",
|
|
346
214
|
exclude: /@babel\/runtime/,
|
|
347
215
|
test: /\.(js|jsx|ts|tsx|css|scss)$/,
|
|
348
|
-
use:
|
|
216
|
+
use: require3.resolve("source-map-loader")
|
|
349
217
|
}),
|
|
350
218
|
{
|
|
351
219
|
oneOf: [
|
|
@@ -356,42 +224,42 @@ var getWebpackConfig = async (env) => {
|
|
|
356
224
|
resolveApp("node_modules/micromark"),
|
|
357
225
|
resolveApp("node_modules/decode-named-character-reference")
|
|
358
226
|
], [resolveApp("."), resolveApp("../../src")]),
|
|
359
|
-
loader:
|
|
227
|
+
loader: require3.resolve("babel-loader"),
|
|
360
228
|
options: {
|
|
361
229
|
babelrc: false,
|
|
362
230
|
configFile: false,
|
|
363
231
|
sourceMaps: ifNotMin(),
|
|
364
232
|
inputSourceMap: ifNotMin(),
|
|
365
233
|
presets: [
|
|
366
|
-
|
|
234
|
+
require3.resolve("@babel/preset-env"),
|
|
367
235
|
[
|
|
368
|
-
|
|
236
|
+
require3.resolve("@babel/preset-typescript"),
|
|
369
237
|
{
|
|
370
238
|
allowDeclareFields: true
|
|
371
239
|
}
|
|
372
240
|
],
|
|
373
|
-
|
|
241
|
+
require3.resolve("@babel/preset-react")
|
|
374
242
|
],
|
|
375
|
-
plugins:
|
|
243
|
+
plugins: removeEmpty([
|
|
376
244
|
[
|
|
377
|
-
|
|
245
|
+
require3.resolve("@babel/plugin-transform-runtime"),
|
|
378
246
|
{
|
|
379
247
|
corejs: {
|
|
380
248
|
version: 3,
|
|
381
249
|
proposals: true
|
|
382
250
|
},
|
|
383
|
-
absoluteRuntime:
|
|
251
|
+
absoluteRuntime: dirname(require3.resolve("@babel/runtime-corejs3/package.json"))
|
|
384
252
|
}
|
|
385
253
|
],
|
|
386
254
|
[
|
|
387
|
-
|
|
255
|
+
require3.resolve("@babel/plugin-proposal-decorators"),
|
|
388
256
|
{
|
|
389
257
|
legacy: true
|
|
390
258
|
}
|
|
391
259
|
],
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
ifHmr(
|
|
260
|
+
require3.resolve("@babel/plugin-syntax-dynamic-import"),
|
|
261
|
+
require3.resolve("babel-plugin-lodash"),
|
|
262
|
+
ifHmr(require3.resolve("react-refresh/babel"))
|
|
395
263
|
])
|
|
396
264
|
}
|
|
397
265
|
},
|
|
@@ -426,7 +294,7 @@ var getWebpackConfig = async (env) => {
|
|
|
426
294
|
issuer: [/\.(ts|tsx|js|jsx|md|mdx)$/],
|
|
427
295
|
use: [
|
|
428
296
|
{
|
|
429
|
-
loader:
|
|
297
|
+
loader: require3.resolve("@svgr/webpack"),
|
|
430
298
|
options: {
|
|
431
299
|
svgoConfig: {
|
|
432
300
|
plugins: [
|
|
@@ -443,7 +311,7 @@ var getWebpackConfig = async (env) => {
|
|
|
443
311
|
}
|
|
444
312
|
},
|
|
445
313
|
{
|
|
446
|
-
loader:
|
|
314
|
+
loader: require3.resolve("url-loader"),
|
|
447
315
|
options: {
|
|
448
316
|
name: "assets/[name]-[contenthash:16].[ext]",
|
|
449
317
|
limit: imageInlineSizeLimit
|
|
@@ -463,13 +331,13 @@ var getWebpackConfig = async (env) => {
|
|
|
463
331
|
{
|
|
464
332
|
test: /\.ya?ml$/,
|
|
465
333
|
use: [
|
|
466
|
-
{ loader:
|
|
467
|
-
{ loader:
|
|
334
|
+
{ loader: require3.resolve("json-loader") },
|
|
335
|
+
{ loader: require3.resolve("yaml-loader") }
|
|
468
336
|
]
|
|
469
337
|
},
|
|
470
338
|
{
|
|
471
339
|
test: /\.html$/,
|
|
472
|
-
loader:
|
|
340
|
+
loader: require3.resolve("html-loader"),
|
|
473
341
|
options: {
|
|
474
342
|
minimize: false
|
|
475
343
|
}
|
|
@@ -484,7 +352,6 @@ var getWebpackConfig = async (env) => {
|
|
|
484
352
|
},
|
|
485
353
|
devtool: ifMin(false, "cheap-module-source-map"),
|
|
486
354
|
devServer: {
|
|
487
|
-
port,
|
|
488
355
|
static: false,
|
|
489
356
|
historyApiFallback: {
|
|
490
357
|
disableDotRule: true
|
|
@@ -502,28 +369,28 @@ var getWebpackConfig = async (env) => {
|
|
|
502
369
|
},
|
|
503
370
|
optimization: {
|
|
504
371
|
removeEmptyChunks: true,
|
|
505
|
-
minimizer: ["...", new
|
|
372
|
+
minimizer: ["...", new CssMinimizerPlugin()]
|
|
506
373
|
},
|
|
507
|
-
plugins:
|
|
508
|
-
new
|
|
509
|
-
new
|
|
374
|
+
plugins: removeEmpty([
|
|
375
|
+
new webpack.ProgressPlugin(),
|
|
376
|
+
new ESLintPlugin({
|
|
510
377
|
extensions: moduleFileExtensions,
|
|
511
|
-
eslintPath:
|
|
378
|
+
eslintPath: require3.resolve("eslint"),
|
|
512
379
|
cwd: paths.app,
|
|
513
380
|
resolvePluginsRelativeTo: paths.app
|
|
514
381
|
}),
|
|
515
|
-
ifMin(new
|
|
516
|
-
...appHtmlFiles.map((file) => new
|
|
382
|
+
ifMin(new CleanWebpackPlugin({})),
|
|
383
|
+
...appHtmlFiles.map((file) => new HtmlWebpackPlugin2({
|
|
517
384
|
template: file,
|
|
518
|
-
filename:
|
|
385
|
+
filename: basename(file),
|
|
519
386
|
inject: false,
|
|
520
387
|
minify: false
|
|
521
388
|
})),
|
|
522
|
-
new
|
|
523
|
-
new
|
|
524
|
-
new
|
|
389
|
+
new InterpolateHtmlPlugin(envVars.raw),
|
|
390
|
+
new webpack.DefinePlugin(envVars.stringified),
|
|
391
|
+
new ForkTsCheckerWebpackPlugin({
|
|
525
392
|
typescript: {
|
|
526
|
-
typescriptPath:
|
|
393
|
+
typescriptPath: require3.resolve("typescript", {
|
|
527
394
|
paths: [paths.appNodeModules]
|
|
528
395
|
}),
|
|
529
396
|
configFile: paths.appTsConfig,
|
|
@@ -536,8 +403,8 @@ var getWebpackConfig = async (env) => {
|
|
|
536
403
|
}
|
|
537
404
|
}
|
|
538
405
|
}),
|
|
539
|
-
ifHmr(new
|
|
540
|
-
ifMin(new
|
|
406
|
+
ifHmr(new ReactRefreshWebpackPlugin()),
|
|
407
|
+
ifMin(new MiniCssExtractPlugin({
|
|
541
408
|
filename: "[name]-[contenthash:16].css",
|
|
542
409
|
chunkFilename: "[name]-[contenthash:16].css",
|
|
543
410
|
ignoreOrder: true,
|
|
@@ -545,31 +412,30 @@ var getWebpackConfig = async (env) => {
|
|
|
545
412
|
"data-widget": `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`
|
|
546
413
|
}
|
|
547
414
|
})),
|
|
548
|
-
new
|
|
415
|
+
new webpack.IgnorePlugin({
|
|
549
416
|
resourceRegExp: /^\.\/locale$/,
|
|
550
417
|
contextRegExp: /moment$/
|
|
551
418
|
}),
|
|
552
|
-
ifMin(new
|
|
553
|
-
ifMin() && ifCore() ? new
|
|
554
|
-
patterns: [
|
|
555
|
-
{
|
|
556
|
-
from: "docs",
|
|
557
|
-
to: "docs"
|
|
558
|
-
}
|
|
559
|
-
]
|
|
419
|
+
ifMin(new webpack.ids.HashedModuleIdsPlugin()),
|
|
420
|
+
ifMin() && ifCore() ? new CopyPlugin({
|
|
421
|
+
patterns: ["README.md", "readme.html"]
|
|
560
422
|
}) : void 0,
|
|
561
|
-
ifMin() && ifAnalyze() ? new
|
|
423
|
+
ifMin() && ifAnalyze() ? new StatoscopeWebpackPlugin({
|
|
562
424
|
name: ifCore("tamaro-core", "tamaro-customer-config"),
|
|
563
425
|
saveReportTo: "reports/report.html",
|
|
564
426
|
saveStatsTo: "reports/stats-[name]-[hash].json",
|
|
565
|
-
additionalStats:
|
|
427
|
+
additionalStats: glob.sync("reports/*.json"),
|
|
566
428
|
open: false
|
|
567
429
|
}) : void 0
|
|
568
|
-
])
|
|
430
|
+
]),
|
|
431
|
+
infrastructureLogging: {
|
|
432
|
+
stream: process.stdout,
|
|
433
|
+
appendOnly: false
|
|
434
|
+
}
|
|
569
435
|
};
|
|
570
|
-
return
|
|
436
|
+
return removeEmpty(config);
|
|
571
437
|
};
|
|
572
438
|
var webpack_config_default = getWebpackConfig;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
439
|
+
export {
|
|
440
|
+
webpack_config_default as default
|
|
441
|
+
};
|