@raisenow/tamaro-cli 1.0.25 → 1.1.0
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 +3 -0
- package/.eslintrc.cjs +142 -42
- package/.nvmrc +1 -1
- package/.prettierignore +3 -0
- package/README.md +14 -22
- package/dist/{chunk-XC5QT3RG.js → chunk-S4M23KNZ.js} +64 -44
- package/dist/cli.js +334 -322
- package/dist/webpack.config.js +54 -22
- package/package.json +64 -54
- package/readme.html +1 -1
- package/src/cli.ts +12 -44
- package/src/commands/build.ts +23 -15
- package/src/commands/deploy-email-config.ts +19 -52
- package/src/commands/deploy.ts +18 -19
- package/src/commands/dev.ts +9 -6
- package/src/commands/list-deployed.ts +15 -20
- package/src/commands/serve.ts +3 -3
- package/src/lib/InterpolateHtmlPlugin.ts +7 -7
- package/src/lib/aws.ts +72 -26
- package/src/lib/command.ts +5 -1
- package/src/lib/constants.ts +2 -1
- package/src/lib/env.ts +43 -28
- package/src/lib/https.ts +2 -2
- package/src/lib/logging.ts +9 -4
- package/src/lib/resolve.ts +5 -7
- package/src/webpack.config.ts +21 -20
- package/tsconfig.json +5 -1
- package/.gitignore +0 -14
- package/tsconfig.eslint.json +0 -7
package/dist/webpack.config.js
CHANGED
|
@@ -10,29 +10,29 @@ import {
|
|
|
10
10
|
logTitle,
|
|
11
11
|
moduleFileExtensions,
|
|
12
12
|
resolveApp
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S4M23KNZ.js";
|
|
14
14
|
|
|
15
15
|
// src/webpack.config.ts
|
|
16
|
+
import { existsSync } from "fs";
|
|
16
17
|
import { createRequire } from "module";
|
|
17
18
|
import { basename, dirname, resolve } from "path";
|
|
18
|
-
import { existsSync } from "fs";
|
|
19
|
-
import glob from "glob";
|
|
20
|
-
import { getIfUtils, removeEmpty } from "webpack-config-utils";
|
|
21
|
-
import webpack from "webpack";
|
|
22
|
-
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
23
|
-
import { CleanWebpackPlugin } from "clean-webpack-plugin";
|
|
24
|
-
import HtmlWebpackPlugin2 from "html-webpack-plugin";
|
|
25
|
-
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
|
26
19
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
27
|
-
import
|
|
20
|
+
import StatoscopeWebpackPlugin from "@statoscope/webpack-plugin";
|
|
21
|
+
import { CleanWebpackPlugin } from "clean-webpack-plugin";
|
|
22
|
+
import CopyPlugin from "copy-webpack-plugin";
|
|
28
23
|
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
29
24
|
import ESLintPlugin from "eslint-webpack-plugin";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
25
|
+
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
|
26
|
+
import { globSync } from "glob";
|
|
27
|
+
import HtmlWebpackPlugin2 from "html-webpack-plugin";
|
|
28
|
+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
29
|
+
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
30
|
+
import webpack from "webpack";
|
|
31
|
+
import { getIfUtils, removeEmpty } from "webpack-config-utils";
|
|
32
32
|
|
|
33
33
|
// src/lib/InterpolateHtmlPlugin.ts
|
|
34
|
-
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
35
34
|
import escapeStringRegexp from "escape-string-regexp";
|
|
35
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
36
36
|
var PLUGIN_NAME = "InterpolateHtmlPlugin";
|
|
37
37
|
var InterpolateHtmlPlugin = class {
|
|
38
38
|
replacements;
|
|
@@ -43,16 +43,16 @@ var InterpolateHtmlPlugin = class {
|
|
|
43
43
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
44
44
|
const hooks = HtmlWebpackPlugin.getHooks(compilation);
|
|
45
45
|
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
46
|
-
const publicUrl = this.replacements
|
|
47
|
-
const entry = assets.headTags[0].attributes
|
|
48
|
-
this.replacements
|
|
46
|
+
const publicUrl = this.replacements.PUBLIC_URL ?? "";
|
|
47
|
+
const entry = assets.headTags[0].attributes.src;
|
|
48
|
+
this.replacements.ENTRY = `${publicUrl}${entry}`;
|
|
49
49
|
return assets;
|
|
50
50
|
});
|
|
51
51
|
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
52
52
|
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
53
53
|
data.html = data.html.replace(
|
|
54
54
|
new RegExp(`%${escapeStringRegexp(key)}%`, "g"),
|
|
55
|
-
value
|
|
55
|
+
value ?? ""
|
|
56
56
|
);
|
|
57
57
|
});
|
|
58
58
|
return data;
|
|
@@ -64,15 +64,15 @@ var InterpolateHtmlPlugin = class {
|
|
|
64
64
|
// src/webpack.config.ts
|
|
65
65
|
var require2 = createRequire(import.meta.url);
|
|
66
66
|
var imageInlineSizeLimit = 0;
|
|
67
|
-
var getWebpackConfig =
|
|
67
|
+
var getWebpackConfig = (env) => {
|
|
68
68
|
const { ifMin, ifNotMin } = getIfUtils(env, ["min"]);
|
|
69
69
|
const { ifAnalyze } = getIfUtils(env, ["analyze"]);
|
|
70
70
|
const { ifHttps } = getIfUtils(env, ["https"]);
|
|
71
71
|
const { ifLocalCore } = getIfUtils(env, ["localCore"]);
|
|
72
72
|
const { ifCore } = getIfCoreFns();
|
|
73
73
|
const paths = getPaths(ifCore);
|
|
74
|
-
const appHtmlFiles =
|
|
75
|
-
const appEnvFiles =
|
|
74
|
+
const appHtmlFiles = globSync(paths.appHtml);
|
|
75
|
+
const appEnvFiles = globSync(paths.appEnv);
|
|
76
76
|
const envVars = getEnvVars(appEnvFiles, ifMin, ifCore, ifLocalCore, ifHttps);
|
|
77
77
|
const { ifHmr } = getIfUtils({ hmr: process.env.HMR_ENABLED === "true" }, ["hmr"]);
|
|
78
78
|
const useTailwind = ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig);
|
|
@@ -165,6 +165,7 @@ var getWebpackConfig = async (env) => {
|
|
|
165
165
|
),
|
|
166
166
|
module: {
|
|
167
167
|
rules: removeEmpty([
|
|
168
|
+
// Source maps
|
|
168
169
|
ifNotMin({
|
|
169
170
|
enforce: "pre",
|
|
170
171
|
exclude: /@babel\/runtime/,
|
|
@@ -173,6 +174,8 @@ var getWebpackConfig = async (env) => {
|
|
|
173
174
|
}),
|
|
174
175
|
{
|
|
175
176
|
oneOf: [
|
|
177
|
+
// App Javascript and Typescript (Babel)
|
|
178
|
+
// and some dependencies distributed in a non-es5 formats
|
|
176
179
|
{
|
|
177
180
|
test: /\.(js|ts)x?$/,
|
|
178
181
|
include: ifCore(
|
|
@@ -225,9 +228,11 @@ var getWebpackConfig = async (env) => {
|
|
|
225
228
|
])
|
|
226
229
|
}
|
|
227
230
|
},
|
|
231
|
+
// Other Javascript (not in app) - no transformation
|
|
228
232
|
{
|
|
229
233
|
test: /\.(js|mjs)$/
|
|
230
234
|
},
|
|
235
|
+
// Styles (not modules)
|
|
231
236
|
{
|
|
232
237
|
test: /\.s?css$/,
|
|
233
238
|
exclude: /\.module\.s?css$/,
|
|
@@ -235,12 +240,14 @@ var getWebpackConfig = async (env) => {
|
|
|
235
240
|
modules: false
|
|
236
241
|
})
|
|
237
242
|
},
|
|
243
|
+
// Styles (modules)
|
|
238
244
|
{
|
|
239
245
|
test: /\.module\.s?css$/,
|
|
240
246
|
use: getCssLoaders({
|
|
241
247
|
modules: { localIdentName: "[local]__[hash:base64]" }
|
|
242
248
|
})
|
|
243
249
|
},
|
|
250
|
+
// Images and fonts
|
|
244
251
|
{
|
|
245
252
|
test: /\.(png|jpe?g|svg|webp|gif|ico|ttf|eot|woff2?)$/,
|
|
246
253
|
type: "asset",
|
|
@@ -250,6 +257,7 @@ var getWebpackConfig = async (env) => {
|
|
|
250
257
|
}
|
|
251
258
|
}
|
|
252
259
|
},
|
|
260
|
+
// YML
|
|
253
261
|
{
|
|
254
262
|
test: /\.ya?ml$/,
|
|
255
263
|
use: [
|
|
@@ -260,6 +268,7 @@ var getWebpackConfig = async (env) => {
|
|
|
260
268
|
}
|
|
261
269
|
]
|
|
262
270
|
},
|
|
271
|
+
// HTML
|
|
263
272
|
{
|
|
264
273
|
test: /\.html$/,
|
|
265
274
|
loader: require2.resolve("html-loader"),
|
|
@@ -267,6 +276,8 @@ var getWebpackConfig = async (env) => {
|
|
|
267
276
|
minimize: false
|
|
268
277
|
}
|
|
269
278
|
},
|
|
279
|
+
// All other files - fallback
|
|
280
|
+
// This must be the latest rule!
|
|
270
281
|
{
|
|
271
282
|
exclude: [/^$/, /\.(js|jsx|ts|tsx|mjs)$/, /\.html$/, /\.json$/],
|
|
272
283
|
type: "asset/resource"
|
|
@@ -301,8 +312,12 @@ var getWebpackConfig = async (env) => {
|
|
|
301
312
|
})
|
|
302
313
|
},
|
|
303
314
|
optimization: {
|
|
315
|
+
// minimize: false,
|
|
304
316
|
removeEmptyChunks: true,
|
|
317
|
+
// moduleIds: 'deterministic', // todo: use instead of HashedModuleIdsPlugin
|
|
318
|
+
// chunkIds: 'named',
|
|
305
319
|
minimizer: ["...", new CssMinimizerPlugin()]
|
|
320
|
+
// sourceMaps: true?
|
|
306
321
|
},
|
|
307
322
|
plugins: removeEmpty([
|
|
308
323
|
new webpack.ProgressPlugin(),
|
|
@@ -313,7 +328,9 @@ var getWebpackConfig = async (env) => {
|
|
|
313
328
|
resolvePluginsRelativeTo: paths.app
|
|
314
329
|
}),
|
|
315
330
|
ifMin(
|
|
316
|
-
new CleanWebpackPlugin({
|
|
331
|
+
new CleanWebpackPlugin({
|
|
332
|
+
// verbose: true,
|
|
333
|
+
})
|
|
317
334
|
),
|
|
318
335
|
...appHtmlFiles.map(
|
|
319
336
|
(file) => new HtmlWebpackPlugin2({
|
|
@@ -321,6 +338,19 @@ var getWebpackConfig = async (env) => {
|
|
|
321
338
|
filename: basename(file),
|
|
322
339
|
inject: false,
|
|
323
340
|
minify: false
|
|
341
|
+
// ...ifMin({
|
|
342
|
+
// minify: {
|
|
343
|
+
// collapseWhitespace: true,
|
|
344
|
+
// removeComments: true,
|
|
345
|
+
// removeRedundantAttributes: true,
|
|
346
|
+
// removeScriptTypeAttributes: true,
|
|
347
|
+
// removeStyleLinkTypeAttributes: true,
|
|
348
|
+
// useShortDoctype: true,
|
|
349
|
+
// quoteCharacter: '"',
|
|
350
|
+
// minifyJS: true,
|
|
351
|
+
// minifyCSS: true,
|
|
352
|
+
// },
|
|
353
|
+
// }),
|
|
324
354
|
})
|
|
325
355
|
),
|
|
326
356
|
new InterpolateHtmlPlugin(envVars.raw),
|
|
@@ -355,7 +385,9 @@ var getWebpackConfig = async (env) => {
|
|
|
355
385
|
resourceRegExp: /^\.\/locale$/,
|
|
356
386
|
contextRegExp: /moment$/
|
|
357
387
|
}),
|
|
388
|
+
// eslint-disable-next-line import/no-named-as-default-member
|
|
358
389
|
ifMin(new webpack.ids.HashedModuleIdsPlugin()),
|
|
390
|
+
// todo: remove?
|
|
359
391
|
ifMin() && ifCore() ? new CopyPlugin({
|
|
360
392
|
patterns: ["*.md", "*.html"]
|
|
361
393
|
}) : void 0,
|
|
@@ -363,7 +395,7 @@ var getWebpackConfig = async (env) => {
|
|
|
363
395
|
name: ifCore("tamaro-core", "tamaro-customer-config"),
|
|
364
396
|
saveReportTo: "reports/report.html",
|
|
365
397
|
saveStatsTo: "reports/stats-[name]-[hash].json",
|
|
366
|
-
additionalStats:
|
|
398
|
+
additionalStats: globSync("reports/*.json"),
|
|
367
399
|
open: false
|
|
368
400
|
}) : void 0
|
|
369
401
|
]),
|
package/package.json
CHANGED
|
@@ -1,94 +1,104 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "RaiseNow",
|
|
6
6
|
"email": "development@raisenow.com"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"prepare": "
|
|
11
|
-
"
|
|
10
|
+
"prepare": "pnpm build",
|
|
11
|
+
"tscheck": "tsc --noEmit",
|
|
12
12
|
"build": "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
13
|
-
"build:watch": "
|
|
14
|
-
"
|
|
15
|
-
"lint": "eslint
|
|
13
|
+
"build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
|
|
14
|
+
"readme": "pnpx http-server . --cors -o /readme.html",
|
|
15
|
+
"lint": "eslint .",
|
|
16
|
+
"lint:fix": "eslint --fix .",
|
|
17
|
+
"format": "prettier --write ."
|
|
16
18
|
},
|
|
17
19
|
"bin": "dist/cli.js",
|
|
18
20
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
20
|
-
"npm": ">=
|
|
21
|
+
"node": ">=18",
|
|
22
|
+
"npm": ">=10"
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
|
-
"@babel/cli": "^7.
|
|
24
|
-
"@babel/core": "^7.
|
|
25
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
25
|
+
"@babel/cli": "^7.22.15",
|
|
26
|
+
"@babel/core": "^7.22.17",
|
|
27
|
+
"@babel/plugin-proposal-decorators": "^7.22.15",
|
|
26
28
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
28
|
-
"@babel/preset-env": "^7.
|
|
29
|
-
"@babel/preset-react": "^7.
|
|
30
|
-
"@babel/preset-typescript": "^7.
|
|
31
|
-
"@babel/runtime-corejs3": "^7.
|
|
32
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.
|
|
33
|
-
"@statoscope/webpack-plugin": "^5.
|
|
34
|
-
"@types/columnify": "^1.5.
|
|
35
|
-
"@types/lodash": "^4.14.
|
|
36
|
-
"@types/node": "^18.
|
|
29
|
+
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
30
|
+
"@babel/preset-env": "^7.22.15",
|
|
31
|
+
"@babel/preset-react": "^7.22.15",
|
|
32
|
+
"@babel/preset-typescript": "^7.22.15",
|
|
33
|
+
"@babel/runtime-corejs3": "^7.22.15",
|
|
34
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
35
|
+
"@statoscope/webpack-plugin": "^5.27.0",
|
|
36
|
+
"@types/columnify": "^1.5.2",
|
|
37
|
+
"@types/lodash": "^4.14.198",
|
|
38
|
+
"@types/node": "^18.17.15",
|
|
37
39
|
"@types/node-notifier": "^8.0.2",
|
|
40
|
+
"@types/prompts": "^2.4.4",
|
|
38
41
|
"@types/resolve-bin": "^0.4.1",
|
|
39
42
|
"@types/webpack-config-utils": "^2.3.1",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
41
|
-
"@typescript-eslint/parser": "^
|
|
42
|
-
"autoprefixer": "^10.4.
|
|
43
|
-
"babel-loader": "^9.1.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
44
|
+
"@typescript-eslint/parser": "^6.7.0",
|
|
45
|
+
"autoprefixer": "^10.4.15",
|
|
46
|
+
"babel-loader": "^9.1.3",
|
|
44
47
|
"babel-plugin-istanbul": "^6.1.1",
|
|
45
48
|
"babel-plugin-lodash": "^3.3.4",
|
|
46
|
-
"chalk": "^5.
|
|
49
|
+
"chalk": "^5.3.0",
|
|
47
50
|
"clean-webpack-plugin": "^4.0.0",
|
|
48
51
|
"columnify": "^1.6.0",
|
|
49
|
-
"commander": "^
|
|
52
|
+
"commander": "^11.0.0",
|
|
50
53
|
"copy-webpack-plugin": "^11.0.0",
|
|
51
|
-
"core-js": "^3.
|
|
52
|
-
"css-loader": "^6.
|
|
53
|
-
"css-minimizer-webpack-plugin": "^
|
|
54
|
-
"dotenv": "^16.
|
|
54
|
+
"core-js": "^3.32.2",
|
|
55
|
+
"css-loader": "^6.8.1",
|
|
56
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
57
|
+
"dotenv": "^16.3.1",
|
|
55
58
|
"dotenv-expand": "^10.0.0",
|
|
56
59
|
"escape-string-regexp": "^5.0.0",
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"eslint-config-prettier": "^
|
|
59
|
-
"eslint-
|
|
60
|
+
"eslint": "^8.49.0",
|
|
61
|
+
"eslint-config-prettier": "^9.0.0",
|
|
62
|
+
"eslint-import-resolver-typescript": "^3.6.0",
|
|
63
|
+
"eslint-plugin-deprecation": "^1.5.0",
|
|
64
|
+
"eslint-plugin-import": "^2.28.1",
|
|
65
|
+
"eslint-plugin-markdownlint": "^0.5.0",
|
|
60
66
|
"eslint-plugin-promise": "^6.1.1",
|
|
61
|
-
"eslint-
|
|
62
|
-
"
|
|
67
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
68
|
+
"eslint-plugin-yml": "^1.9.0",
|
|
69
|
+
"eslint-webpack-plugin": "^4.0.1",
|
|
70
|
+
"execa": "^8.0.1",
|
|
63
71
|
"file-loader": "^6.2.0",
|
|
64
|
-
"fork-ts-checker-webpack-plugin": "^
|
|
65
|
-
"glob": "^
|
|
72
|
+
"fork-ts-checker-webpack-plugin": "^8.0.0",
|
|
73
|
+
"glob": "^10.3.4",
|
|
66
74
|
"html-loader": "^4.2.0",
|
|
67
|
-
"html-webpack-plugin": "^5.5.
|
|
75
|
+
"html-webpack-plugin": "^5.5.3",
|
|
68
76
|
"json-loader": "^0.5.7",
|
|
69
77
|
"lodash": "^4.17.21",
|
|
70
|
-
"mini-css-extract-plugin": "^2.7.
|
|
78
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
71
79
|
"node-notifier": "^10.0.1",
|
|
72
80
|
"portfinder": "^1.0.32",
|
|
73
|
-
"postcss": "^8.4.
|
|
74
|
-
"postcss-custom-properties": "^13.
|
|
75
|
-
"postcss-loader": "^7.
|
|
76
|
-
"prettier": "^
|
|
81
|
+
"postcss": "^8.4.29",
|
|
82
|
+
"postcss-custom-properties": "^13.3.0",
|
|
83
|
+
"postcss-loader": "^7.3.3",
|
|
84
|
+
"prettier": "^3.0.3",
|
|
85
|
+
"prompts": "^2.4.2",
|
|
77
86
|
"react-refresh": "^0.14.0",
|
|
78
87
|
"resolve-url-loader": "^5.0.0",
|
|
79
|
-
"sass": "^1.
|
|
80
|
-
"sass-loader": "^13.2
|
|
88
|
+
"sass": "^1.66.1",
|
|
89
|
+
"sass-loader": "^13.3.2",
|
|
81
90
|
"source-map-loader": "^4.0.1",
|
|
82
91
|
"strip-indent": "^4.0.0",
|
|
83
|
-
"style-loader": "^3.3.
|
|
84
|
-
"tsconfig-paths-webpack-plugin": "^4.
|
|
85
|
-
"tsup": "^
|
|
86
|
-
"typescript": "^
|
|
92
|
+
"style-loader": "^3.3.3",
|
|
93
|
+
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
94
|
+
"tsup": "^7.2.0",
|
|
95
|
+
"typescript": "^5.2.2",
|
|
87
96
|
"url-loader": "^4.1.1",
|
|
88
|
-
"webpack": "^5.
|
|
89
|
-
"webpack-cli": "^5.
|
|
97
|
+
"webpack": "^5.88.2",
|
|
98
|
+
"webpack-cli": "^5.1.4",
|
|
90
99
|
"webpack-config-utils": "^2.3.1",
|
|
91
|
-
"webpack-dev-server": "^4.
|
|
100
|
+
"webpack-dev-server": "^4.15.1",
|
|
92
101
|
"yaml-loader": "^0.8.0"
|
|
93
|
-
}
|
|
102
|
+
},
|
|
103
|
+
"packageManager": "pnpm@8.7.5"
|
|
94
104
|
}
|
package/readme.html
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import {createCommand} from 'commander'
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from 'lib/constants'
|
|
4
|
+
import {build, type BuildOptions} from 'commands/build'
|
|
5
|
+
import {deploy, type DeployOptions} from 'commands/deploy'
|
|
6
|
+
import {deployEmailConfig} from 'commands/deploy-email-config'
|
|
7
|
+
import {dev, type DevOptions} from 'commands/dev'
|
|
8
|
+
import {listDeployed, type ListDeployedOptions} from 'commands/list-deployed'
|
|
9
|
+
import {serve, type ServeOptions} from 'commands/serve'
|
|
10
|
+
import {DEFAULT_PORT, DEFAULT_TAG} from 'lib/constants'
|
|
11
11
|
import {logError} from 'lib/logging'
|
|
12
|
-
import
|
|
13
|
-
import {build, BuildOptions} from 'commands/build'
|
|
14
|
-
import {deploy, DeployOptions} from 'commands/deploy'
|
|
15
|
-
import {serve, ServeOptions} from 'commands/serve'
|
|
16
|
-
import {listDeployed, ListDeployedOptions} from 'commands/list-deployed'
|
|
17
|
-
import {
|
|
18
|
-
deployEmailConfig,
|
|
19
|
-
DeployEmailConfigOptions,
|
|
20
|
-
} from 'commands/deploy-email-config'
|
|
12
|
+
import pkg from '../package.json'
|
|
21
13
|
|
|
22
14
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
15
|
|
|
@@ -89,11 +81,6 @@ cli
|
|
|
89
81
|
'Tag which should be used for the deployment of the bundle',
|
|
90
82
|
DEFAULT_TAG,
|
|
91
83
|
)
|
|
92
|
-
.option(
|
|
93
|
-
'--profile <profile>',
|
|
94
|
-
'AWS profile which should be used for the deployment of the bundle',
|
|
95
|
-
DEFAULT_AWS_PROFILE,
|
|
96
|
-
)
|
|
97
84
|
.action(async (options: BuildOptions & ServeOptions & DeployOptions) => {
|
|
98
85
|
await build(options)
|
|
99
86
|
|
|
@@ -129,11 +116,6 @@ cli
|
|
|
129
116
|
'Tag which should be used for the deployment of the bundle',
|
|
130
117
|
DEFAULT_TAG,
|
|
131
118
|
)
|
|
132
|
-
.option(
|
|
133
|
-
'--profile <profile>',
|
|
134
|
-
'AWS profile which should be used for the deployment of the bundle',
|
|
135
|
-
DEFAULT_AWS_PROFILE,
|
|
136
|
-
)
|
|
137
119
|
.action(async (options: DeployOptions) => {
|
|
138
120
|
await deploy(options)
|
|
139
121
|
})
|
|
@@ -147,30 +129,15 @@ cli
|
|
|
147
129
|
'--config <config>',
|
|
148
130
|
'Configuration name (default: current customer configuration)',
|
|
149
131
|
)
|
|
150
|
-
.option(
|
|
151
|
-
'--profile <profile>',
|
|
152
|
-
'AWS profile which should be used for fetching deployments',
|
|
153
|
-
DEFAULT_AWS_PROFILE,
|
|
154
|
-
)
|
|
155
132
|
.action(async (options: ListDeployedOptions) => {
|
|
156
133
|
await listDeployed(options)
|
|
157
134
|
})
|
|
158
135
|
|
|
159
136
|
cli
|
|
160
137
|
.command('deploy-email-config')
|
|
161
|
-
.description(
|
|
162
|
-
.
|
|
163
|
-
|
|
164
|
-
'AWS S3 bucket where it should be deployed',
|
|
165
|
-
DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET,
|
|
166
|
-
)
|
|
167
|
-
.option(
|
|
168
|
-
'--profile <profile>',
|
|
169
|
-
'AWS profile which should be used for the deployment of email configuration',
|
|
170
|
-
DEFAULT_AWS_PROFILE,
|
|
171
|
-
)
|
|
172
|
-
.action(async (options: DeployEmailConfigOptions) => {
|
|
173
|
-
await deployEmailConfig(options)
|
|
138
|
+
.description("Deploy a widget's email configuration to AWS S3")
|
|
139
|
+
.action(async () => {
|
|
140
|
+
await deployEmailConfig()
|
|
174
141
|
})
|
|
175
142
|
|
|
176
143
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -183,6 +150,7 @@ cli
|
|
|
183
150
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
184
151
|
logError(`\n${error.signalDescription}`)
|
|
185
152
|
} else {
|
|
153
|
+
// eslint-disable-next-line no-console
|
|
186
154
|
console.log('')
|
|
187
155
|
logError(error.stack)
|
|
188
156
|
}
|
package/src/commands/build.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import {type DeployOptions} from 'commands/deploy'
|
|
2
|
+
import {assertProfilesPresent, promptProfile} from 'lib/aws'
|
|
3
|
+
import {halt, runCommandSync} from 'lib/command'
|
|
1
4
|
import {CORE_CONFIG_NAME} from 'lib/constants'
|
|
2
|
-
import {
|
|
5
|
+
import {applyEnv, assertEnvValid} from 'lib/env'
|
|
6
|
+
import {assertCrtExists} from 'lib/https'
|
|
7
|
+
import {logCommand, logTitle} from 'lib/logging'
|
|
8
|
+
import {notify} from 'lib/notifier'
|
|
3
9
|
import {
|
|
4
10
|
getIfCoreFns,
|
|
5
11
|
getPaths,
|
|
@@ -7,12 +13,6 @@ import {
|
|
|
7
13
|
resolveBin,
|
|
8
14
|
resolveOwn,
|
|
9
15
|
} from 'lib/resolve'
|
|
10
|
-
import {assertEnvValid} from 'lib/env'
|
|
11
|
-
import {assertCrtExists} from 'lib/https'
|
|
12
|
-
import {logCommand, logTitle} from 'lib/logging'
|
|
13
|
-
import {notify} from 'lib/notifier'
|
|
14
|
-
import {halt, runCommandSync} from 'lib/command'
|
|
15
|
-
import {DeployOptions} from 'commands/deploy'
|
|
16
16
|
|
|
17
17
|
///////////////////////////////////////////////////////////////////////////////
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ export type BuildOptions = {
|
|
|
22
22
|
https: boolean
|
|
23
23
|
serve: boolean
|
|
24
24
|
deploy: boolean
|
|
25
|
-
env
|
|
25
|
+
env?: string
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -30,7 +30,15 @@ export type BuildOptions = {
|
|
|
30
30
|
export const build = async (
|
|
31
31
|
options: BuildOptions & DeployOptions,
|
|
32
32
|
): Promise<void> => {
|
|
33
|
+
const {env} = options
|
|
34
|
+
|
|
33
35
|
assertOptionsValid(options)
|
|
36
|
+
assertProfilesPresent()
|
|
37
|
+
applyEnv(env)
|
|
38
|
+
|
|
39
|
+
if (options.deploy) {
|
|
40
|
+
options.profile = await promptProfile()
|
|
41
|
+
}
|
|
34
42
|
|
|
35
43
|
const flags = prepareFlags([], options).join(' ')
|
|
36
44
|
const {ifCore} = getIfCoreFns()
|
|
@@ -38,7 +46,7 @@ export const build = async (
|
|
|
38
46
|
const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid())
|
|
39
47
|
const title = ifCore(
|
|
40
48
|
'Building optimised (minified) bundle of Tamaro Core …',
|
|
41
|
-
`Building optimised (minified) bundle of
|
|
49
|
+
`Building optimised (minified) bundle of "${configName}" customer configuration …`,
|
|
42
50
|
)
|
|
43
51
|
|
|
44
52
|
const wpBin = resolveBin('webpack')
|
|
@@ -56,7 +64,8 @@ export const build = async (
|
|
|
56
64
|
|
|
57
65
|
/////////////////////////////////////////////////////////////////////////////
|
|
58
66
|
|
|
59
|
-
logTitle(`\nBundle for
|
|
67
|
+
logTitle(`\nBundle for "${configName}" customer configuration is done.`)
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
60
69
|
console.log(`Path: ${paths.appDist}\n`)
|
|
61
70
|
|
|
62
71
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -64,7 +73,7 @@ export const build = async (
|
|
|
64
73
|
process.on('exit', () => {
|
|
65
74
|
notify({
|
|
66
75
|
title: 'build',
|
|
67
|
-
message: `Bundle for
|
|
76
|
+
message: `Bundle for "${configName}" customer configuration is done.`,
|
|
68
77
|
})
|
|
69
78
|
})
|
|
70
79
|
}
|
|
@@ -72,22 +81,21 @@ export const build = async (
|
|
|
72
81
|
///////////////////////////////////////////////////////////////////////////////
|
|
73
82
|
|
|
74
83
|
const assertOptionsValid = (options: BuildOptions & DeployOptions) => {
|
|
75
|
-
const {localCore, https, deploy,
|
|
84
|
+
const {localCore, https, deploy, env} = options
|
|
76
85
|
const {ifCore} = getIfCoreFns()
|
|
77
86
|
|
|
78
87
|
if (ifCore() && localCore) {
|
|
79
|
-
halt('Flag
|
|
88
|
+
halt('Flag "--local-core" is redundant if running in Tamaro Core context.')
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
if (localCore && deploy) {
|
|
83
|
-
halt('Flags
|
|
92
|
+
halt('Flags "--local-core" and "--deploy" must not be used together.')
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
if (https) {
|
|
87
96
|
assertCrtExists()
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
assertProfileValid(profile)
|
|
91
99
|
assertEnvValid(env)
|
|
92
100
|
}
|
|
93
101
|
|