@raisenow/tamaro-cli 1.1.5 → 1.1.7
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/.nvmrc +1 -1
- package/dist/{chunk-TXIBRHT6.js → chunk-NJVU7WR2.js} +20 -24
- package/dist/cli.js +180 -137
- package/dist/webpack.config.js +10 -6
- package/package.json +55 -53
- package/src/cli.ts +15 -5
- package/src/commands/build.ts +13 -7
- package/src/commands/deploy-email-config.ts +76 -12
- package/src/commands/deploy.ts +28 -30
- package/src/commands/dev.ts +5 -7
- package/src/commands/list-deployed.ts +17 -11
- package/src/commands/serve.ts +4 -6
- package/src/lib/aws.ts +34 -55
- package/src/lib/command.ts +4 -8
- package/src/lib/constants.ts +3 -4
- package/src/lib/env.ts +1 -2
- package/src/webpack.config.ts +9 -5
- package/tsconfig.json +25 -73
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
AWS_CLOUDFRONT_DISTRIBUTION_ID,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
AWS_S3_BUCKET_TAMARO,
|
|
5
|
+
AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD,
|
|
6
|
+
AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE,
|
|
7
7
|
CORE_CONFIG_NAME,
|
|
8
8
|
DEFAULT_PORT,
|
|
9
9
|
DEFAULT_TAG,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveBin,
|
|
23
23
|
resolveOwn,
|
|
24
24
|
runCommandSync
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-NJVU7WR2.js";
|
|
26
26
|
|
|
27
27
|
// src/cli.ts
|
|
28
28
|
import { createCommand } from "commander";
|
|
@@ -31,10 +31,6 @@ import { createCommand } from "commander";
|
|
|
31
31
|
import { execaCommandSync } from "execa";
|
|
32
32
|
import prompts from "prompts";
|
|
33
33
|
import stripIndent from "strip-indent";
|
|
34
|
-
var withAwsAuthenticate = (fn, options) => {
|
|
35
|
-
awsAuthenticate(options);
|
|
36
|
-
return fn();
|
|
37
|
-
};
|
|
38
34
|
var awsAuthenticate = (options) => {
|
|
39
35
|
if (options.ci) {
|
|
40
36
|
return;
|
|
@@ -63,11 +59,11 @@ var getAvailableProfiles = () => {
|
|
|
63
59
|
return stdout.split("\n");
|
|
64
60
|
};
|
|
65
61
|
var checkIdentity = (options) => {
|
|
66
|
-
const flags = prepareFlags(
|
|
62
|
+
const flags = prepareFlags(options);
|
|
67
63
|
execaCommandSync(`aws sts get-caller-identity ${flags}`);
|
|
68
64
|
};
|
|
69
65
|
var login = (options) => {
|
|
70
|
-
const flags = prepareFlags(
|
|
66
|
+
const flags = prepareFlags(options);
|
|
71
67
|
try {
|
|
72
68
|
execaCommandSync(`aws sso login ${flags}`, { stdio: "inherit" });
|
|
73
69
|
console.log("");
|
|
@@ -75,12 +71,24 @@ var login = (options) => {
|
|
|
75
71
|
halt("Login failed.");
|
|
76
72
|
}
|
|
77
73
|
};
|
|
78
|
-
var prepareFlags = (
|
|
74
|
+
var prepareFlags = (options) => {
|
|
75
|
+
const flags = [];
|
|
79
76
|
const { profile } = options;
|
|
80
77
|
if (profile) {
|
|
81
78
|
flags.push(`--profile ${profile}`);
|
|
82
79
|
}
|
|
83
|
-
return flags;
|
|
80
|
+
return flags.join(" ");
|
|
81
|
+
};
|
|
82
|
+
var assertProfileValid = (profile) => {
|
|
83
|
+
const profiles = getAvailableProfiles();
|
|
84
|
+
if (!profiles.includes(profile)) {
|
|
85
|
+
halt(
|
|
86
|
+
stripIndent(`
|
|
87
|
+
AWS profile "${profile}" is not found.
|
|
88
|
+
Available profiles are: ${profiles.map((v) => `"${v}"`).join(", ")}.
|
|
89
|
+
`)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
84
92
|
};
|
|
85
93
|
var promptProfile = async () => {
|
|
86
94
|
const profiles = getAvailableProfiles().filter((v) => !!v).map((v) => ({ title: v, value: v }));
|
|
@@ -94,31 +102,11 @@ var promptProfile = async () => {
|
|
|
94
102
|
}
|
|
95
103
|
],
|
|
96
104
|
{
|
|
97
|
-
onCancel: () =>
|
|
105
|
+
onCancel: () => halt()
|
|
98
106
|
}
|
|
99
107
|
);
|
|
100
108
|
return profile;
|
|
101
109
|
};
|
|
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
110
|
|
|
123
111
|
// src/lib/https.ts
|
|
124
112
|
import { existsSync } from "fs";
|
|
@@ -157,13 +145,13 @@ var notify = (args) => {
|
|
|
157
145
|
// src/commands/build.ts
|
|
158
146
|
var build = async (options) => {
|
|
159
147
|
const { env } = options;
|
|
160
|
-
assertOptionsValid(options);
|
|
161
148
|
applyEnv(env);
|
|
162
|
-
if (options.deploy && !options.ci) {
|
|
149
|
+
if (options.deploy && !options.profile && !options.ci) {
|
|
163
150
|
assertProfilesPresent();
|
|
164
151
|
options.profile = await promptProfile();
|
|
165
152
|
}
|
|
166
|
-
|
|
153
|
+
assertOptionsValid(options);
|
|
154
|
+
const flags = prepareFlags2(options);
|
|
167
155
|
const { ifCore } = getIfCoreFns();
|
|
168
156
|
const paths = getPaths(ifCore);
|
|
169
157
|
const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
@@ -194,7 +182,7 @@ Bundle for "${configName}" customer configuration is done.`);
|
|
|
194
182
|
});
|
|
195
183
|
};
|
|
196
184
|
var assertOptionsValid = (options) => {
|
|
197
|
-
const { localCore, https, deploy: deploy2, env } = options;
|
|
185
|
+
const { localCore, https, deploy: deploy2, env, profile } = options;
|
|
198
186
|
const { ifCore } = getIfCoreFns();
|
|
199
187
|
if (ifCore() && localCore) {
|
|
200
188
|
halt('Flag "--local-core" is redundant if running in Tamaro Core context.');
|
|
@@ -205,9 +193,13 @@ var assertOptionsValid = (options) => {
|
|
|
205
193
|
if (https) {
|
|
206
194
|
assertCrtExists();
|
|
207
195
|
}
|
|
196
|
+
if (profile) {
|
|
197
|
+
assertProfileValid(profile);
|
|
198
|
+
}
|
|
208
199
|
assertEnvValid(env);
|
|
209
200
|
};
|
|
210
|
-
var prepareFlags2 = (
|
|
201
|
+
var prepareFlags2 = (options) => {
|
|
202
|
+
const flags = [];
|
|
211
203
|
const { localCore, analyze, https, nolint } = options;
|
|
212
204
|
if (localCore) {
|
|
213
205
|
flags.push("--env localCore");
|
|
@@ -221,7 +213,7 @@ var prepareFlags2 = (flags, options) => {
|
|
|
221
213
|
if (nolint) {
|
|
222
214
|
flags.push("--env nolint");
|
|
223
215
|
}
|
|
224
|
-
return flags;
|
|
216
|
+
return flags.join(" ");
|
|
225
217
|
};
|
|
226
218
|
|
|
227
219
|
// src/commands/deploy.ts
|
|
@@ -230,16 +222,17 @@ import stripIndent4 from "strip-indent";
|
|
|
230
222
|
var deploy = async (options) => {
|
|
231
223
|
const { ifCore } = getIfCoreFns();
|
|
232
224
|
const paths = getPaths(ifCore);
|
|
233
|
-
assertOptionsValid2(options);
|
|
234
225
|
assertDistPathExists(paths.appDist);
|
|
235
|
-
if (!options.
|
|
226
|
+
if (!options.profile && !options.ci) {
|
|
236
227
|
assertProfilesPresent();
|
|
237
228
|
options.profile = await promptProfile();
|
|
238
229
|
}
|
|
239
|
-
|
|
230
|
+
assertOptionsValid2(options);
|
|
231
|
+
awsAuthenticate(options);
|
|
232
|
+
const flags = prepareFlags(options);
|
|
240
233
|
const { tag } = options;
|
|
241
234
|
const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
242
|
-
const deployUrl = `s3://${
|
|
235
|
+
const deployUrl = `s3://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}`;
|
|
243
236
|
const entryFilename = ifCore("index.js", "widget.js");
|
|
244
237
|
const cmdSyncAll = `
|
|
245
238
|
aws s3 sync ${paths.appDist} ${deployUrl}
|
|
@@ -251,10 +244,7 @@ var deploy = async (options) => {
|
|
|
251
244
|
logTitle("Deploying to AWS S3 \u2026");
|
|
252
245
|
logCommand(cmdSyncAll);
|
|
253
246
|
try {
|
|
254
|
-
|
|
255
|
-
() => runCommandSync(cmdSyncAll, { stdout: "inherit" }),
|
|
256
|
-
options
|
|
257
|
-
);
|
|
247
|
+
runCommandSync(cmdSyncAll, { stdout: "inherit" });
|
|
258
248
|
} catch (error) {
|
|
259
249
|
halt(error.stderr);
|
|
260
250
|
}
|
|
@@ -266,10 +256,7 @@ var deploy = async (options) => {
|
|
|
266
256
|
`;
|
|
267
257
|
logCommand(cmdCpEntry);
|
|
268
258
|
try {
|
|
269
|
-
|
|
270
|
-
() => runCommandSync(cmdCpEntry, { stdout: "inherit" }),
|
|
271
|
-
options
|
|
272
|
-
);
|
|
259
|
+
runCommandSync(cmdCpEntry, { stdout: "inherit" });
|
|
273
260
|
} catch (error) {
|
|
274
261
|
halt(error.stderr);
|
|
275
262
|
}
|
|
@@ -282,12 +269,12 @@ var deploy = async (options) => {
|
|
|
282
269
|
logTitle("\nInvalidating edge cache \u2026");
|
|
283
270
|
logCommand(cmdInvalidateCache);
|
|
284
271
|
try {
|
|
285
|
-
|
|
272
|
+
runCommandSync(cmdInvalidateCache);
|
|
286
273
|
} catch (error) {
|
|
287
274
|
halt(error.stderr);
|
|
288
275
|
}
|
|
289
|
-
const demoPage = `https://${
|
|
290
|
-
const entryPoint = `https://${
|
|
276
|
+
const demoPage = `https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/index.html`;
|
|
277
|
+
const entryPoint = `https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/${entryFilename}`;
|
|
291
278
|
logTitle(`
|
|
292
279
|
Bundle for "${configName}" is deployed with tag "${tag}".`);
|
|
293
280
|
logDataTable({
|
|
@@ -306,7 +293,10 @@ Bundle for "${configName}" is deployed with tag "${tag}".`);
|
|
|
306
293
|
});
|
|
307
294
|
};
|
|
308
295
|
var assertOptionsValid2 = (options) => {
|
|
309
|
-
const { tag } = options;
|
|
296
|
+
const { profile, tag } = options;
|
|
297
|
+
if (profile) {
|
|
298
|
+
assertProfileValid(profile);
|
|
299
|
+
}
|
|
310
300
|
assertTagValid(tag);
|
|
311
301
|
};
|
|
312
302
|
var assertDistPathExists = (distPath) => {
|
|
@@ -330,20 +320,25 @@ var assertTagValid = (tag) => {
|
|
|
330
320
|
|
|
331
321
|
// src/commands/deploy-email-config.ts
|
|
332
322
|
import { existsSync as existsSync3 } from "fs";
|
|
323
|
+
import prompts2 from "prompts";
|
|
333
324
|
var deployEmailConfig = async (options) => {
|
|
334
325
|
const { ifCore } = getIfCoreFns();
|
|
335
326
|
const paths = getPaths(ifCore);
|
|
336
327
|
const emailConfigPath = `${paths.app}/email-config`;
|
|
337
328
|
assertIsNotCore();
|
|
338
329
|
assertEmailConfigPathExists(emailConfigPath);
|
|
339
|
-
if (!options.ci) {
|
|
330
|
+
if (!options.profile && !options.ci) {
|
|
340
331
|
assertProfilesPresent();
|
|
341
332
|
options.profile = await promptProfile();
|
|
342
333
|
}
|
|
343
|
-
|
|
344
|
-
|
|
334
|
+
if (!options.bucket) {
|
|
335
|
+
options.bucket = options.ci ? AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD : await promptBucketTamaroEmailConfig();
|
|
336
|
+
}
|
|
337
|
+
assertOptionsValid3(options);
|
|
338
|
+
awsAuthenticate(options);
|
|
339
|
+
const flags = prepareFlags(options);
|
|
345
340
|
const configName = getWidgetUuid();
|
|
346
|
-
const deployUrl = `s3://${bucket}/${configName}`;
|
|
341
|
+
const deployUrl = `s3://${options.bucket}/${configName}`;
|
|
347
342
|
const cmd = `
|
|
348
343
|
aws s3 sync ${emailConfigPath} ${deployUrl}
|
|
349
344
|
--delete
|
|
@@ -355,7 +350,7 @@ var deployEmailConfig = async (options) => {
|
|
|
355
350
|
);
|
|
356
351
|
logCommand(cmd);
|
|
357
352
|
try {
|
|
358
|
-
|
|
353
|
+
runCommandSync(cmd, { stdout: "inherit" });
|
|
359
354
|
} catch (error) {
|
|
360
355
|
halt(error.stderr);
|
|
361
356
|
}
|
|
@@ -370,9 +365,18 @@ var deployEmailConfig = async (options) => {
|
|
|
370
365
|
});
|
|
371
366
|
});
|
|
372
367
|
};
|
|
368
|
+
var assertOptionsValid3 = (options) => {
|
|
369
|
+
const { profile, bucket } = options;
|
|
370
|
+
if (profile) {
|
|
371
|
+
assertProfileValid(profile);
|
|
372
|
+
}
|
|
373
|
+
if (bucket) {
|
|
374
|
+
assertBucketValid(bucket);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
373
377
|
var assertEmailConfigPathExists = (distPath) => {
|
|
374
378
|
if (!existsSync3(distPath)) {
|
|
375
|
-
halt("Email config folder does not exists. Nothing to deploy."
|
|
379
|
+
halt("Email config folder does not exists. Nothing to deploy.");
|
|
376
380
|
}
|
|
377
381
|
};
|
|
378
382
|
var assertIsNotCore = () => {
|
|
@@ -381,14 +385,43 @@ var assertIsNotCore = () => {
|
|
|
381
385
|
halt("You cannot deploy widget email configuration for Tamaro Core.");
|
|
382
386
|
}
|
|
383
387
|
};
|
|
388
|
+
var assertBucketValid = (bucket) => {
|
|
389
|
+
const buckets = [
|
|
390
|
+
AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE,
|
|
391
|
+
AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD
|
|
392
|
+
];
|
|
393
|
+
if (!buckets.includes(bucket)) {
|
|
394
|
+
halt("Invalid bucket name.");
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
var promptBucketTamaroEmailConfig = async () => {
|
|
398
|
+
const buckets = [
|
|
399
|
+
{ title: "stage", value: AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE },
|
|
400
|
+
{ title: "prod", value: AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD }
|
|
401
|
+
];
|
|
402
|
+
const { bucket } = await prompts2(
|
|
403
|
+
[
|
|
404
|
+
{
|
|
405
|
+
type: "select",
|
|
406
|
+
name: "bucket",
|
|
407
|
+
message: "Select environment",
|
|
408
|
+
choices: buckets
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
{
|
|
412
|
+
onCancel: () => halt()
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
return bucket;
|
|
416
|
+
};
|
|
384
417
|
|
|
385
418
|
// src/commands/dev.ts
|
|
386
419
|
import { getPortPromise } from "portfinder";
|
|
387
420
|
var dev = async (options) => {
|
|
388
421
|
const { env } = options;
|
|
389
|
-
assertOptionsValid3(options);
|
|
390
422
|
applyEnv(env);
|
|
391
|
-
|
|
423
|
+
assertOptionsValid4(options);
|
|
424
|
+
const flags = await prepareFlags3(options);
|
|
392
425
|
const { ifCore } = getIfCoreFns();
|
|
393
426
|
const title = ifCore(
|
|
394
427
|
"Running dev web-server for Tamaro Core \u2026",
|
|
@@ -405,7 +438,7 @@ var dev = async (options) => {
|
|
|
405
438
|
logCommand(cmd);
|
|
406
439
|
runCommandSync(cmd, { stdio: "inherit" });
|
|
407
440
|
};
|
|
408
|
-
var
|
|
441
|
+
var assertOptionsValid4 = (options) => {
|
|
409
442
|
const { localCore, https, port, env } = options;
|
|
410
443
|
const { ifCore } = getIfCoreFns();
|
|
411
444
|
if (ifCore() && localCore) {
|
|
@@ -419,7 +452,8 @@ var assertOptionsValid3 = (options) => {
|
|
|
419
452
|
}
|
|
420
453
|
assertEnvValid(env);
|
|
421
454
|
};
|
|
422
|
-
var prepareFlags3 = async (
|
|
455
|
+
var prepareFlags3 = async (options) => {
|
|
456
|
+
const flags = [];
|
|
423
457
|
const { localCore, port: defaultPort, https, nolint } = options;
|
|
424
458
|
const port = await getPortPromise({ port: Number(defaultPort) });
|
|
425
459
|
if (localCore) {
|
|
@@ -432,28 +466,29 @@ var prepareFlags3 = async (flags, options) => {
|
|
|
432
466
|
if (nolint) {
|
|
433
467
|
flags.push("--env nolint");
|
|
434
468
|
}
|
|
435
|
-
return flags;
|
|
469
|
+
return flags.join(" ");
|
|
436
470
|
};
|
|
437
471
|
|
|
438
472
|
// src/commands/list-deployed.ts
|
|
439
473
|
var listDeployed = async (options) => {
|
|
440
|
-
|
|
441
|
-
if (!options.ci) {
|
|
474
|
+
if (!options.profile && !options.ci) {
|
|
442
475
|
assertProfilesPresent();
|
|
443
476
|
options.profile = await promptProfile();
|
|
444
477
|
}
|
|
445
|
-
|
|
478
|
+
assertOptionsValid5(options);
|
|
479
|
+
awsAuthenticate(options);
|
|
480
|
+
const flags = prepareFlags(options);
|
|
446
481
|
const { config } = options;
|
|
447
482
|
const { ifCore } = getIfCoreFns();
|
|
448
483
|
const configName = config ?? ifCore(CORE_CONFIG_NAME, getWidgetUuid());
|
|
449
484
|
const title = !config && ifCore() ? `Listing deployments of Tamaro Core \u2026` : `Listing deployments of "${configName}" customer configuration \u2026`;
|
|
450
|
-
const deployUrl = `s3://${
|
|
485
|
+
const deployUrl = `s3://${AWS_S3_BUCKET_TAMARO}/${configName}/`;
|
|
451
486
|
const cmd = `aws s3 ls ${deployUrl} ${flags}`;
|
|
452
487
|
let out = "";
|
|
453
488
|
logTitle(title);
|
|
454
489
|
logCommand(cmd);
|
|
455
490
|
try {
|
|
456
|
-
const result =
|
|
491
|
+
const result = runCommandSync(cmd);
|
|
457
492
|
out = result.stdout;
|
|
458
493
|
} catch (error) {
|
|
459
494
|
out = error.stdout;
|
|
@@ -468,15 +503,18 @@ var listDeployed = async (options) => {
|
|
|
468
503
|
text = "No deployments found.";
|
|
469
504
|
} else {
|
|
470
505
|
text = tags.map((tag, idx) => {
|
|
471
|
-
return `${idx + 1}. https://${
|
|
506
|
+
return `${idx + 1}. https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/index.html`;
|
|
472
507
|
}).join("\n");
|
|
473
508
|
}
|
|
474
509
|
console.log(`${text}
|
|
475
510
|
`);
|
|
476
511
|
};
|
|
477
|
-
var
|
|
478
|
-
const { config } = options;
|
|
512
|
+
var assertOptionsValid5 = (options) => {
|
|
513
|
+
const { config, profile } = options;
|
|
479
514
|
assertConfigValid(config);
|
|
515
|
+
if (profile) {
|
|
516
|
+
assertProfileValid(profile);
|
|
517
|
+
}
|
|
480
518
|
};
|
|
481
519
|
var assertConfigValid = (config) => {
|
|
482
520
|
if (!config) {
|
|
@@ -498,8 +536,8 @@ var parseTags = (lines) => {
|
|
|
498
536
|
import { resolve as resolve2 } from "path";
|
|
499
537
|
import { getPortPromise as getPortPromise2 } from "portfinder";
|
|
500
538
|
var serve = async (options) => {
|
|
501
|
-
|
|
502
|
-
const flags =
|
|
539
|
+
assertOptionsValid6(options);
|
|
540
|
+
const flags = await prepareFlags4(options);
|
|
503
541
|
const { ifCore } = getIfCoreFns();
|
|
504
542
|
const paths = getPaths(ifCore);
|
|
505
543
|
const cmd = `
|
|
@@ -511,7 +549,7 @@ var serve = async (options) => {
|
|
|
511
549
|
logCommand(cmd);
|
|
512
550
|
runCommandSync(cmd, { stdio: "inherit" });
|
|
513
551
|
};
|
|
514
|
-
var
|
|
552
|
+
var assertOptionsValid6 = (options) => {
|
|
515
553
|
const { port, https } = options;
|
|
516
554
|
if (isNaN(Number(port))) {
|
|
517
555
|
halt('Flag "--port" should be a number.');
|
|
@@ -520,7 +558,8 @@ var assertOptionsValid5 = (options) => {
|
|
|
520
558
|
assertCrtExists();
|
|
521
559
|
}
|
|
522
560
|
};
|
|
523
|
-
var prepareFlags4 = async (
|
|
561
|
+
var prepareFlags4 = async (options) => {
|
|
562
|
+
const flags = [];
|
|
524
563
|
const { port: defaultPort, https } = options;
|
|
525
564
|
const port = await getPortPromise2({ port: Number(defaultPort) });
|
|
526
565
|
flags.push(`-p ${port}`);
|
|
@@ -532,111 +571,113 @@ var prepareFlags4 = async (flags, options) => {
|
|
|
532
571
|
flags.push(`--ssl-cert ${certFile}`);
|
|
533
572
|
flags.push(`--ssl-key ${keyFile}`);
|
|
534
573
|
}
|
|
535
|
-
return flags;
|
|
574
|
+
return flags.join(" ");
|
|
536
575
|
};
|
|
537
576
|
|
|
538
577
|
// package.json
|
|
539
578
|
var package_default = {
|
|
540
579
|
name: "@raisenow/tamaro-cli",
|
|
541
|
-
version: "1.1.
|
|
580
|
+
version: "1.1.7",
|
|
542
581
|
author: {
|
|
543
582
|
name: "RaiseNow",
|
|
544
583
|
email: "development@raisenow.com"
|
|
545
584
|
},
|
|
546
585
|
type: "module",
|
|
586
|
+
bin: "dist/cli.js",
|
|
587
|
+
packageManager: "pnpm@9.12.3",
|
|
588
|
+
engines: {
|
|
589
|
+
node: ">=20",
|
|
590
|
+
pnpm: ">= 9.12",
|
|
591
|
+
npm: "please-use-pnpm",
|
|
592
|
+
yarn: "please-use-pnpm"
|
|
593
|
+
},
|
|
547
594
|
scripts: {
|
|
548
595
|
prepare: "pnpm build",
|
|
549
596
|
tscheck: "tsc --noEmit",
|
|
550
597
|
build: "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
|
|
551
598
|
"build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
|
|
552
599
|
readme: "pnpx http-server . --cors -o /readme.html",
|
|
553
|
-
lint: "eslint .",
|
|
554
|
-
"lint:fix": "eslint --fix .",
|
|
600
|
+
lint: "DEBUG=eslint:cli-engine eslint .",
|
|
601
|
+
"lint:fix": "DEBUG=eslint:cli-engine eslint --fix .",
|
|
555
602
|
format: "prettier --write ."
|
|
556
603
|
},
|
|
557
|
-
bin: "dist/cli.js",
|
|
558
|
-
engines: {
|
|
559
|
-
node: ">=20",
|
|
560
|
-
npm: ">=10"
|
|
561
|
-
},
|
|
562
|
-
packageManager: "pnpm@9.0.5",
|
|
563
604
|
dependencies: {
|
|
564
|
-
"@babel/cli": "^7.
|
|
565
|
-
"@babel/core": "^7.
|
|
566
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
605
|
+
"@babel/cli": "^7.25.9",
|
|
606
|
+
"@babel/core": "^7.26.0",
|
|
607
|
+
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
567
608
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
568
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
569
|
-
"@babel/preset-env": "^7.
|
|
570
|
-
"@babel/preset-react": "^7.
|
|
571
|
-
"@babel/preset-typescript": "^7.
|
|
572
|
-
"@babel/runtime-corejs3": "^7.
|
|
573
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.
|
|
609
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
610
|
+
"@babel/preset-env": "^7.26.0",
|
|
611
|
+
"@babel/preset-react": "^7.25.9",
|
|
612
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
613
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
614
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
574
615
|
"@statoscope/webpack-plugin": "^5.28.2",
|
|
575
616
|
"@types/columnify": "^1.5.4",
|
|
576
|
-
"@types/lodash": "^4.17.
|
|
577
|
-
"@types/node": "^20.
|
|
617
|
+
"@types/lodash": "^4.17.13",
|
|
618
|
+
"@types/node": "^20.17.6",
|
|
578
619
|
"@types/node-notifier": "^8.0.5",
|
|
579
620
|
"@types/prompts": "^2.4.9",
|
|
580
621
|
"@types/resolve-bin": "^0.4.3",
|
|
581
622
|
"@types/webpack-config-utils": "^2.3.4",
|
|
582
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
583
|
-
"@typescript-eslint/parser": "^7.
|
|
584
|
-
autoprefixer: "^10.4.
|
|
585
|
-
"babel-loader": "^9.1
|
|
586
|
-
"babel-plugin-istanbul": "^
|
|
623
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
624
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
625
|
+
autoprefixer: "^10.4.20",
|
|
626
|
+
"babel-loader": "^9.2.1",
|
|
627
|
+
"babel-plugin-istanbul": "^7.0.0",
|
|
587
628
|
"babel-plugin-lodash": "^3.3.4",
|
|
588
629
|
chalk: "^5.3.0",
|
|
589
630
|
"clean-webpack-plugin": "^4.0.0",
|
|
590
631
|
columnify: "^1.6.0",
|
|
591
|
-
commander: "^12.
|
|
632
|
+
commander: "^12.1.0",
|
|
592
633
|
"copy-webpack-plugin": "^12.0.2",
|
|
593
|
-
"core-js": "^3.
|
|
594
|
-
"css-loader": "^7.1.
|
|
595
|
-
"css-minimizer-webpack-plugin": "^
|
|
634
|
+
"core-js": "^3.39.0",
|
|
635
|
+
"css-loader": "^7.1.2",
|
|
636
|
+
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
596
637
|
dotenv: "^16.4.5",
|
|
597
638
|
"dotenv-expand": "^11.0.6",
|
|
598
639
|
"escape-string-regexp": "^5.0.0",
|
|
599
|
-
eslint: "^8.57.
|
|
640
|
+
eslint: "^8.57.1",
|
|
600
641
|
"eslint-config-prettier": "^9.1.0",
|
|
601
|
-
"eslint-import-resolver-typescript": "^3.6.
|
|
602
|
-
"eslint-plugin-deprecation": "^
|
|
603
|
-
"eslint-plugin-import": "^2.
|
|
604
|
-
"eslint-plugin-markdownlint": "^0.
|
|
605
|
-
"eslint-plugin-promise": "^
|
|
606
|
-
"eslint-plugin-unused-imports": "^3.
|
|
607
|
-
"eslint-plugin-yml": "^1.
|
|
608
|
-
"eslint-webpack-plugin": "^4.
|
|
609
|
-
execa: "^
|
|
642
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
643
|
+
"eslint-plugin-deprecation": "^3.0.0",
|
|
644
|
+
"eslint-plugin-import": "^2.31.0",
|
|
645
|
+
"eslint-plugin-markdownlint": "^0.6.0",
|
|
646
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
647
|
+
"eslint-plugin-unused-imports": "^3.2.0",
|
|
648
|
+
"eslint-plugin-yml": "^1.15.0",
|
|
649
|
+
"eslint-webpack-plugin": "^4.2.0",
|
|
650
|
+
execa: "^9.5.1",
|
|
610
651
|
"file-loader": "^6.2.0",
|
|
611
652
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
612
|
-
glob: "^
|
|
613
|
-
"html-loader": "^5.
|
|
614
|
-
"html-webpack-plugin": "^5.6.
|
|
653
|
+
glob: "^11.0.0",
|
|
654
|
+
"html-loader": "^5.1.0",
|
|
655
|
+
"html-webpack-plugin": "^5.6.3",
|
|
615
656
|
"json-loader": "^0.5.7",
|
|
616
657
|
lodash: "^4.17.21",
|
|
617
|
-
"mini-css-extract-plugin": "^2.9.
|
|
658
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
618
659
|
"node-notifier": "^10.0.1",
|
|
619
660
|
portfinder: "^1.0.32",
|
|
620
|
-
postcss: "^8.4.
|
|
621
|
-
"postcss-custom-properties": "^
|
|
661
|
+
postcss: "^8.4.47",
|
|
662
|
+
"postcss-custom-properties": "^14.0.4",
|
|
622
663
|
"postcss-loader": "^8.1.1",
|
|
623
|
-
prettier: "^3.
|
|
664
|
+
prettier: "^3.3.3",
|
|
624
665
|
prompts: "^2.4.2",
|
|
625
|
-
"react-refresh": "^0.14.
|
|
666
|
+
"react-refresh": "^0.14.2",
|
|
626
667
|
"resolve-url-loader": "^5.0.0",
|
|
627
|
-
sass: "^1.
|
|
628
|
-
"sass-loader": "^
|
|
668
|
+
sass: "^1.80.6",
|
|
669
|
+
"sass-loader": "^16.0.3",
|
|
629
670
|
"source-map-loader": "^5.0.0",
|
|
630
671
|
"strip-indent": "^4.0.0",
|
|
631
672
|
"style-loader": "^4.0.0",
|
|
632
673
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
633
|
-
tsup: "^8.
|
|
634
|
-
typescript: "^5.
|
|
674
|
+
tsup: "^8.3.5",
|
|
675
|
+
typescript: "^5.6.3",
|
|
635
676
|
"url-loader": "^4.1.1",
|
|
636
|
-
webpack: "^5.
|
|
677
|
+
webpack: "^5.96.1",
|
|
637
678
|
"webpack-cli": "^5.1.4",
|
|
638
679
|
"webpack-config-utils": "^2.3.1",
|
|
639
|
-
"webpack-dev-server": "^5.0
|
|
680
|
+
"webpack-dev-server": "^5.1.0",
|
|
640
681
|
"yaml-loader": "^0.8.1"
|
|
641
682
|
}
|
|
642
683
|
};
|
|
@@ -646,7 +687,7 @@ process.on("unhandledRejection", (error) => {
|
|
|
646
687
|
throw error;
|
|
647
688
|
});
|
|
648
689
|
process.on("SIGINT", () => {
|
|
649
|
-
|
|
690
|
+
halt();
|
|
650
691
|
});
|
|
651
692
|
var cli = createCommand().name(package_default.name).version(package_default.version, "-v, --version");
|
|
652
693
|
cli.command("dev").description(
|
|
@@ -672,7 +713,7 @@ cli.command("build").description(
|
|
|
672
713
|
"--https",
|
|
673
714
|
"Let local web server serve Tamaro with SSL encryption",
|
|
674
715
|
false
|
|
675
|
-
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option("--ci", "CI environment", false).option(
|
|
716
|
+
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option(
|
|
676
717
|
"--deploy",
|
|
677
718
|
"Deploy Tamaro Core or a customer configuration bundle to AWS S3",
|
|
678
719
|
false
|
|
@@ -698,7 +739,7 @@ cli.command("serve").description("Run a local web server for pre-built bundle").
|
|
|
698
739
|
});
|
|
699
740
|
cli.command("deploy").description(
|
|
700
741
|
"Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3"
|
|
701
|
-
).option("--ci", "CI environment", false).option(
|
|
742
|
+
).option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option(
|
|
702
743
|
"--tag <tag>",
|
|
703
744
|
"Tag which should be used for the deployment of the bundle",
|
|
704
745
|
DEFAULT_TAG
|
|
@@ -707,17 +748,19 @@ cli.command("deploy").description(
|
|
|
707
748
|
});
|
|
708
749
|
cli.command("list-deployed").description(
|
|
709
750
|
"List deployments of Tamaro Core or a particular customer configuration"
|
|
710
|
-
).option("--ci", "CI environment", false).option(
|
|
751
|
+
).option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option(
|
|
711
752
|
"--config <config>",
|
|
712
753
|
"Configuration name (default: current customer configuration)"
|
|
713
754
|
).action(async (options) => {
|
|
714
755
|
await listDeployed(options);
|
|
715
756
|
});
|
|
716
|
-
cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").option("--ci", "CI environment", false).action(async (options) => {
|
|
757
|
+
cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option("--bucket <bucket>", "AWS bucket for email configs").action(async (options) => {
|
|
717
758
|
await deployEmailConfig(options);
|
|
718
759
|
});
|
|
719
760
|
(async () => {
|
|
720
761
|
try {
|
|
762
|
+
logTitle(`${package_default.name} ${package_default.version}
|
|
763
|
+
`);
|
|
721
764
|
await cli.parseAsync(process.argv);
|
|
722
765
|
} catch (error) {
|
|
723
766
|
if (error.signal === "SIGINT" && error.signalDescription) {
|