@raisenow/tamaro-cli 1.3.0 → 1.4.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/README.md CHANGED
@@ -112,6 +112,7 @@ Build an optimised (minified) bundle of _Tamaro Core_ or a customer configuratio
112
112
  - `--env <env>` – Environment (dev, stage, prod)
113
113
  - `--deploy` – Deploy _Tamaro Core_ or a customer configuration bundle to AWS S3
114
114
  - `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: "latest")
115
+ - `--dryrun` – Displays the operations that would be performed using the specified command without actually running them.
115
116
 
116
117
  ### Build and deploy a customer configuration
117
118
 
@@ -75,6 +75,24 @@ var resolveModule = (resolveFn, filePath) => {
75
75
  }
76
76
  return resolveFn(`${filePath}.js`);
77
77
  };
78
+ var resolveEslintPluginConfig = (paths) => {
79
+ try {
80
+ const opts = { paths: [paths.appNodeModules] };
81
+ const eslintPath = require2.resolve("eslint", opts);
82
+ const pkg = require2(require2.resolve("eslint/package.json", opts));
83
+ const version = pkg.version;
84
+ const configType = version.startsWith("8.") ? "eslintrc" : "flat";
85
+ return {
86
+ extensions: moduleFileExtensions,
87
+ eslintPath,
88
+ cwd: paths.app,
89
+ configType
90
+ };
91
+ } catch (error) {
92
+ console.error(error);
93
+ return void 0;
94
+ }
95
+ };
78
96
  var resolveBin = (name) => {
79
97
  const pkgPath = require2.resolve(`${name}/package.json`);
80
98
  const { bin } = require2(pkgPath);
@@ -282,10 +300,10 @@ export {
282
300
  AWS_CLOUDFRONT_DISTRIBUTION_ID,
283
301
  HTTPS_CRT_FILE,
284
302
  HTTPS_KEY_FILE,
285
- moduleFileExtensions,
286
303
  extensions,
287
304
  resolveApp,
288
305
  resolveOwn,
306
+ resolveEslintPluginConfig,
289
307
  resolveBin,
290
308
  getWidgetUuid,
291
309
  getPaths,
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  resolveBin,
23
23
  resolveOwn,
24
24
  runCommandSync
25
- } from "./chunk-H4BMVFM6.js";
25
+ } from "./chunk-YWUYAGB6.js";
26
26
 
27
27
  // src/cli.ts
28
28
  import { createCommand } from "commander";
@@ -353,16 +353,21 @@ var deploy = async (options) => {
353
353
  await validate();
354
354
  awsAuthenticate(options);
355
355
  const flags = prepareFlags(options);
356
- const { tag } = options;
356
+ const { tag, dryrun } = options;
357
+ const dryRunFlag = dryrun ? `--dryrun` : "";
357
358
  const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid());
358
359
  const deployUrl = `s3://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}`;
359
360
  const entryFilename = ifCore("index.js", "widget.js");
361
+ if (dryRunFlag) {
362
+ logTitle("\u{1F9EA} DRY RUN MODE - No actual changes will be made \u{1F9EA}");
363
+ }
360
364
  const cmdSyncAll = `
361
365
  aws s3 sync ${paths.appDist} ${deployUrl}
362
366
  --acl public-read
363
367
  --exclude ${paths.appDist}/${entryFilename}
364
368
  --cache-control max-age=31536000
365
369
  ${flags}
370
+ ${dryRunFlag}
366
371
  `;
367
372
  logTitle("Deploying to AWS S3 \u2026");
368
373
  logCommand(cmdSyncAll);
