@raisenow/tamaro-cli 1.1.6 → 1.1.8

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/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  AWS_CLOUDFRONT_DISTRIBUTION_ID,
4
- AWS_S3_BUCKET,
5
- AWS_S3_EMAIL_CONFIG_PROD_BUCKET,
6
- AWS_S3_EMAIL_CONFIG_STAGE_BUCKET,
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-OLKERSRR.js";
25
+ } from "./chunk-KVWFHWZD.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([], options).join(" ");
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([], options).join(" ");
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 = (flags, options) => {
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: () => process.exit(1)
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
- const flags = prepareFlags2([], options).join(" ");
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 = (flags, options) => {
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.ci && !options.profile) {
226
+ if (!options.profile && !options.ci) {
236
227
  assertProfilesPresent();
237
228
  options.profile = await promptProfile();
238
229
  }
239
- const flags = prepareFlags([], options).join(" ");
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://${AWS_S3_BUCKET}/${configName}/${tag}`;
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
- withAwsAuthenticate(
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
- withAwsAuthenticate(
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
- withAwsAuthenticate(() => runCommandSync(cmdInvalidateCache), options);
272
+ runCommandSync(cmdInvalidateCache);
286
273
  } catch (error) {
287
274
  halt(error.stderr);
288
275
  }
289
- const demoPage = `https://${AWS_S3_BUCKET}/${configName}/${tag}/index.html`;
290
- const entryPoint = `https://${AWS_S3_BUCKET}/${configName}/${tag}/${entryFilename}`;
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
- const bucket = options.ci ? AWS_S3_EMAIL_CONFIG_PROD_BUCKET : await promptBucket();
344
- const flags = prepareFlags([], options).join(" ");
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
- withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }), options);
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.", 0);
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
- const flags = (await prepareFlags3([], options)).join(" ");
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 assertOptionsValid3 = (options) => {
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 (flags, options) => {
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
- assertOptionsValid4(options);
441
- if (!options.ci) {
474
+ if (!options.profile && !options.ci) {
442
475
  assertProfilesPresent();
443
476
  options.profile = await promptProfile();
444
477
  }
445
- const flags = prepareFlags([], options).join(" ");
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://${AWS_S3_BUCKET}/${configName}/`;
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 = withAwsAuthenticate(() => runCommandSync(cmd), options);
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://${AWS_S3_BUCKET}/${configName}/${tag}/index.html`;
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 assertOptionsValid4 = (options) => {
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
- assertOptionsValid5(options);
502
- const flags = (await prepareFlags4([], options)).join(" ");
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 assertOptionsValid5 = (options) => {
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 (flags, options) => {
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,20 +571,20 @@ 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.6",
580
+ version: "1.1.8",
542
581
  author: {
543
582
  name: "RaiseNow",
544
583
  email: "development@raisenow.com"
545
584
  },
546
585
  type: "module",
547
586
  bin: "dist/cli.js",
548
- packageManager: "pnpm@9.12.1",
587
+ packageManager: "pnpm@9.14.2",
549
588
  engines: {
550
589
  node: ">=20",
551
590
  pnpm: ">= 9.12",
@@ -563,20 +602,20 @@ var package_default = {
563
602
  format: "prettier --write ."
564
603
  },
565
604
  dependencies: {
566
- "@babel/cli": "^7.25.7",
567
- "@babel/core": "^7.25.8",
568
- "@babel/plugin-proposal-decorators": "^7.25.7",
605
+ "@babel/cli": "^7.25.9",
606
+ "@babel/core": "^7.26.0",
607
+ "@babel/plugin-proposal-decorators": "^7.25.9",
569
608
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
570
- "@babel/plugin-transform-runtime": "^7.25.7",
571
- "@babel/preset-env": "^7.25.8",
572
- "@babel/preset-react": "^7.25.7",
573
- "@babel/preset-typescript": "^7.25.7",
574
- "@babel/runtime-corejs3": "^7.25.7",
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",
575
614
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
576
- "@statoscope/webpack-plugin": "^5.28.2",
615
+ "@statoscope/webpack-plugin": "^5.28.3",
577
616
  "@types/columnify": "^1.5.4",
578
- "@types/lodash": "^4.17.10",
579
- "@types/node": "^20.16.11",
617
+ "@types/lodash": "^4.17.13",
618
+ "@types/node": "^22.9.3",
580
619
  "@types/node-notifier": "^8.0.5",
581
620
  "@types/prompts": "^2.4.9",
582
621
  "@types/resolve-bin": "^0.4.3",
@@ -592,11 +631,10 @@ var package_default = {
592
631
  columnify: "^1.6.0",
593
632
  commander: "^12.1.0",
594
633
  "copy-webpack-plugin": "^12.0.2",
595
- "core-js": "^3.38.1",
634
+ "core-js": "^3.39.0",
596
635
  "css-loader": "^7.1.2",
597
636
  "css-minimizer-webpack-plugin": "^7.0.0",
598
637
  dotenv: "^16.4.5",
599
- "dotenv-expand": "^11.0.6",
600
638
  "escape-string-regexp": "^5.0.0",
601
639
  eslint: "^8.57.1",
602
640
  "eslint-config-prettier": "^9.1.0",
@@ -606,36 +644,36 @@ var package_default = {
606
644
  "eslint-plugin-markdownlint": "^0.6.0",
607
645
  "eslint-plugin-promise": "^7.1.0",
608
646
  "eslint-plugin-unused-imports": "^3.2.0",
609
- "eslint-plugin-yml": "^1.14.0",
647
+ "eslint-plugin-yml": "^1.15.0",
610
648
  "eslint-webpack-plugin": "^4.2.0",
611
- execa: "^9.4.0",
649
+ execa: "^9.5.1",
612
650
  "file-loader": "^6.2.0",
613
651
  "fork-ts-checker-webpack-plugin": "^9.0.2",
614
652
  glob: "^11.0.0",
615
653
  "html-loader": "^5.1.0",
616
- "html-webpack-plugin": "^5.6.0",
654
+ "html-webpack-plugin": "^5.6.3",
617
655
  "json-loader": "^0.5.7",
618
656
  lodash: "^4.17.21",
619
- "mini-css-extract-plugin": "^2.9.1",
657
+ "mini-css-extract-plugin": "^2.9.2",
620
658
  "node-notifier": "^10.0.1",
621
659
  portfinder: "^1.0.32",
622
- postcss: "^8.4.47",
623
- "postcss-custom-properties": "^14.0.2",
660
+ postcss: "^8.4.49",
661
+ "postcss-custom-properties": "^14.0.4",
624
662
  "postcss-loader": "^8.1.1",
625
663
  prettier: "^3.3.3",
626
664
  prompts: "^2.4.2",
627
665
  "react-refresh": "^0.14.2",
628
666
  "resolve-url-loader": "^5.0.0",
629
- sass: "^1.79.5",
630
- "sass-loader": "^16.0.2",
667
+ sass: "^1.81.0",
668
+ "sass-loader": "^16.0.3",
631
669
  "source-map-loader": "^5.0.0",
632
670
  "strip-indent": "^4.0.0",
633
671
  "style-loader": "^4.0.0",
634
- "tsconfig-paths-webpack-plugin": "^4.1.0",
635
- tsup: "^8.3.0",
636
- typescript: "^5.6.3",
672
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
673
+ tsup: "^8.3.5",
674
+ typescript: "^5.7.2",
637
675
  "url-loader": "^4.1.1",
638
- webpack: "^5.95.0",
676
+ webpack: "^5.96.1",
639
677
  "webpack-cli": "^5.1.4",
640
678
  "webpack-config-utils": "^2.3.1",
641
679
  "webpack-dev-server": "^5.1.0",
@@ -648,7 +686,7 @@ process.on("unhandledRejection", (error) => {
648
686
  throw error;
649
687
  });
650
688
  process.on("SIGINT", () => {
651
- process.exit(1);
689
+ halt();
652
690
  });
653
691
  var cli = createCommand().name(package_default.name).version(package_default.version, "-v, --version");
654
692
  cli.command("dev").description(
@@ -674,7 +712,7 @@ cli.command("build").description(
674
712
  "--https",
675
713
  "Let local web server serve Tamaro with SSL encryption",
676
714
  false
677
- ).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option("--ci", "CI environment", false).option(
715
+ ).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(
678
716
  "--deploy",
679
717
  "Deploy Tamaro Core or a customer configuration bundle to AWS S3",
680
718
  false
@@ -700,7 +738,7 @@ cli.command("serve").description("Run a local web server for pre-built bundle").
700
738
  });
701
739
  cli.command("deploy").description(
702
740
  "Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3"
703
- ).option("--ci", "CI environment", false).option(
741
+ ).option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option(
704
742
  "--tag <tag>",
705
743
  "Tag which should be used for the deployment of the bundle",
706
744
  DEFAULT_TAG
@@ -709,17 +747,19 @@ cli.command("deploy").description(
709
747
  });
710
748
  cli.command("list-deployed").description(
711
749
  "List deployments of Tamaro Core or a particular customer configuration"
712
- ).option("--ci", "CI environment", false).option(
750
+ ).option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option(
713
751
  "--config <config>",
714
752
  "Configuration name (default: current customer configuration)"
715
753
  ).action(async (options) => {
716
754
  await listDeployed(options);
717
755
  });
718
- cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").option("--ci", "CI environment", false).action(async (options) => {
756
+ 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) => {
719
757
  await deployEmailConfig(options);
720
758
  });
721
759
  (async () => {
722
760
  try {
761
+ logTitle(`${package_default.name} ${package_default.version}
762
+ `);
723
763
  await cli.parseAsync(process.argv);
724
764
  } catch (error) {
725
765
  if (error.signal === "SIGINT" && error.signalDescription) {
@@ -10,7 +10,7 @@ import {
10
10
  logTitle,
11
11
  moduleFileExtensions,
12
12
  resolveApp
13
- } from "./chunk-OLKERSRR.js";
13
+ } from "./chunk-KVWFHWZD.js";
14
14
 
15
15
  // src/webpack.config.ts
16
16
  import { existsSync } from "fs";
@@ -81,17 +81,20 @@ var getWebpackConfig = (env) => {
81
81
  logDataTable(getRelativePaths(paths));
82
82
  logTitle("Environment variables:");
83
83
  logDataTable(envVars.raw);
84
- const getCssLoaders = (cssOptions = {}) => {
84
+ const getCssLoaders = ({
85
+ styleLoader = true,
86
+ ...cssOptions
87
+ }) => {
85
88
  return removeEmpty([
86
- ifMin({ loader: MiniCssExtractPlugin.loader }),
87
- ifNotMin({
89
+ styleLoader ? ifMin({ loader: MiniCssExtractPlugin.loader }) : void 0,
90
+ styleLoader ? ifNotMin({
88
91
  loader: require2.resolve("style-loader"),
89
92
  options: {
90
93
  attributes: {
91
94
  "data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
92
95
  }
93
96
  }
94
- }),
97
+ }) : void 0,
95
98
  {
96
99
  loader: require2.resolve("css-loader"),
97
100
  options: {
@@ -175,8 +178,10 @@ var getWebpackConfig = (env) => {
175
178
  }),
176
179
  {
177
180
  oneOf: [
178
- // App Javascript and Typescript (Babel)
179
- // and some dependencies distributed in a non-es5 formats
181
+ /**
182
+ * App Javascript and Typescript (Babel)
183
+ * and some dependencies distributed in a non-es5 formats
184
+ */
180
185
  {
181
186
  test: /\.(js|ts)x?$/,
182
187
  include: ifCore(
@@ -233,19 +238,22 @@ var getWebpackConfig = (env) => {
233
238
  {
234
239
  test: /\.(js|mjs)$/
235
240
  },
236
- // Styles (not modules)
241
+ // Styles (extracted)
237
242
  {
238
243
  test: /\.s?css$/,
239
- exclude: /\.module\.s?css$/,
244
+ resourceQuery: { not: [/inline/] },
240
245
  use: getCssLoaders({
241
- modules: false
246
+ styleLoader: true
242
247
  })
243
248
  },
244
- // Styles (modules)
249
+ // Styles (as string)
245
250
  {
246
- test: /\.module\.s?css$/,
251
+ test: /\.s?css$/,
252
+ resourceQuery: /inline/,
247
253
  use: getCssLoaders({
248
- modules: { localIdentName: "[local]__[hash:base64]" }
254
+ styleLoader: false,
255
+ exportType: "string",
256
+ sourceMap: false
249
257
  })
250
258
  },
251
259
  // Images and fonts
@@ -277,8 +285,10 @@ var getWebpackConfig = (env) => {
277
285
  minimize: false
278
286
  }
279
287
  },
280
- // All other files - fallback
281
- // This must be the latest rule!
288
+ /**
289
+ * All other files - fallback
290
+ * This must be the latest rule!
291
+ */
282
292
  {
283
293
  exclude: [/^$/, /\.(js|jsx|ts|tsx|mjs)$/, /\.html$/, /\.json$/],
284
294
  type: "asset/resource"