@raisenow/tamaro-cli 1.0.8 → 1.0.11
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 -14
- package/.gitignore +4 -5
- package/.nvmrc +1 -1
- package/.prettierignore +1 -0
- package/{.prettierrc.js → .prettierrc.cjs} +0 -0
- package/README.md +229 -0
- package/dist/chunk-PIEFLCDU.js +144 -0
- package/dist/cli.js +486 -194
- package/dist/webpack.config.js +119 -227
- package/package.json +38 -47
- package/readme.html +1 -1
- package/src/cli.ts +109 -21
- package/src/commands/build.ts +99 -0
- package/src/commands/deploy-email-config.ts +115 -0
- package/src/commands/deploy.ts +163 -0
- package/src/commands/dev.ts +68 -0
- package/src/commands/list-deployed.ts +112 -0
- package/src/commands/serve.ts +53 -0
- package/src/lib/InterpolateHtmlPlugin.ts +10 -8
- package/src/lib/aws.ts +127 -0
- 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 +36 -28
- package/tsconfig.json +1 -1
- package/readme.md +0 -201
- package/src/assets/rnw-logo.png +0 -0
- package/src/commands/build/index.ts +0 -42
- package/src/commands/deploy/index.ts +0 -24
- package/src/commands/dev/index.ts +0 -32
- package/src/commands/serve/index.ts +0 -12
- package/src/lib/helpers.ts +0 -279
- package/src/lib/polyfills.js +0 -8
package/dist/webpack.config.js
CHANGED
|
@@ -1,166 +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_eslint_webpack_plugin = __toESM(require("eslint-webpack-plugin"));
|
|
61
|
-
var import_copy_webpack_plugin = __toESM(require("copy-webpack-plugin"));
|
|
62
|
-
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";
|
|
63
31
|
|
|
64
32
|
// src/lib/InterpolateHtmlPlugin.ts
|
|
65
|
-
|
|
66
|
-
|
|
33
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
34
|
+
import escapeStringRegexp from "escape-string-regexp";
|
|
35
|
+
var PLUGIN_NAME = "InterpolateHtmlPlugin";
|
|
67
36
|
var InterpolateHtmlPlugin = class {
|
|
68
37
|
replacements;
|
|
69
38
|
constructor(replacements) {
|
|
70
39
|
this.replacements = __spreadValues({}, replacements);
|
|
71
40
|
}
|
|
72
41
|
apply(compiler) {
|
|
73
|
-
compiler.hooks.compilation.tap(
|
|
74
|
-
const hooks =
|
|
75
|
-
hooks.alterAssetTagGroups.tap(
|
|
42
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
43
|
+
const hooks = HtmlWebpackPlugin.getHooks(compilation);
|
|
44
|
+
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
76
45
|
this.replacements["ENTRY"] = assets.headTags[0].attributes["src"];
|
|
77
46
|
return assets;
|
|
78
47
|
});
|
|
79
|
-
hooks.afterTemplateExecution.tap(
|
|
48
|
+
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
80
49
|
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
81
|
-
data.html = data.html.replace(new RegExp(`%${(
|
|
50
|
+
data.html = data.html.replace(new RegExp(`%${escapeStringRegexp(key)}%`, "g"), value);
|
|
82
51
|
});
|
|
83
52
|
return data;
|
|
84
53
|
});
|
|
85
54
|
});
|
|
86
55
|
}
|
|
87
56
|
};
|
|
88
|
-
var InterpolateHtmlPlugin_default = InterpolateHtmlPlugin;
|
|
89
57
|
|
|
90
|
-
// src/lib/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
var import_webpack_config_utils = require("webpack-config-utils");
|
|
96
|
-
var import_columnify = __toESM(require("columnify"));
|
|
97
|
-
var import_boxen = __toESM(require("boxen"));
|
|
98
|
-
var import_dotenv_expand = require("dotenv-expand");
|
|
99
|
-
var import_dotenv = require("dotenv");
|
|
100
|
-
var import_strip_indent = __toESM(require("strip-indent"));
|
|
101
|
-
var TAMARO_CORE_PACKAGE_NAMES = ["@raisenow/tamaro-core", "demo-tamaro-core"];
|
|
102
|
-
var TAMARO_CONFIGURATIONS_PACKAGE_NAMES = [
|
|
103
|
-
"@raisenow/tamaro-configurations",
|
|
104
|
-
"demo-tamaro-configurations"
|
|
105
|
-
];
|
|
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
|
-
console.error(import_chalk.default.red((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(0);
|
|
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
|
-
};
|
|
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);
|
|
161
63
|
var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
162
64
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
163
|
-
(
|
|
65
|
+
dotenvExpand(dotenvConfig({ path: filePath }));
|
|
164
66
|
(_b = (_a = process.env).NODE_ENV) != null ? _b : _a.NODE_ENV = ifMin("production", "development");
|
|
165
67
|
(_d = (_c = process.env).BABEL_ENV) != null ? _d : _c.BABEL_ENV = ifMin("production", "development");
|
|
166
68
|
(_f = (_e = process.env).EXPOSE_VAR) != null ? _f : _e.EXPOSE_VAR = ifCore("rnw.tamaroCore", "rnw.tamaro");
|
|
@@ -170,7 +72,7 @@ var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
|
170
72
|
if (ifCore()) {
|
|
171
73
|
process.env.PRODUCT_NAME = "tamaro";
|
|
172
74
|
const corePkgPath = resolveApp("package.json");
|
|
173
|
-
const { version } =
|
|
75
|
+
const { version } = require2(corePkgPath);
|
|
174
76
|
process.env.PRODUCT_VERSION = version;
|
|
175
77
|
}
|
|
176
78
|
if (!ifCore()) {
|
|
@@ -208,42 +110,29 @@ var getEnvVars = (filePath, ifMin, ifCore, ifLocalCore) => {
|
|
|
208
110
|
};
|
|
209
111
|
return { raw, stringified };
|
|
210
112
|
};
|
|
211
|
-
var logDataTable = (vars, title) => {
|
|
212
|
-
const boxTitle = import_chalk.default.bold(`${title}:
|
|
213
|
-
`);
|
|
214
|
-
const boxTable = (0, import_columnify.default)(vars, { showHeaders: false });
|
|
215
|
-
console.log((0, import_boxen.default)(`${boxTitle}
|
|
216
|
-
${boxTable}`, {
|
|
217
|
-
margin: 0,
|
|
218
|
-
padding: {
|
|
219
|
-
top: 0,
|
|
220
|
-
right: 1,
|
|
221
|
-
bottom: 0,
|
|
222
|
-
left: 1
|
|
223
|
-
},
|
|
224
|
-
borderColor: "green"
|
|
225
|
-
}));
|
|
226
|
-
};
|
|
227
113
|
|
|
228
114
|
// src/webpack.config.ts
|
|
115
|
+
var require3 = createRequire2(import.meta.url);
|
|
229
116
|
var imageInlineSizeLimit = 0;
|
|
230
117
|
var getWebpackConfig = async (env) => {
|
|
231
|
-
const { ifMin, ifNotMin } =
|
|
232
|
-
const { ifAnalyze } =
|
|
233
|
-
const { ifLocalCore } =
|
|
118
|
+
const { ifMin, ifNotMin } = getIfUtils(env, ["min"]);
|
|
119
|
+
const { ifAnalyze } = getIfUtils(env, ["analyze"]);
|
|
120
|
+
const { ifLocalCore } = getIfUtils(env, ["localCore"]);
|
|
234
121
|
const { ifCore } = getIfCoreFns();
|
|
235
122
|
const paths = getPaths(ifCore);
|
|
236
|
-
const appHtmlFiles =
|
|
123
|
+
const appHtmlFiles = glob.sync(paths.appHtml);
|
|
237
124
|
const envVars = getEnvVars(paths.appEnv, ifMin, ifCore, ifLocalCore);
|
|
238
|
-
const { ifHmr } =
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
logDataTable(
|
|
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);
|
|
242
131
|
const getCssLoaders = (cssOptions = {}) => {
|
|
243
|
-
return
|
|
244
|
-
ifMin({ loader:
|
|
132
|
+
return removeEmpty([
|
|
133
|
+
ifMin({ loader: MiniCssExtractPlugin.loader }),
|
|
245
134
|
ifNotMin({
|
|
246
|
-
loader:
|
|
135
|
+
loader: require3.resolve("style-loader"),
|
|
247
136
|
options: {
|
|
248
137
|
attributes: {
|
|
249
138
|
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
@@ -251,30 +140,35 @@ var getWebpackConfig = async (env) => {
|
|
|
251
140
|
}
|
|
252
141
|
}),
|
|
253
142
|
{
|
|
254
|
-
loader:
|
|
143
|
+
loader: require3.resolve("css-loader"),
|
|
255
144
|
options: __spreadValues({
|
|
256
145
|
sourceMap: ifNotMin(),
|
|
257
146
|
importLoaders: 3
|
|
258
147
|
}, cssOptions)
|
|
259
148
|
},
|
|
260
149
|
{
|
|
261
|
-
loader:
|
|
150
|
+
loader: require3.resolve("postcss-loader"),
|
|
262
151
|
options: {
|
|
263
152
|
postcssOptions: {
|
|
264
|
-
plugins:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
153
|
+
plugins: removeEmpty([
|
|
154
|
+
useTailwind ? [
|
|
155
|
+
require3.resolve("tailwindcss", {
|
|
156
|
+
paths: [paths.appNodeModules]
|
|
157
|
+
}),
|
|
158
|
+
paths.appTailwindConfig
|
|
159
|
+
] : void 0,
|
|
160
|
+
require3.resolve("postcss-custom-properties"),
|
|
161
|
+
require3.resolve("autoprefixer")
|
|
268
162
|
])
|
|
269
163
|
}
|
|
270
164
|
}
|
|
271
165
|
},
|
|
272
166
|
{
|
|
273
|
-
loader:
|
|
167
|
+
loader: require3.resolve("resolve-url-loader"),
|
|
274
168
|
options: { sourceMap: ifNotMin() }
|
|
275
169
|
},
|
|
276
170
|
{
|
|
277
|
-
loader:
|
|
171
|
+
loader: require3.resolve("sass-loader"),
|
|
278
172
|
options: { sourceMap: true }
|
|
279
173
|
}
|
|
280
174
|
]);
|
|
@@ -286,13 +180,13 @@ var getWebpackConfig = async (env) => {
|
|
|
286
180
|
extensions: [...extensions, "..."],
|
|
287
181
|
modules: ["node_modules", paths.appNodeModules],
|
|
288
182
|
plugins: [
|
|
289
|
-
new
|
|
183
|
+
new TsconfigPathsPlugin({
|
|
290
184
|
configFile: paths.appTsConfig,
|
|
291
185
|
extensions
|
|
292
186
|
})
|
|
293
187
|
]
|
|
294
188
|
},
|
|
295
|
-
entry:
|
|
189
|
+
entry: paths.appEntry,
|
|
296
190
|
output: {
|
|
297
191
|
publicPath: "auto",
|
|
298
192
|
path: ifMin(paths.appDist, void 0),
|
|
@@ -314,12 +208,12 @@ var getWebpackConfig = async (env) => {
|
|
|
314
208
|
errorDetails: true
|
|
315
209
|
}),
|
|
316
210
|
module: {
|
|
317
|
-
rules:
|
|
211
|
+
rules: removeEmpty([
|
|
318
212
|
ifNotMin({
|
|
319
213
|
enforce: "pre",
|
|
320
214
|
exclude: /@babel\/runtime/,
|
|
321
215
|
test: /\.(js|jsx|ts|tsx|css|scss)$/,
|
|
322
|
-
use:
|
|
216
|
+
use: require3.resolve("source-map-loader")
|
|
323
217
|
}),
|
|
324
218
|
{
|
|
325
219
|
oneOf: [
|
|
@@ -330,42 +224,42 @@ var getWebpackConfig = async (env) => {
|
|
|
330
224
|
resolveApp("node_modules/micromark"),
|
|
331
225
|
resolveApp("node_modules/decode-named-character-reference")
|
|
332
226
|
], [resolveApp("."), resolveApp("../../src")]),
|
|
333
|
-
loader:
|
|
227
|
+
loader: require3.resolve("babel-loader"),
|
|
334
228
|
options: {
|
|
335
229
|
babelrc: false,
|
|
336
230
|
configFile: false,
|
|
337
231
|
sourceMaps: ifNotMin(),
|
|
338
232
|
inputSourceMap: ifNotMin(),
|
|
339
233
|
presets: [
|
|
340
|
-
|
|
234
|
+
require3.resolve("@babel/preset-env"),
|
|
341
235
|
[
|
|
342
|
-
|
|
236
|
+
require3.resolve("@babel/preset-typescript"),
|
|
343
237
|
{
|
|
344
238
|
allowDeclareFields: true
|
|
345
239
|
}
|
|
346
240
|
],
|
|
347
|
-
|
|
241
|
+
require3.resolve("@babel/preset-react")
|
|
348
242
|
],
|
|
349
|
-
plugins:
|
|
243
|
+
plugins: removeEmpty([
|
|
350
244
|
[
|
|
351
|
-
|
|
245
|
+
require3.resolve("@babel/plugin-transform-runtime"),
|
|
352
246
|
{
|
|
353
247
|
corejs: {
|
|
354
248
|
version: 3,
|
|
355
249
|
proposals: true
|
|
356
250
|
},
|
|
357
|
-
absoluteRuntime:
|
|
251
|
+
absoluteRuntime: dirname(require3.resolve("@babel/runtime-corejs3/package.json"))
|
|
358
252
|
}
|
|
359
253
|
],
|
|
360
254
|
[
|
|
361
|
-
|
|
255
|
+
require3.resolve("@babel/plugin-proposal-decorators"),
|
|
362
256
|
{
|
|
363
257
|
legacy: true
|
|
364
258
|
}
|
|
365
259
|
],
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
ifHmr(
|
|
260
|
+
require3.resolve("@babel/plugin-syntax-dynamic-import"),
|
|
261
|
+
require3.resolve("babel-plugin-lodash"),
|
|
262
|
+
ifHmr(require3.resolve("react-refresh/babel"))
|
|
369
263
|
])
|
|
370
264
|
}
|
|
371
265
|
},
|
|
@@ -400,7 +294,7 @@ var getWebpackConfig = async (env) => {
|
|
|
400
294
|
issuer: [/\.(ts|tsx|js|jsx|md|mdx)$/],
|
|
401
295
|
use: [
|
|
402
296
|
{
|
|
403
|
-
loader:
|
|
297
|
+
loader: require3.resolve("@svgr/webpack"),
|
|
404
298
|
options: {
|
|
405
299
|
svgoConfig: {
|
|
406
300
|
plugins: [
|
|
@@ -417,7 +311,7 @@ var getWebpackConfig = async (env) => {
|
|
|
417
311
|
}
|
|
418
312
|
},
|
|
419
313
|
{
|
|
420
|
-
loader:
|
|
314
|
+
loader: require3.resolve("url-loader"),
|
|
421
315
|
options: {
|
|
422
316
|
name: "assets/[name]-[contenthash:16].[ext]",
|
|
423
317
|
limit: imageInlineSizeLimit
|
|
@@ -437,13 +331,13 @@ var getWebpackConfig = async (env) => {
|
|
|
437
331
|
{
|
|
438
332
|
test: /\.ya?ml$/,
|
|
439
333
|
use: [
|
|
440
|
-
{ loader:
|
|
441
|
-
{ loader:
|
|
334
|
+
{ loader: require3.resolve("json-loader") },
|
|
335
|
+
{ loader: require3.resolve("yaml-loader") }
|
|
442
336
|
]
|
|
443
337
|
},
|
|
444
338
|
{
|
|
445
339
|
test: /\.html$/,
|
|
446
|
-
loader:
|
|
340
|
+
loader: require3.resolve("html-loader"),
|
|
447
341
|
options: {
|
|
448
342
|
minimize: false
|
|
449
343
|
}
|
|
@@ -458,7 +352,6 @@ var getWebpackConfig = async (env) => {
|
|
|
458
352
|
},
|
|
459
353
|
devtool: ifMin(false, "cheap-module-source-map"),
|
|
460
354
|
devServer: {
|
|
461
|
-
port,
|
|
462
355
|
static: false,
|
|
463
356
|
historyApiFallback: {
|
|
464
357
|
disableDotRule: true
|
|
@@ -476,28 +369,28 @@ var getWebpackConfig = async (env) => {
|
|
|
476
369
|
},
|
|
477
370
|
optimization: {
|
|
478
371
|
removeEmptyChunks: true,
|
|
479
|
-
minimizer: ["...", new
|
|
372
|
+
minimizer: ["...", new CssMinimizerPlugin()]
|
|
480
373
|
},
|
|
481
|
-
plugins:
|
|
482
|
-
new
|
|
483
|
-
new
|
|
374
|
+
plugins: removeEmpty([
|
|
375
|
+
new webpack.ProgressPlugin(),
|
|
376
|
+
new ESLintPlugin({
|
|
484
377
|
extensions: moduleFileExtensions,
|
|
485
|
-
eslintPath:
|
|
378
|
+
eslintPath: require3.resolve("eslint"),
|
|
486
379
|
cwd: paths.app,
|
|
487
380
|
resolvePluginsRelativeTo: paths.app
|
|
488
381
|
}),
|
|
489
|
-
ifMin(new
|
|
490
|
-
...appHtmlFiles.map((file) => new
|
|
382
|
+
ifMin(new CleanWebpackPlugin({})),
|
|
383
|
+
...appHtmlFiles.map((file) => new HtmlWebpackPlugin2({
|
|
491
384
|
template: file,
|
|
492
|
-
filename:
|
|
385
|
+
filename: basename(file),
|
|
493
386
|
inject: false,
|
|
494
387
|
minify: false
|
|
495
388
|
})),
|
|
496
|
-
new
|
|
497
|
-
new
|
|
498
|
-
new
|
|
389
|
+
new InterpolateHtmlPlugin(envVars.raw),
|
|
390
|
+
new webpack.DefinePlugin(envVars.stringified),
|
|
391
|
+
new ForkTsCheckerWebpackPlugin({
|
|
499
392
|
typescript: {
|
|
500
|
-
typescriptPath:
|
|
393
|
+
typescriptPath: require3.resolve("typescript", {
|
|
501
394
|
paths: [paths.appNodeModules]
|
|
502
395
|
}),
|
|
503
396
|
configFile: paths.appTsConfig,
|
|
@@ -510,8 +403,8 @@ var getWebpackConfig = async (env) => {
|
|
|
510
403
|
}
|
|
511
404
|
}
|
|
512
405
|
}),
|
|
513
|
-
ifHmr(new
|
|
514
|
-
ifMin(new
|
|
406
|
+
ifHmr(new ReactRefreshWebpackPlugin()),
|
|
407
|
+
ifMin(new MiniCssExtractPlugin({
|
|
515
408
|
filename: "[name]-[contenthash:16].css",
|
|
516
409
|
chunkFilename: "[name]-[contenthash:16].css",
|
|
517
410
|
ignoreOrder: true,
|
|
@@ -519,31 +412,30 @@ var getWebpackConfig = async (env) => {
|
|
|
519
412
|
"data-widget": `${process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET}`
|
|
520
413
|
}
|
|
521
414
|
})),
|
|
522
|
-
new
|
|
415
|
+
new webpack.IgnorePlugin({
|
|
523
416
|
resourceRegExp: /^\.\/locale$/,
|
|
524
417
|
contextRegExp: /moment$/
|
|
525
418
|
}),
|
|
526
|
-
ifMin(new
|
|
527
|
-
ifMin() && ifCore() ? new
|
|
528
|
-
patterns: [
|
|
529
|
-
{
|
|
530
|
-
from: "docs",
|
|
531
|
-
to: "docs"
|
|
532
|
-
}
|
|
533
|
-
]
|
|
419
|
+
ifMin(new webpack.ids.HashedModuleIdsPlugin()),
|
|
420
|
+
ifMin() && ifCore() ? new CopyPlugin({
|
|
421
|
+
patterns: ["README.md", "readme.html"]
|
|
534
422
|
}) : void 0,
|
|
535
|
-
ifMin() && ifAnalyze() ? new
|
|
423
|
+
ifMin() && ifAnalyze() ? new StatoscopeWebpackPlugin({
|
|
536
424
|
name: ifCore("tamaro-core", "tamaro-customer-config"),
|
|
537
425
|
saveReportTo: "reports/report.html",
|
|
538
426
|
saveStatsTo: "reports/stats-[name]-[hash].json",
|
|
539
|
-
additionalStats:
|
|
427
|
+
additionalStats: glob.sync("reports/*.json"),
|
|
540
428
|
open: false
|
|
541
429
|
}) : void 0
|
|
542
|
-
])
|
|
430
|
+
]),
|
|
431
|
+
infrastructureLogging: {
|
|
432
|
+
stream: process.stdout,
|
|
433
|
+
appendOnly: false
|
|
434
|
+
}
|
|
543
435
|
};
|
|
544
|
-
return
|
|
436
|
+
return removeEmpty(config);
|
|
545
437
|
};
|
|
546
438
|
var webpack_config_default = getWebpackConfig;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
439
|
+
export {
|
|
440
|
+
webpack_config_default as default
|
|
441
|
+
};
|