@@ -376,6 +381,7 @@ var deploy = async (options) => {
376
381
  --acl public-read
377
382
  --cache-control max-age=64800
378
383
  ${flags}
384
+ ${dryRunFlag}
379
385
  `;
380
386
  logCommand(cmdCpEntry);
381
387
  try {
@@ -383,18 +389,20 @@ var deploy = async (options) => {
383
389
  } catch (error) {
384
390
  halt(error.stderr);
385
391
  }
386
- const cmdInvalidateCache = `
392
+ if (!dryRunFlag) {
393
+ const cmdInvalidateCache = `
387
394
  aws cloudfront create-invalidation
388
395
  --distribution-id ${AWS_CLOUDFRONT_DISTRIBUTION_ID}
389
396
  --paths /${configName}/${tag}/*
390
397
  ${flags}
391
398
  `;
392
- logTitle("\nInvalidating edge cache \u2026");
393
- logCommand(cmdInvalidateCache);
394
- try {
395
- runCommandSync(cmdInvalidateCache);
396
- } catch (error) {
397
- halt(error.stderr);
399
+ logTitle("\nInvalidating edge cache \u2026");
400
+ logCommand(cmdInvalidateCache);
401
+ try {
402
+ runCommandSync(cmdInvalidateCache);
403
+ } catch (error) {
404
+ halt(error.stderr);
405
+ }
398
406
  }
399
407
  const demoPage = `https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/index.html`;
400
408
  const entryPoint = `https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/${entryFilename}`;
@@ -461,13 +469,18 @@ var deployEmailConfig = async (options) => {
461
469
  await validate();
462
470
  awsAuthenticate(options);
463
471
  const flags = prepareFlags(options);
472
+ const dryRunFlag = options.dryrun ? `--dryrun` : "";
464
473
  const configName = getWidgetUuid();
465
474
  const deployUrl = `s3://${options.bucket}/${configName}`;
475
+ if (dryRunFlag) {
476
+ logTitle("\u{1F9EA} DRY RUN MODE - No actual changes will be made \u{1F9EA}");
477
+ }
466
478
  const cmd = `
467
479
  aws s3 sync ${emailConfigPath} ${deployUrl}
468
480
  --delete
469
481
  --exact-timestamps
470
482
  ${flags}
483
+ ${dryRunFlag}
471
484
  `;
472
485
  logTitle(
473
486
  `Deploying email configuration for "${configName}" customer configuration to AWS S3 \u2026`
@@ -701,7 +714,7 @@ var prepareFlags4 = async (options) => {
701
714
  // package.json
702
715
  var package_default = {
703
716
  name: "@raisenow/tamaro-cli",
704
- version: "1.3.0",
717
+ version: "1.4.1",
705
718
  author: {
706
719
  name: "RaiseNow",
707
720
  email: "development@raisenow.com"
@@ -773,7 +786,7 @@ var package_default = {
773
786
  "eslint-plugin-promise": "^7.2.1",
774
787
  "eslint-plugin-unused-imports": "^3.2.0",
775
788
  "eslint-plugin-yml": "^1.18.0",
776
- "eslint-webpack-plugin": "^4.2.0",
789
+ "eslint-webpack-plugin": "^5.0.2",
777
790
  execa: "^9.6.0",
778
791
  "file-loader": "^6.2.0",
779
792
  "fork-ts-checker-webpack-plugin": "^9.1.0",
@@ -798,7 +811,6 @@ var package_default = {
798
811
  "resolve-url-loader": "^5.0.0",
799
812
  sass: "^1.89.2",
800
813
  "sass-loader": "^16.0.5",
801
- "source-map-loader": "^5.0.0",
802
814
  "strip-indent": "^4.0.0",
803
815
  "style-loader": "^4.0.0",
804
816
  "tsconfig-paths-webpack-plugin": "^4.2.0",
@@ -875,6 +887,10 @@ cli.command("deploy").description(
875
887
  "--tag <tag>",
876
888
  "Tag which should be used for the deployment of the bundle",
877
889
  DEFAULT_TAG
890
+ ).option(
891
+ "--dryrun",
892
+ "Displays the operations that would be performed without actually running them",
893
+ false
878
894
  ).action(async (options) => {
879
895
  await deploy(options);
880
896
  });
@@ -886,7 +902,11 @@ cli.command("list-deployed").description(
886
902
  ).action(async (options) => {
887
903
  await listDeployed(options);
888
904
  });
889
- 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) => {
905
+ 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").option(
906
+ "--dryrun",
907
+ "Displays the operations that would be performed without actually running them",
908
+ false
909
+ ).action(async (options) => {
890
910
  await deployEmailConfig(options);
891
911
  });
892
912
  cli.command("validate").description(
@@ -8,9 +8,9 @@ import {
8
8
  getRelativePaths,
9
9
  logDataTable,
10
10
  logTitle,
11
- moduleFileExtensions,
12
- resolveApp
13
- } from "./chunk-H4BMVFM6.js";
11
+ resolveApp,
12
+ resolveEslintPluginConfig
13
+ } from "./chunk-YWUYAGB6.js";
14
14
 
15
15
  // src/webpack.config.ts
16
16
  import { existsSync } from "fs";
@@ -77,6 +77,7 @@ var getWebpackConfig = (env) => {
77
77
  const { ifHmr } = getIfUtils({ hmr: process.env.HMR_ENABLED === "true" }, ["hmr"]);
78
78
  const { ifNolint } = getIfUtils(env, ["nolint"]);
79
79
  const useTailwind = ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig);
80
+ const eslintPluginConfig = resolveEslintPluginConfig(paths);
80
81
  logTitle("Paths:");
81
82
  logDataTable(getRelativePaths(paths));
82
83
  logTitle("Environment variables:");
@@ -173,13 +174,6 @@ var getWebpackConfig = (env) => {
173
174
  ),
174
175
  module: {
175
176
  rules: removeEmpty([
176
- // Source maps
177
- ifNotMin({
178
- enforce: "pre",
179
- exclude: /@babel\/runtime/,
180
- test: /\.(js|jsx|ts|tsx|css|scss)$/,
181
- use: require2.resolve("source-map-loader")
182
- }),
183
177
  {
184
178
  oneOf: [
185
179
  /**
@@ -363,15 +357,12 @@ var getWebpackConfig = (env) => {
363
357
  },
364
358
  plugins: removeEmpty([
365
359
  new webpack.ProgressPlugin(),
366
- ifNolint(
367
- false,
368
- new ESLintPlugin({
369
- extensions: moduleFileExtensions,
370
- eslintPath: require2.resolve("eslint"),
371
- cwd: paths.app,
372
- resolvePluginsRelativeTo: paths.app
373
- })
374
- ),
360
+ /**
361
+ * Skip ESLint plugin if either:
362
+ * - It's disabled with "nolint" flag.
363
+ * - No ESLint configuration is resolved.
364
+ */
365
+ ifNolint() || !eslintPluginConfig ? void 0 : new ESLintPlugin(eslintPluginConfig),
375
366
  ifMin(
376
367
  new CleanWebpackPlugin({
377
368
  // verbose: true,
package/package.json CHANGED
@@ -1,32 +1,18 @@
1
1
  {
2
2
  "name": "@raisenow/tamaro-cli",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "author": {
5
5
  "name": "RaiseNow",
6
6
  "email": "development@raisenow.com"
7
7
  },
8
8
  "type": "module",
9
9
  "bin": "dist/cli.js",
10
- "packageManager": "pnpm@10.13.1",
11
10
  "engines": {
12
11
  "node": ">=22",
13
12
  "pnpm": ">= 10",
14
13
  "npm": "please-use-pnpm",
15
14
  "yarn": "please-use-pnpm"
16
15
  },
17
- "scripts": {
18
- "prepare": "pnpm build",
19
- "typecheck": "tsc --noEmit",
20
- "build": "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
21
- "build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
22
- "readme": "pnpx http-server . --cors -o /readme.html",
23
- "lint": "DEBUG=eslint:cli-engine eslint .",
24
- "lint:fix": "DEBUG=eslint:cli-engine eslint --fix .",
25
- "format": "prettier --write .",
26
- "test": "vitest",
27
- "test:watch": "vitest --watch",
28
- "test:coverage": "vitest --coverage"
29
- },
30
16
  "dependencies": {
31
17
  "@babel/cli": "^7.28.0",
32
18
  "@babel/core": "^7.28.0",
@@ -72,7 +58,7 @@
72
58
  "eslint-plugin-promise": "^7.2.1",
73
59
  "eslint-plugin-unused-imports": "^3.2.0",
74
60
  "eslint-plugin-yml": "^1.18.0",
75
- "eslint-webpack-plugin": "^4.2.0",
61
+ "eslint-webpack-plugin": "^5.0.2",
76
62
  "execa": "^9.6.0",
77
63
  "file-loader": "^6.2.0",
78
64
  "fork-ts-checker-webpack-plugin": "^9.1.0",
@@ -97,7 +83,6 @@
97
83
  "resolve-url-loader": "^5.0.0",
98
84
  "sass": "^1.89.2",
99
85
  "sass-loader": "^16.0.5",
100
- "source-map-loader": "^5.0.0",
101
86
  "strip-indent": "^4.0.0",
102
87
  "style-loader": "^4.0.0",
103
88
  "tsconfig-paths-webpack-plugin": "^4.2.0",
@@ -110,5 +95,17 @@
110
95
  "webpack-config-utils": "^2.3.1",
111
96
  "webpack-dev-server": "^5.2.2",
112
97
  "yaml-loader": "^0.8.1"
98
+ },
99
+ "scripts": {
100
+ "typecheck": "tsc --noEmit",
101
+ "build": "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
102
+ "build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
103
+ "readme": "pnpx http-server . --cors -o /readme.html",
104
+ "lint": "DEBUG=eslint:cli-engine eslint .",
105
+ "lint:fix": "DEBUG=eslint:cli-engine eslint --fix .",
106
+ "format": "prettier --write .",
107
+ "test": "vitest",
108
+ "test:watch": "vitest --watch",
109
+ "test:coverage": "vitest --coverage"
113
110
  }
114
- }
111
+ }