@raisenow/tamaro-cli 1.0.26 → 1.1.1
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-ZAKDPU5F.js → chunk-S4M23KNZ.js} +35 -33
- package/dist/cli.js +333 -338
- package/dist/webpack.config.js +19 -19
- package/package.json +62 -57
- package/readme.html +1 -1
- package/src/cli.ts +15 -40
- package/src/commands/build.ts +19 -14
- package/src/commands/deploy-email-config.ts +22 -44
- package/src/commands/deploy.ts +18 -19
- package/src/commands/dev.ts +4 -4
- package/src/commands/list-deployed.ts +17 -20
- package/src/commands/serve.ts +3 -3
- package/src/lib/InterpolateHtmlPlugin.ts +7 -7
- package/src/lib/aws.ts +72 -40
- package/src/lib/command.ts +5 -1
- package/src/lib/constants.ts +2 -1
- package/src/lib/env.ts +12 -13
- 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 +18 -17
- package/tsconfig.json +5 -1
- package/.gitignore +0 -14
- package/tsconfig.eslint.json +0 -7
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AWS_CLOUDFRONT_DISTRIBUTION_ID,
|
|
4
4
|
AWS_S3_BUCKET,
|
|
5
|
+
AWS_S3_EMAIL_CONFIG_PROD_BUCKET,
|
|
6
|
+
AWS_S3_EMAIL_CONFIG_STAGE_BUCKET,
|
|
5
7
|
CORE_CONFIG_NAME,
|
|
6
|
-
DEFAULT_AWS_PROFILE,
|
|
7
|
-
DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET,
|
|
8
8
|
DEFAULT_PORT,
|
|
9
9
|
DEFAULT_TAG,
|
|
10
10
|
HTTPS_CRT_FILE,
|
|
@@ -22,194 +22,21 @@ import {
|
|
|
22
22
|
resolveBin,
|
|
23
23
|
resolveOwn,
|
|
24
24
|
runCommandSync
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-S4M23KNZ.js";
|
|
26
26
|
|
|
27
27
|
// src/cli.ts
|
|
28
28
|
import { createCommand } from "commander";
|
|
29
29
|
|
|
30
|
-
// package.json
|
|
31
|
-
var package_default = {
|
|
32
|
-
name: "@raisenow/tamaro-cli",
|
|
33
|
-
version: "1.0.26",
|
|
34
|
-
author: {
|
|
35
|
-
name: "RaiseNow",
|
|
36
|
-
email: "development@raisenow.com"
|
|
37
|
-
},
|
|
38
|
-
type: "module",
|
|
39
|
-
scripts: {
|
|
40
|
-
prepare: "npm run build",
|
|
41
|
-
start: "npm run dev",
|
|
42
|
-
build: "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
43
|
-
"build:watch": "npm run build -- --watch --ignore-watch .idea",
|
|
44
|
-
docs: "npx -y http-server . --cors -o /readme.html",
|
|
45
|
-
lint: "eslint --fix . && prettier --write ."
|
|
46
|
-
},
|
|
47
|
-
bin: "dist/cli.js",
|
|
48
|
-
engines: {
|
|
49
|
-
node: ">=16",
|
|
50
|
-
npm: ">=8"
|
|
51
|
-
},
|
|
52
|
-
dependencies: {
|
|
53
|
-
"@babel/cli": "^7.21.0",
|
|
54
|
-
"@babel/core": "^7.21.4",
|
|
55
|
-
"@babel/plugin-proposal-decorators": "^7.21.0",
|
|
56
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
57
|
-
"@babel/plugin-transform-runtime": "^7.21.4",
|
|
58
|
-
"@babel/preset-env": "^7.21.4",
|
|
59
|
-
"@babel/preset-react": "^7.18.6",
|
|
60
|
-
"@babel/preset-typescript": "^7.21.4",
|
|
61
|
-
"@babel/runtime-corejs3": "^7.21.0",
|
|
62
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
63
|
-
"@statoscope/webpack-plugin": "^5.26.2",
|
|
64
|
-
"@types/columnify": "^1.5.1",
|
|
65
|
-
"@types/lodash": "^4.14.192",
|
|
66
|
-
"@types/node": "^18.15.11",
|
|
67
|
-
"@types/node-notifier": "^8.0.2",
|
|
68
|
-
"@types/resolve-bin": "^0.4.1",
|
|
69
|
-
"@types/webpack-config-utils": "^2.3.1",
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
71
|
-
"@typescript-eslint/parser": "^5.57.1",
|
|
72
|
-
autoprefixer: "^10.4.14",
|
|
73
|
-
"babel-loader": "^9.1.2",
|
|
74
|
-
"babel-plugin-istanbul": "^6.1.1",
|
|
75
|
-
"babel-plugin-lodash": "^3.3.4",
|
|
76
|
-
chalk: "^5.2.0",
|
|
77
|
-
"clean-webpack-plugin": "^4.0.0",
|
|
78
|
-
columnify: "^1.6.0",
|
|
79
|
-
commander: "^10.0.0",
|
|
80
|
-
"copy-webpack-plugin": "^11.0.0",
|
|
81
|
-
"core-js": "^3.30.0",
|
|
82
|
-
"css-loader": "^6.7.3",
|
|
83
|
-
"css-minimizer-webpack-plugin": "^5.0.0",
|
|
84
|
-
dotenv: "^16.0.3",
|
|
85
|
-
"dotenv-expand": "^10.0.0",
|
|
86
|
-
"escape-string-regexp": "^5.0.0",
|
|
87
|
-
eslint: "^8.37.0",
|
|
88
|
-
"eslint-config-prettier": "^8.8.0",
|
|
89
|
-
"eslint-plugin-node": "^11.1.0",
|
|
90
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
91
|
-
"eslint-webpack-plugin": "^4.0.0",
|
|
92
|
-
execa: "^7.1.1",
|
|
93
|
-
"file-loader": "^6.2.0",
|
|
94
|
-
"fork-ts-checker-webpack-plugin": "^8.0.0",
|
|
95
|
-
glob: "^9.3.4",
|
|
96
|
-
"html-loader": "^4.2.0",
|
|
97
|
-
"html-webpack-plugin": "^5.5.0",
|
|
98
|
-
"json-loader": "^0.5.7",
|
|
99
|
-
lodash: "^4.17.21",
|
|
100
|
-
"mini-css-extract-plugin": "^2.7.5",
|
|
101
|
-
"node-notifier": "^10.0.1",
|
|
102
|
-
portfinder: "^1.0.32",
|
|
103
|
-
postcss: "^8.4.21",
|
|
104
|
-
"postcss-custom-properties": "^13.1.4",
|
|
105
|
-
"postcss-loader": "^7.2.4",
|
|
106
|
-
prettier: "^2.8.7",
|
|
107
|
-
"react-refresh": "^0.14.0",
|
|
108
|
-
"resolve-url-loader": "^5.0.0",
|
|
109
|
-
sass: "^1.60.0",
|
|
110
|
-
"sass-loader": "^13.2.2",
|
|
111
|
-
"source-map-loader": "^4.0.1",
|
|
112
|
-
"strip-indent": "^4.0.0",
|
|
113
|
-
"style-loader": "^3.3.2",
|
|
114
|
-
"tsconfig-paths-webpack-plugin": "^4.0.1",
|
|
115
|
-
tsup: "^6.7.0",
|
|
116
|
-
typescript: "^5.0.3",
|
|
117
|
-
"url-loader": "^4.1.1",
|
|
118
|
-
webpack: "^5.78.0",
|
|
119
|
-
"webpack-cli": "^5.0.1",
|
|
120
|
-
"webpack-config-utils": "^2.3.1",
|
|
121
|
-
"webpack-dev-server": "^4.13.2",
|
|
122
|
-
"yaml-loader": "^0.8.0"
|
|
123
|
-
},
|
|
124
|
-
overrides: {
|
|
125
|
-
"babel-plugin-lodash": {
|
|
126
|
-
"@babel/types": "~7.20.0"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// src/commands/dev.ts
|
|
132
|
-
import { getPortPromise } from "portfinder";
|
|
133
|
-
|
|
134
|
-
// src/lib/https.ts
|
|
135
|
-
import { existsSync } from "fs";
|
|
136
|
-
import { resolve } from "path";
|
|
137
|
-
import stripIndent from "strip-indent";
|
|
138
|
-
var assertCrtExists = () => {
|
|
139
|
-
const { ifCore } = getIfCoreFns();
|
|
140
|
-
const paths = getPaths(ifCore);
|
|
141
|
-
const certFile = resolve(paths.root, HTTPS_CRT_FILE);
|
|
142
|
-
const keyFile = resolve(paths.root, HTTPS_KEY_FILE);
|
|
143
|
-
if (existsSync(certFile) && existsSync(keyFile)) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
halt(
|
|
147
|
-
stripIndent(`
|
|
148
|
-
Flag \u201C--https\u201D is used, but \u201C${HTTPS_CRT_FILE}\u201D and/or \u201C${HTTPS_KEY_FILE}\u201D files are not found.
|
|
149
|
-
You need to generate certificate first.
|
|
150
|
-
Check docs: https://unpkg.com/@raisenow/tamaro-cli/readme.html#/?id=use-transport-level-security-https
|
|
151
|
-
`)
|
|
152
|
-
);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// src/commands/dev.ts
|
|
156
|
-
var dev = async (options) => {
|
|
157
|
-
const { env } = options;
|
|
158
|
-
assertOptionsValid(options);
|
|
159
|
-
applyEnv(env);
|
|
160
|
-
const flags = (await prepareFlags([], options)).join(" ");
|
|
161
|
-
const { ifCore } = getIfCoreFns();
|
|
162
|
-
const title = ifCore(
|
|
163
|
-
"Running dev web-server for Tamaro Core \u2026",
|
|
164
|
-
"Running dev web-server for customer configuration \u2026"
|
|
165
|
-
);
|
|
166
|
-
const wpBin = resolveBin("webpack");
|
|
167
|
-
const wpConfig = resolveOwn("dist/webpack.config.js");
|
|
168
|
-
const cmd = `
|
|
169
|
-
${wpBin} serve
|
|
170
|
-
--config ${wpConfig}
|
|
171
|
-
${flags}
|
|
172
|
-
`;
|
|
173
|
-
logTitle(title);
|
|
174
|
-
logCommand(cmd);
|
|
175
|
-
runCommandSync(cmd, { stdio: "inherit" });
|
|
176
|
-
};
|
|
177
|
-
var assertOptionsValid = (options) => {
|
|
178
|
-
const { localCore, https, port, env } = options;
|
|
179
|
-
const { ifCore } = getIfCoreFns();
|
|
180
|
-
if (ifCore() && localCore) {
|
|
181
|
-
halt("Flag \u201C--local-core\u201D is redundant if running in Tamaro Core context.");
|
|
182
|
-
}
|
|
183
|
-
if (isNaN(Number(port))) {
|
|
184
|
-
halt("Flag \u201C--port\u201D should be a number.");
|
|
185
|
-
}
|
|
186
|
-
if (https) {
|
|
187
|
-
assertCrtExists();
|
|
188
|
-
}
|
|
189
|
-
assertEnvValid(env);
|
|
190
|
-
};
|
|
191
|
-
var prepareFlags = async (flags, options) => {
|
|
192
|
-
const { localCore, port: defaultPort, https } = options;
|
|
193
|
-
const port = await getPortPromise({ port: Number(defaultPort) });
|
|
194
|
-
if (localCore) {
|
|
195
|
-
flags.push("--env localCore");
|
|
196
|
-
}
|
|
197
|
-
flags.push(`--port ${port}`);
|
|
198
|
-
if (https) {
|
|
199
|
-
flags.push("--env https");
|
|
200
|
-
}
|
|
201
|
-
return flags;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
30
|
// src/lib/aws.ts
|
|
205
31
|
import { execaCommandSync } from "execa";
|
|
206
|
-
import
|
|
32
|
+
import prompts from "prompts";
|
|
33
|
+
import stripIndent from "strip-indent";
|
|
207
34
|
var withAwsAuthenticate = (fn, options) => {
|
|
208
35
|
awsAuthenticate(options);
|
|
209
36
|
return fn();
|
|
210
37
|
};
|
|
211
38
|
var awsAuthenticate = (options) => {
|
|
212
|
-
if (
|
|
39
|
+
if (options.ci) {
|
|
213
40
|
return;
|
|
214
41
|
}
|
|
215
42
|
try {
|
|
@@ -218,33 +45,17 @@ var awsAuthenticate = (options) => {
|
|
|
218
45
|
login(options);
|
|
219
46
|
}
|
|
220
47
|
};
|
|
221
|
-
var
|
|
222
|
-
return !!(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY);
|
|
223
|
-
};
|
|
224
|
-
var assertProfileValid = (profile) => {
|
|
225
|
-
if (isSetEnv()) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
48
|
+
var assertProfilesPresent = () => {
|
|
228
49
|
const profiles = getAvailableProfiles();
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (profiles.length === 0) {
|
|
233
|
-
message = stripIndent2(`
|
|
50
|
+
if (profiles.length === 0) {
|
|
51
|
+
halt(
|
|
52
|
+
stripIndent(`
|
|
234
53
|
No AWS profiles found.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
`);
|
|
241
|
-
}
|
|
242
|
-
message += stripIndent2(`
|
|
243
|
-
Run \u201Caws configure sso\u201D to set up SSO-enabled profile.
|
|
244
|
-
Check the wiki for more information:
|
|
245
|
-
https://raisenow.atlassian.net/wiki/x/lIrWvg
|
|
246
|
-
`);
|
|
247
|
-
halt(message);
|
|
54
|
+
Run "aws configure sso" to set up SSO-enabled profile.
|
|
55
|
+
Check the wiki for more information:
|
|
56
|
+
https://raisenow.atlassian.net/wiki/x/lIrWvg
|
|
57
|
+
`)
|
|
58
|
+
);
|
|
248
59
|
}
|
|
249
60
|
};
|
|
250
61
|
var getAvailableProfiles = () => {
|
|
@@ -252,11 +63,11 @@ var getAvailableProfiles = () => {
|
|
|
252
63
|
return stdout.split("\n");
|
|
253
64
|
};
|
|
254
65
|
var checkIdentity = (options) => {
|
|
255
|
-
const flags =
|
|
66
|
+
const flags = prepareFlags([], options).join(" ");
|
|
256
67
|
execaCommandSync(`aws sts get-caller-identity ${flags}`);
|
|
257
68
|
};
|
|
258
69
|
var login = (options) => {
|
|
259
|
-
const flags =
|
|
70
|
+
const flags = prepareFlags([], options).join(" ");
|
|
260
71
|
try {
|
|
261
72
|
execaCommandSync(`aws sso login ${flags}`, { stdio: "inherit" });
|
|
262
73
|
console.log("");
|
|
@@ -264,13 +75,71 @@ var login = (options) => {
|
|
|
264
75
|
halt("Login failed.");
|
|
265
76
|
}
|
|
266
77
|
};
|
|
267
|
-
var
|
|
78
|
+
var prepareFlags = (flags, options) => {
|
|
268
79
|
const { profile } = options;
|
|
269
|
-
if (
|
|
80
|
+
if (profile) {
|
|
270
81
|
flags.push(`--profile ${profile}`);
|
|
271
82
|
}
|
|
272
83
|
return flags;
|
|
273
84
|
};
|
|
85
|
+
var promptProfile = async () => {
|
|
86
|
+
const profiles = getAvailableProfiles().filter((v) => !!v).map((v) => ({ title: v, value: v }));
|
|
87
|
+
const { profile } = await prompts(
|
|
88
|
+
[
|
|
89
|
+
{
|
|
90
|
+
type: "select",
|
|
91
|
+
name: "profile",
|
|
92
|
+
message: "Select AWS profile",
|
|
93
|
+
choices: profiles
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
{
|
|
97
|
+
onCancel: () => process.exit(1)
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
return profile;
|
|
101
|
+
};
|
|
102
|
+
var promptBucket = async () => {
|
|
103
|
+
const buckets = [
|
|
104
|
+
{ title: "stage", value: AWS_S3_EMAIL_CONFIG_STAGE_BUCKET },
|
|
105
|
+
{ title: "prod", value: AWS_S3_EMAIL_CONFIG_PROD_BUCKET }
|
|
106
|
+
];
|
|
107
|
+
const { bucket } = await prompts(
|
|
108
|
+
[
|
|
109
|
+
{
|
|
110
|
+
type: "select",
|
|
111
|
+
name: "bucket",
|
|
112
|
+
message: "Select environment",
|
|
113
|
+
choices: buckets
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
{
|
|
117
|
+
onCancel: () => process.exit(1)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
return bucket;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/lib/https.ts
|
|
124
|
+
import { existsSync } from "fs";
|
|
125
|
+
import { resolve } from "path";
|
|
126
|
+
import stripIndent2 from "strip-indent";
|
|
127
|
+
var assertCrtExists = () => {
|
|
128
|
+
const { ifCore } = getIfCoreFns();
|
|
129
|
+
const paths = getPaths(ifCore);
|
|
130
|
+
const certFile = resolve(paths.root, HTTPS_CRT_FILE);
|
|
131
|
+
const keyFile = resolve(paths.root, HTTPS_KEY_FILE);
|
|
132
|
+
if (existsSync(certFile) && existsSync(keyFile)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
halt(
|
|
136
|
+
stripIndent2(`
|
|
137
|
+
Flag "--https" is used, but "${HTTPS_CRT_FILE}" and/or "${HTTPS_KEY_FILE}" files are not found.
|
|
138
|
+
You need to generate certificate first.
|
|
139
|
+
Check docs: https://unpkg.com/@raisenow/tamaro-cli/readme.html#/?id=use-transport-level-security-https
|
|
140
|
+
`)
|
|
141
|
+
);
|
|
142
|
+
};
|
|
274
143
|
|
|
275
144
|
// src/lib/notifier.ts
|
|
276
145
|
import notifier from "node-notifier";
|
|
@@ -288,15 +157,19 @@ var notify = (args) => {
|
|
|
288
157
|
// src/commands/build.ts
|
|
289
158
|
var build = async (options) => {
|
|
290
159
|
const { env } = options;
|
|
291
|
-
|
|
160
|
+
assertOptionsValid(options);
|
|
292
161
|
applyEnv(env);
|
|
293
|
-
|
|
162
|
+
if (options.deploy && !options.ci) {
|
|
163
|
+
assertProfilesPresent();
|
|
164
|
+
options.profile = await promptProfile();
|
|
165
|
+
}
|
|
166
|
+
const flags = prepareFlags2([], options).join(" ");
|
|
294
167
|
const { ifCore } = getIfCoreFns();
|
|
295
168
|
const paths = getPaths(ifCore);
|
|
296
169
|
const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
297
170
|
const title = ifCore(
|
|
298
171
|
"Building optimised (minified) bundle of Tamaro Core \u2026",
|
|
299
|
-
`Building optimised (minified) bundle of
|
|
172
|
+
`Building optimised (minified) bundle of "${configName}" customer configuration \u2026`
|
|
300
173
|
);
|
|
301
174
|
const wpBin = resolveBin("webpack");
|
|
302
175
|
const wpConfig = resolveOwn("dist/webpack.config.js");
|
|
@@ -310,32 +183,31 @@ var build = async (options) => {
|
|
|
310
183
|
logCommand(cmd);
|
|
311
184
|
runCommandSync(cmd, { stdio: "inherit" });
|
|
312
185
|
logTitle(`
|
|
313
|
-
Bundle for
|
|
186
|
+
Bundle for "${configName}" customer configuration is done.`);
|
|
314
187
|
console.log(`Path: ${paths.appDist}
|
|
315
188
|
`);
|
|
316
189
|
process.on("exit", () => {
|
|
317
190
|
notify({
|
|
318
191
|
title: "build",
|
|
319
|
-
message: `Bundle for
|
|
192
|
+
message: `Bundle for "${configName}" customer configuration is done.`
|
|
320
193
|
});
|
|
321
194
|
});
|
|
322
195
|
};
|
|
323
|
-
var
|
|
324
|
-
const { localCore, https, deploy: deploy2,
|
|
196
|
+
var assertOptionsValid = (options) => {
|
|
197
|
+
const { localCore, https, deploy: deploy2, env } = options;
|
|
325
198
|
const { ifCore } = getIfCoreFns();
|
|
326
199
|
if (ifCore() && localCore) {
|
|
327
|
-
halt(
|
|
200
|
+
halt('Flag "--local-core" is redundant if running in Tamaro Core context.');
|
|
328
201
|
}
|
|
329
202
|
if (localCore && deploy2) {
|
|
330
|
-
halt(
|
|
203
|
+
halt('Flags "--local-core" and "--deploy" must not be used together.');
|
|
331
204
|
}
|
|
332
205
|
if (https) {
|
|
333
206
|
assertCrtExists();
|
|
334
207
|
}
|
|
335
|
-
assertProfileValid(profile);
|
|
336
208
|
assertEnvValid(env);
|
|
337
209
|
};
|
|
338
|
-
var
|
|
210
|
+
var prepareFlags2 = (flags, options) => {
|
|
339
211
|
const { localCore, analyze, https } = options;
|
|
340
212
|
if (localCore) {
|
|
341
213
|
flags.push("--env localCore");
|
|
@@ -355,9 +227,13 @@ import stripIndent4 from "strip-indent";
|
|
|
355
227
|
var deploy = async (options) => {
|
|
356
228
|
const { ifCore } = getIfCoreFns();
|
|
357
229
|
const paths = getPaths(ifCore);
|
|
358
|
-
|
|
230
|
+
assertOptionsValid2(options);
|
|
359
231
|
assertDistPathExists(paths.appDist);
|
|
360
|
-
|
|
232
|
+
if (!options.ci) {
|
|
233
|
+
assertProfilesPresent();
|
|
234
|
+
options.profile = await promptProfile();
|
|
235
|
+
}
|
|
236
|
+
const flags = prepareFlags([], options).join(" ");
|
|
361
237
|
const { tag } = options;
|
|
362
238
|
const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
363
239
|
const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/${tag}`;
|
|
@@ -410,7 +286,7 @@ var deploy = async (options) => {
|
|
|
410
286
|
const demoPage = `https://${AWS_S3_BUCKET}/${configName}/${tag}/index.html`;
|
|
411
287
|
const entryPoint = `https://${AWS_S3_BUCKET}/${configName}/${tag}/${entryFilename}`;
|
|
412
288
|
logTitle(`
|
|
413
|
-
Bundle for
|
|
289
|
+
Bundle for "${configName}" is deployed with tag "${tag}".`);
|
|
414
290
|
logDataTable({
|
|
415
291
|
"Demo page:": demoPage,
|
|
416
292
|
"Entry point:": entryPoint
|
|
@@ -419,17 +295,16 @@ Bundle for \u201C${configName}\u201D is deployed with tag \u201C${tag}\u201D.`);
|
|
|
419
295
|
notify({
|
|
420
296
|
title: "deploy",
|
|
421
297
|
message: `
|
|
422
|
-
Bundle for
|
|
298
|
+
Bundle for "${configName}" is deployed with tag "${tag}".
|
|
423
299
|
Demo page: ${demoPage}
|
|
424
300
|
Entry point: ${entryPoint}
|
|
425
301
|
`
|
|
426
302
|
});
|
|
427
303
|
});
|
|
428
304
|
};
|
|
429
|
-
var
|
|
430
|
-
const { tag
|
|
305
|
+
var assertOptionsValid2 = (options) => {
|
|
306
|
+
const { tag } = options;
|
|
431
307
|
assertTagValid(tag);
|
|
432
|
-
assertProfileValid(profile);
|
|
433
308
|
};
|
|
434
309
|
var assertDistPathExists = (distPath) => {
|
|
435
310
|
if (!existsSync2(distPath)) {
|
|
@@ -445,63 +320,127 @@ var assertTagValid = (tag) => {
|
|
|
445
320
|
const regex = /^[a-zA-Z0-9-_.]+$/;
|
|
446
321
|
if (!regex.test(tag)) {
|
|
447
322
|
halt(
|
|
448
|
-
`Flag
|
|
323
|
+
`Flag "--tag" has forbidden format. Allowed format: ${regex.toString()}.`
|
|
449
324
|
);
|
|
450
325
|
}
|
|
451
326
|
};
|
|
452
|
-
var prepareFlags4 = (flags, options) => {
|
|
453
|
-
return prepareFlags2(flags, options);
|
|
454
|
-
};
|
|
455
327
|
|
|
456
|
-
// src/commands/
|
|
457
|
-
import {
|
|
458
|
-
|
|
459
|
-
var serve = async (options) => {
|
|
460
|
-
assertOptionsValid4(options);
|
|
461
|
-
const flags = (await prepareFlags5([], options)).join(" ");
|
|
328
|
+
// src/commands/deploy-email-config.ts
|
|
329
|
+
import { existsSync as existsSync3 } from "fs";
|
|
330
|
+
var deployEmailConfig = async (options) => {
|
|
462
331
|
const { ifCore } = getIfCoreFns();
|
|
463
332
|
const paths = getPaths(ifCore);
|
|
333
|
+
const emailConfigPath = `${paths.app}/email-config`;
|
|
334
|
+
assertIsNotCore();
|
|
335
|
+
assertEmailConfigPathExists(emailConfigPath);
|
|
336
|
+
if (!options.ci) {
|
|
337
|
+
assertProfilesPresent();
|
|
338
|
+
options.profile = await promptProfile();
|
|
339
|
+
}
|
|
340
|
+
const bucket = options.ci ? AWS_S3_EMAIL_CONFIG_PROD_BUCKET : await promptBucket();
|
|
341
|
+
const flags = prepareFlags([], options).join(" ");
|
|
342
|
+
const configName = getWidgetUuid();
|
|
343
|
+
const deployUrl = `s3://${bucket}/${configName}`;
|
|
464
344
|
const cmd = `
|
|
465
|
-
|
|
466
|
-
--
|
|
345
|
+
aws s3 sync ${emailConfigPath} ${deployUrl}
|
|
346
|
+
--delete
|
|
347
|
+
--exact-timestamps
|
|
467
348
|
${flags}
|
|
468
349
|
`;
|
|
469
|
-
logTitle(
|
|
350
|
+
logTitle(
|
|
351
|
+
`Deploying email configuration for "${configName}" customer configuration to AWS S3 \u2026`
|
|
352
|
+
);
|
|
353
|
+
logCommand(cmd);
|
|
354
|
+
try {
|
|
355
|
+
withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }), options);
|
|
356
|
+
} catch (error) {
|
|
357
|
+
halt(error.stderr);
|
|
358
|
+
}
|
|
359
|
+
logTitle(
|
|
360
|
+
`Email configuration for "${configName}" customer configuration is deployed.`
|
|
361
|
+
);
|
|
362
|
+
logDataTable({ "Deploy URL:": deployUrl });
|
|
363
|
+
process.on("exit", () => {
|
|
364
|
+
notify({
|
|
365
|
+
title: "deploy-email-config",
|
|
366
|
+
message: `Email configuration for "${configName}" customer configuration is deployed.`
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
var assertEmailConfigPathExists = (distPath) => {
|
|
371
|
+
if (!existsSync3(distPath)) {
|
|
372
|
+
halt("Email config folder does not exists. Nothing to deploy.", 0);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
var assertIsNotCore = () => {
|
|
376
|
+
const { ifCore } = getIfCoreFns();
|
|
377
|
+
if (ifCore()) {
|
|
378
|
+
halt("You cannot deploy widget email configuration for Tamaro Core.");
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// src/commands/dev.ts
|
|
383
|
+
import { getPortPromise } from "portfinder";
|
|
384
|
+
var dev = async (options) => {
|
|
385
|
+
const { env } = options;
|
|
386
|
+
assertOptionsValid3(options);
|
|
387
|
+
applyEnv(env);
|
|
388
|
+
const flags = (await prepareFlags3([], options)).join(" ");
|
|
389
|
+
const { ifCore } = getIfCoreFns();
|
|
390
|
+
const title = ifCore(
|
|
391
|
+
"Running dev web-server for Tamaro Core \u2026",
|
|
392
|
+
"Running dev web-server for customer configuration \u2026"
|
|
393
|
+
);
|
|
394
|
+
const wpBin = resolveBin("webpack");
|
|
395
|
+
const wpConfig = resolveOwn("dist/webpack.config.js");
|
|
396
|
+
const cmd = `
|
|
397
|
+
${wpBin} serve
|
|
398
|
+
--config ${wpConfig}
|
|
399
|
+
${flags}
|
|
400
|
+
`;
|
|
401
|
+
logTitle(title);
|
|
470
402
|
logCommand(cmd);
|
|
471
403
|
runCommandSync(cmd, { stdio: "inherit" });
|
|
472
404
|
};
|
|
473
|
-
var
|
|
474
|
-
const {
|
|
405
|
+
var assertOptionsValid3 = (options) => {
|
|
406
|
+
const { localCore, https, port, env } = options;
|
|
407
|
+
const { ifCore } = getIfCoreFns();
|
|
408
|
+
if (ifCore() && localCore) {
|
|
409
|
+
halt('Flag "--local-core" is redundant if running in Tamaro Core context.');
|
|
410
|
+
}
|
|
475
411
|
if (isNaN(Number(port))) {
|
|
476
412
|
halt('Flag "--port" should be a number.');
|
|
477
413
|
}
|
|
478
414
|
if (https) {
|
|
479
415
|
assertCrtExists();
|
|
480
416
|
}
|
|
417
|
+
assertEnvValid(env);
|
|
481
418
|
};
|
|
482
|
-
var
|
|
483
|
-
const { port: defaultPort, https } = options;
|
|
484
|
-
const port = await
|
|
485
|
-
|
|
419
|
+
var prepareFlags3 = async (flags, options) => {
|
|
420
|
+
const { localCore, port: defaultPort, https } = options;
|
|
421
|
+
const port = await getPortPromise({ port: Number(defaultPort) });
|
|
422
|
+
if (localCore) {
|
|
423
|
+
flags.push("--env localCore");
|
|
424
|
+
}
|
|
425
|
+
flags.push(`--port ${port}`);
|
|
486
426
|
if (https) {
|
|
487
|
-
|
|
488
|
-
const paths = getPaths(ifCore);
|
|
489
|
-
const certFile = resolve2(paths.root, HTTPS_CRT_FILE);
|
|
490
|
-
const keyFile = resolve2(paths.root, HTTPS_KEY_FILE);
|
|
491
|
-
flags.push(`--ssl-cert ${certFile}`);
|
|
492
|
-
flags.push(`--ssl-key ${keyFile}`);
|
|
427
|
+
flags.push("--env https");
|
|
493
428
|
}
|
|
494
429
|
return flags;
|
|
495
430
|
};
|
|
496
431
|
|
|
497
432
|
// src/commands/list-deployed.ts
|
|
498
433
|
var listDeployed = async (options) => {
|
|
499
|
-
|
|
500
|
-
|
|
434
|
+
assertOptionsValid4(options);
|
|
435
|
+
if (!options.ci) {
|
|
436
|
+
assertProfilesPresent();
|
|
437
|
+
options.profile = await promptProfile();
|
|
438
|
+
}
|
|
439
|
+
const flags = prepareFlags([], options).join(" ");
|
|
501
440
|
const { config } = options;
|
|
502
441
|
const { ifCore } = getIfCoreFns();
|
|
503
442
|
const configName = config ?? ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
504
|
-
const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of
|
|
443
|
+
const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of "${configName}" customer configuration \u2026`;
|
|
505
444
|
const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/`;
|
|
506
445
|
const cmd = `aws s3 ls ${deployUrl} ${flags}`;
|
|
507
446
|
let out = "";
|
|
@@ -529,10 +468,9 @@ var listDeployed = async (options) => {
|
|
|
529
468
|
console.log(`${text}
|
|
530
469
|
`);
|
|
531
470
|
};
|
|
532
|
-
var
|
|
533
|
-
const { config
|
|
471
|
+
var assertOptionsValid4 = (options) => {
|
|
472
|
+
const { config } = options;
|
|
534
473
|
assertConfigValid(config);
|
|
535
|
-
assertProfileValid(profile);
|
|
536
474
|
};
|
|
537
475
|
var assertConfigValid = (config) => {
|
|
538
476
|
if (!config) {
|
|
@@ -541,83 +479,160 @@ var assertConfigValid = (config) => {
|
|
|
541
479
|
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
542
480
|
if (!regex.test(config)) {
|
|
543
481
|
halt(
|
|
544
|
-
`Flag
|
|
482
|
+
`Flag "--config" has forbidden format. Allowed format: ${regex.toString()}.`
|
|
545
483
|
);
|
|
546
484
|
}
|
|
547
485
|
};
|
|
548
|
-
var prepareFlags6 = (flags, options) => {
|
|
549
|
-
return prepareFlags2(flags, options);
|
|
550
|
-
};
|
|
551
486
|
var parseTags = (lines) => {
|
|
552
487
|
const regex = /^\s*PRE\s*/;
|
|
553
488
|
return lines.filter((line) => regex.test(line)).map((line) => line.replace(regex, "").replace(/\/$/, ""));
|
|
554
489
|
};
|
|
555
490
|
|
|
556
|
-
// src/commands/
|
|
557
|
-
import {
|
|
558
|
-
|
|
491
|
+
// src/commands/serve.ts
|
|
492
|
+
import { resolve as resolve2 } from "path";
|
|
493
|
+
import { getPortPromise as getPortPromise2 } from "portfinder";
|
|
494
|
+
var serve = async (options) => {
|
|
495
|
+
assertOptionsValid5(options);
|
|
496
|
+
const flags = (await prepareFlags4([], options)).join(" ");
|
|
559
497
|
const { ifCore } = getIfCoreFns();
|
|
560
498
|
const paths = getPaths(ifCore);
|
|
561
|
-
const emailConfigPath = `${paths.app}/email-config`;
|
|
562
|
-
assertOptionsValid6(options);
|
|
563
|
-
assertIsNotCore();
|
|
564
|
-
assertEmailConfigPathExists(emailConfigPath);
|
|
565
|
-
const flags = prepareFlags7([], options).join(" ");
|
|
566
|
-
const { bucket } = options;
|
|
567
|
-
const configName = getWidgetUuid();
|
|
568
|
-
const deployUrl = `s3://${bucket}/${configName}`;
|
|
569
499
|
const cmd = `
|
|
570
|
-
|
|
571
|
-
--
|
|
572
|
-
--exact-timestamps
|
|
500
|
+
npx -y serve ${paths.appDist}
|
|
501
|
+
--cors
|
|
573
502
|
${flags}
|
|
574
503
|
`;
|
|
575
|
-
logTitle(
|
|
576
|
-
`Deploying email configuration for \u201C${configName}\u201D customer configuration to AWS S3 \u2026`
|
|
577
|
-
);
|
|
504
|
+
logTitle(`Running web-server for pre-built bundle \u2026`);
|
|
578
505
|
logCommand(cmd);
|
|
579
|
-
|
|
580
|
-
withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }), options);
|
|
581
|
-
} catch (error) {
|
|
582
|
-
halt(error.stderr);
|
|
583
|
-
}
|
|
584
|
-
logTitle(
|
|
585
|
-
`Email configuration for \u201C${configName}\u201D customer configuration is deployed.`
|
|
586
|
-
);
|
|
587
|
-
logDataTable({ "Deploy URL:": deployUrl });
|
|
588
|
-
process.on("exit", () => {
|
|
589
|
-
notify({
|
|
590
|
-
title: `deploy-email-config`,
|
|
591
|
-
message: `Email configuration for \u201C${configName}\u201D customer configuration is deployed.`
|
|
592
|
-
});
|
|
593
|
-
});
|
|
594
|
-
};
|
|
595
|
-
var assertOptionsValid6 = (options) => {
|
|
596
|
-
const { bucket, profile } = options;
|
|
597
|
-
assertBucketValid(bucket);
|
|
598
|
-
assertProfileValid(profile);
|
|
506
|
+
runCommandSync(cmd, { stdio: "inherit" });
|
|
599
507
|
};
|
|
600
|
-
var
|
|
601
|
-
|
|
602
|
-
|
|
508
|
+
var assertOptionsValid5 = (options) => {
|
|
509
|
+
const { port, https } = options;
|
|
510
|
+
if (isNaN(Number(port))) {
|
|
511
|
+
halt('Flag "--port" should be a number.');
|
|
603
512
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
const regex = /^[a-zA-Z0-9-_]+$/;
|
|
607
|
-
if (!regex.test(tag)) {
|
|
608
|
-
halt(
|
|
609
|
-
`Flag \u201C--bucket\u201D has forbidden format. Allowed format: ${regex.toString()}.`
|
|
610
|
-
);
|
|
513
|
+
if (https) {
|
|
514
|
+
assertCrtExists();
|
|
611
515
|
}
|
|
612
516
|
};
|
|
613
|
-
var
|
|
614
|
-
const {
|
|
615
|
-
|
|
616
|
-
|
|
517
|
+
var prepareFlags4 = async (flags, options) => {
|
|
518
|
+
const { port: defaultPort, https } = options;
|
|
519
|
+
const port = await getPortPromise2({ port: Number(defaultPort) });
|
|
520
|
+
flags.push(`-p ${port}`);
|
|
521
|
+
if (https) {
|
|
522
|
+
const { ifCore } = getIfCoreFns();
|
|
523
|
+
const paths = getPaths(ifCore);
|
|
524
|
+
const certFile = resolve2(paths.root, HTTPS_CRT_FILE);
|
|
525
|
+
const keyFile = resolve2(paths.root, HTTPS_KEY_FILE);
|
|
526
|
+
flags.push(`--ssl-cert ${certFile}`);
|
|
527
|
+
flags.push(`--ssl-key ${keyFile}`);
|
|
617
528
|
}
|
|
529
|
+
return flags;
|
|
618
530
|
};
|
|
619
|
-
|
|
620
|
-
|
|
531
|
+
|
|
532
|
+
// package.json
|
|
533
|
+
var package_default = {
|
|
534
|
+
name: "@raisenow/tamaro-cli",
|
|
535
|
+
version: "1.1.1",
|
|
536
|
+
author: {
|
|
537
|
+
name: "RaiseNow",
|
|
538
|
+
email: "development@raisenow.com"
|
|
539
|
+
},
|
|
540
|
+
type: "module",
|
|
541
|
+
scripts: {
|
|
542
|
+
prepare: "pnpm build",
|
|
543
|
+
tscheck: "tsc --noEmit",
|
|
544
|
+
build: "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
545
|
+
"build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
|
|
546
|
+
readme: "pnpx http-server . --cors -o /readme.html",
|
|
547
|
+
lint: "eslint .",
|
|
548
|
+
"lint:fix": "eslint --fix .",
|
|
549
|
+
format: "prettier --write ."
|
|
550
|
+
},
|
|
551
|
+
bin: "dist/cli.js",
|
|
552
|
+
engines: {
|
|
553
|
+
node: ">=18",
|
|
554
|
+
npm: ">=10"
|
|
555
|
+
},
|
|
556
|
+
dependencies: {
|
|
557
|
+
"@babel/cli": "^7.22.15",
|
|
558
|
+
"@babel/core": "^7.22.19",
|
|
559
|
+
"@babel/plugin-proposal-decorators": "^7.22.15",
|
|
560
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
561
|
+
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
562
|
+
"@babel/preset-env": "^7.22.15",
|
|
563
|
+
"@babel/preset-react": "^7.22.15",
|
|
564
|
+
"@babel/preset-typescript": "^7.22.15",
|
|
565
|
+
"@babel/runtime-corejs3": "^7.22.15",
|
|
566
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
567
|
+
"@statoscope/webpack-plugin": "^5.27.0",
|
|
568
|
+
"@types/columnify": "^1.5.2",
|
|
569
|
+
"@types/lodash": "^4.14.198",
|
|
570
|
+
"@types/node": "^18.17.15",
|
|
571
|
+
"@types/node-notifier": "^8.0.2",
|
|
572
|
+
"@types/prompts": "^2.4.4",
|
|
573
|
+
"@types/resolve-bin": "^0.4.1",
|
|
574
|
+
"@types/webpack-config-utils": "^2.3.1",
|
|
575
|
+
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
576
|
+
"@typescript-eslint/parser": "^6.7.0",
|
|
577
|
+
autoprefixer: "^10.4.15",
|
|
578
|
+
"babel-loader": "^9.1.3",
|
|
579
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
580
|
+
"babel-plugin-lodash": "^3.3.4",
|
|
581
|
+
chalk: "^5.3.0",
|
|
582
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
583
|
+
columnify: "^1.6.0",
|
|
584
|
+
commander: "^11.0.0",
|
|
585
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
586
|
+
"core-js": "^3.32.2",
|
|
587
|
+
"css-loader": "^6.8.1",
|
|
588
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
589
|
+
dotenv: "^16.3.1",
|
|
590
|
+
"dotenv-expand": "^10.0.0",
|
|
591
|
+
"escape-string-regexp": "^5.0.0",
|
|
592
|
+
eslint: "^8.49.0",
|
|
593
|
+
"eslint-config-prettier": "^9.0.0",
|
|
594
|
+
"eslint-import-resolver-typescript": "^3.6.0",
|
|
595
|
+
"eslint-plugin-deprecation": "^2.0.0",
|
|
596
|
+
"eslint-plugin-import": "^2.28.1",
|
|
597
|
+
"eslint-plugin-markdownlint": "^0.5.0",
|
|
598
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
599
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
600
|
+
"eslint-plugin-yml": "^1.9.0",
|
|
601
|
+
"eslint-webpack-plugin": "^4.0.1",
|
|
602
|
+
execa: "^8.0.1",
|
|
603
|
+
"file-loader": "^6.2.0",
|
|
604
|
+
"fork-ts-checker-webpack-plugin": "^8.0.0",
|
|
605
|
+
glob: "^10.3.4",
|
|
606
|
+
"html-loader": "^4.2.0",
|
|
607
|
+
"html-webpack-plugin": "^5.5.3",
|
|
608
|
+
"json-loader": "^0.5.7",
|
|
609
|
+
lodash: "^4.17.21",
|
|
610
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
611
|
+
"node-notifier": "^10.0.1",
|
|
612
|
+
portfinder: "^1.0.32",
|
|
613
|
+
postcss: "^8.4.29",
|
|
614
|
+
"postcss-custom-properties": "^13.3.0",
|
|
615
|
+
"postcss-loader": "^7.3.3",
|
|
616
|
+
prettier: "^3.0.3",
|
|
617
|
+
prompts: "^2.4.2",
|
|
618
|
+
"react-refresh": "^0.14.0",
|
|
619
|
+
"resolve-url-loader": "^5.0.0",
|
|
620
|
+
sass: "^1.67.0",
|
|
621
|
+
"sass-loader": "^13.3.2",
|
|
622
|
+
"source-map-loader": "^4.0.1",
|
|
623
|
+
"strip-indent": "^4.0.0",
|
|
624
|
+
"style-loader": "^3.3.3",
|
|
625
|
+
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
626
|
+
tsup: "^7.2.0",
|
|
627
|
+
typescript: "^5.2.2",
|
|
628
|
+
"url-loader": "^4.1.1",
|
|
629
|
+
webpack: "^5.88.2",
|
|
630
|
+
"webpack-cli": "^5.1.4",
|
|
631
|
+
"webpack-config-utils": "^2.3.1",
|
|
632
|
+
"webpack-dev-server": "^4.15.1",
|
|
633
|
+
"yaml-loader": "^0.8.0"
|
|
634
|
+
},
|
|
635
|
+
packageManager: "pnpm@8.7.5"
|
|
621
636
|
};
|
|
622
637
|
|
|
623
638
|
// src/cli.ts
|
|
@@ -651,7 +666,7 @@ cli.command("build").description(
|
|
|
651
666
|
"--https",
|
|
652
667
|
"Let local web server serve Tamaro with SSL encryption",
|
|
653
668
|
false
|
|
654
|
-
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option(
|
|
669
|
+
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option("--ci", "CI environment", false).option(
|
|
655
670
|
"--deploy",
|
|
656
671
|
"Deploy Tamaro Core or a customer configuration bundle to AWS S3",
|
|
657
672
|
false
|
|
@@ -659,10 +674,6 @@ cli.command("build").description(
|
|
|
659
674
|
"--tag <tag>",
|
|
660
675
|
"Tag which should be used for the deployment of the bundle",
|
|
661
676
|
DEFAULT_TAG
|
|
662
|
-
).option(
|
|
663
|
-
"--profile <profile>",
|
|
664
|
-
"AWS profile which should be used for the deployment of the bundle",
|
|
665
|
-
DEFAULT_AWS_PROFILE
|
|
666
677
|
).action(async (options) => {
|
|
667
678
|
await build(options);
|
|
668
679
|
if (options.serve) {
|
|
@@ -681,38 +692,22 @@ cli.command("serve").description("Run a local web server for pre-built bundle").
|
|
|
681
692
|
});
|
|
682
693
|
cli.command("deploy").description(
|
|
683
694
|
"Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3"
|
|
684
|
-
).option(
|
|
695
|
+
).option("--ci", "CI environment", false).option(
|
|
685
696
|
"--tag <tag>",
|
|
686
697
|
"Tag which should be used for the deployment of the bundle",
|
|
687
698
|
DEFAULT_TAG
|
|
688
|
-
).option(
|
|
689
|
-
"--profile <profile>",
|
|
690
|
-
"AWS profile which should be used for the deployment of the bundle",
|
|
691
|
-
DEFAULT_AWS_PROFILE
|
|
692
699
|
).action(async (options) => {
|
|
693
700
|
await deploy(options);
|
|
694
701
|
});
|
|
695
702
|
cli.command("list-deployed").description(
|
|
696
703
|
"List deployments of Tamaro Core or a particular customer configuration"
|
|
697
|
-
).option(
|
|
704
|
+
).option("--ci", "CI environment", false).option(
|
|
698
705
|
"--config <config>",
|
|
699
706
|
"Configuration name (default: current customer configuration)"
|
|
700
|
-
).option(
|
|
701
|
-
"--profile <profile>",
|
|
702
|
-
"AWS profile which should be used for fetching deployments",
|
|
703
|
-
DEFAULT_AWS_PROFILE
|
|
704
707
|
).action(async (options) => {
|
|
705
708
|
await listDeployed(options);
|
|
706
709
|
});
|
|
707
|
-
cli.command("deploy-email-config").description("Deploy a widget
|
|
708
|
-
"--bucket <bucket>",
|
|
709
|
-
"AWS S3 bucket where it should be deployed",
|
|
710
|
-
DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET
|
|
711
|
-
).option(
|
|
712
|
-
"--profile <profile>",
|
|
713
|
-
"AWS profile which should be used for the deployment of email configuration",
|
|
714
|
-
DEFAULT_AWS_PROFILE
|
|
715
|
-
).action(async (options) => {
|
|
710
|
+
cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").option("--ci", "CI environment", false).action(async (options) => {
|
|
716
711
|
await deployEmailConfig(options);
|
|
717
712
|
});
|
|
718
713
|
(async () => {
|