@storm-software/workspace-tools 1.41.0 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.41.0",
3
+ "version": "1.42.0",
4
4
  "private": false,
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "keywords": [
@@ -45,6 +45,8 @@
45
45
  "esbuild-plugin-pino": "^2.1.0",
46
46
  "fs-extra": "^11.1.1",
47
47
  "glob": "^10.3.10",
48
+ "prettier": "3.0.3",
49
+ "prettier-plugin-packagejson": "^2.4.9",
48
50
  "resolve": "^1.22.8",
49
51
  "resolve-from": "^5.0.0",
50
52
  "rollup": "^4.5.0",
package/src/base/index.js CHANGED
@@ -43541,7 +43541,9 @@ var getConfigFile = async (filePath) => {
43541
43541
  return void 0;
43542
43542
  }
43543
43543
  const config = cosmiconfigResult.config ?? {};
43544
- cosmiconfigResult.filepath && (config.configFile = cosmiconfigResult.filepath);
43544
+ if (cosmiconfigResult.filepath) {
43545
+ config.configFile = cosmiconfigResult.filepath;
43546
+ }
43545
43547
  config.runtimeVersion = "0.0.1";
43546
43548
  _static_cache = config;
43547
43549
  return config;
@@ -47645,14 +47647,13 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
47645
47647
  var withRunExecutor = (name, executorFn, executorOptions = {
47646
47648
  skipReadingConfig: false,
47647
47649
  hooks: {}
47648
- }) => async (options, context) => {
47650
+ }) => async (_options, context) => {
47649
47651
  const startTime = Date.now();
47652
+ let options = _options;
47650
47653
  try {
47651
- console.info(
47652
- chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
47654
+ console.info(chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
47653
47655
 
47654
- `)
47655
- );
47656
+ `));
47656
47657
  if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
47657
47658
  throw new Error(
47658
47659
  "The Build process failed because the context is not valid. Please run this command from a workspace."
@@ -47677,19 +47678,11 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
47677
47678
  );
47678
47679
  }
47679
47680
  if (executorOptions?.hooks?.applyDefaultOptions) {
47680
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Running the applyDefaultOptions hook...`));
47681
- options = await Promise.resolve(
47682
- executorOptions.hooks.applyDefaultOptions(options, config)
47683
- );
47684
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the applyDefaultOptions hook...`));
47681
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the applyDefaultOptions hook..."));
47682
+ options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
47683
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the applyDefaultOptions hook..."));
47685
47684
  }
47686
- getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(
47687
- chalk.hex("#0ea5e9").italic(`
47688
-
47689
- \u2699\uFE0F Executor schema options:
47690
- `),
47691
- options
47692
- );
47685
+ getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(chalk.hex("#0ea5e9").italic("\n\n \u2699\uFE0F Executor schema options: \n"), options);
47693
47686
  const tokenized = applyWorkspaceTokens(
47694
47687
  options,
47695
47688
  {
@@ -47704,44 +47697,34 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
47704
47697
  applyWorkspaceExecutorTokens
47705
47698
  );
47706
47699
  if (executorOptions?.hooks?.preProcess) {
47707
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Running the preProcess hook...`));
47708
- await Promise.resolve(
47709
- executorOptions.hooks.preProcess(tokenized, config)
47710
- );
47711
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the preProcess hook...`));
47700
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the preProcess hook..."));
47701
+ await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
47702
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the preProcess hook..."));
47712
47703
  }
47713
- const result = await Promise.resolve(
47714
- executorFn(tokenized, context, config)
47715
- );
47704
+ const result = await Promise.resolve(executorFn(tokenized, context, config));
47716
47705
  if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
47717
47706
  throw new Error(`The ${name} executor failed to run`, {
47718
- cause: result.error
47707
+ cause: result?.error
47719
47708
  });
47720
47709
  }
47721
47710
  if (executorOptions?.hooks?.postProcess) {
47722
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Running the postProcess hook...`));
47711
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the postProcess hook..."));
47723
47712
  await Promise.resolve(executorOptions.hooks.postProcess(config));
47724
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the postProcess hook...`));
47713
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the postProcess hook..."));
47725
47714
  }
47726
47715
  console.info(
47727
- chalk.bold.hex("#087f5b")(
47728
- `
47716
+ chalk.bold.hex("#087f5b")(`
47729
47717
 
47730
47718
  \u{1F389} Successfully completed running the ${name} executor!
47731
47719
 
47732
- `
47733
- )
47720
+ `)
47734
47721
  );
47735
47722
  return {
47736
47723
  success: true
47737
47724
  };
47738
47725
  } catch (error) {
47739
47726
  console.error(
47740
- chalk.bold.hex("#7d1a1a")(
47741
- `\u274C An error occurred while running the executor
47742
-
47743
- `
47744
- ),
47727
+ chalk.bold.hex("#7d1a1a")("\u274C An error occurred while running the executor\n\n"),
47745
47728
  error
47746
47729
  );
47747
47730
  return {
@@ -61457,7 +61457,9 @@ var getConfigFile = async (filePath) => {
61457
61457
  return void 0;
61458
61458
  }
61459
61459
  const config = cosmiconfigResult.config ?? {};
61460
- cosmiconfigResult.filepath && (config.configFile = cosmiconfigResult.filepath);
61460
+ if (cosmiconfigResult.filepath) {
61461
+ config.configFile = cosmiconfigResult.filepath;
61462
+ }
61461
61463
  config.runtimeVersion = "0.0.1";
61462
61464
  _static_cache = config;
61463
61465
  return config;
@@ -65535,14 +65537,13 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
65535
65537
  var withRunExecutor = (name, executorFn, executorOptions = {
65536
65538
  skipReadingConfig: false,
65537
65539
  hooks: {}
65538
- }) => async (options, context) => {
65540
+ }) => async (_options, context) => {
65539
65541
  const startTime = Date.now();
65542
+ let options = _options;
65540
65543
  try {
65541
- console.info(
65542
- chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
65544
+ console.info(chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
65543
65545
 
65544
- `)
65545
- );
65546
+ `));
65546
65547
  if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
65547
65548
  throw new Error(
65548
65549
  "The Build process failed because the context is not valid. Please run this command from a workspace."
@@ -65567,19 +65568,11 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
65567
65568
  );
65568
65569
  }
65569
65570
  if (executorOptions?.hooks?.applyDefaultOptions) {
65570
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Running the applyDefaultOptions hook...`));
65571
- options = await Promise.resolve(
65572
- executorOptions.hooks.applyDefaultOptions(options, config)
65573
- );
65574
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the applyDefaultOptions hook...`));
65571
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the applyDefaultOptions hook..."));
65572
+ options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
65573
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the applyDefaultOptions hook..."));
65575
65574
  }
65576
- getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(
65577
- chalk.hex("#0ea5e9").italic(`
65578
-
65579
- \u2699\uFE0F Executor schema options:
65580
- `),
65581
- options
65582
- );
65575
+ getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(chalk.hex("#0ea5e9").italic("\n\n \u2699\uFE0F Executor schema options: \n"), options);
65583
65576
  const tokenized = applyWorkspaceTokens(
65584
65577
  options,
65585
65578
  {
@@ -65594,44 +65587,34 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
65594
65587
  applyWorkspaceExecutorTokens
65595
65588
  );
65596
65589
  if (executorOptions?.hooks?.preProcess) {
65597
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Running the preProcess hook...`));
65598
- await Promise.resolve(
65599
- executorOptions.hooks.preProcess(tokenized, config)
65600
- );
65601
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the preProcess hook...`));
65590
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the preProcess hook..."));
65591
+ await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
65592
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the preProcess hook..."));
65602
65593
  }
65603
- const result = await Promise.resolve(
65604
- executorFn(tokenized, context, config)
65605
- );
65594
+ const result = await Promise.resolve(executorFn(tokenized, context, config));
65606
65595
  if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
65607
65596
  throw new Error(`The ${name} executor failed to run`, {
65608
- cause: result.error
65597
+ cause: result?.error
65609
65598
  });
65610
65599
  }
65611
65600
  if (executorOptions?.hooks?.postProcess) {
65612
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Running the postProcess hook...`));
65601
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the postProcess hook..."));
65613
65602
  await Promise.resolve(executorOptions.hooks.postProcess(config));
65614
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the postProcess hook...`));
65603
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the postProcess hook..."));
65615
65604
  }
65616
65605
  console.info(
65617
- chalk.bold.hex("#087f5b")(
65618
- `
65606
+ chalk.bold.hex("#087f5b")(`
65619
65607
 
65620
65608
  \u{1F389} Successfully completed running the ${name} executor!
65621
65609
 
65622
- `
65623
- )
65610
+ `)
65624
65611
  );
65625
65612
  return {
65626
65613
  success: true
65627
65614
  };
65628
65615
  } catch (error) {
65629
65616
  console.error(
65630
- chalk.bold.hex("#7d1a1a")(
65631
- `\u274C An error occurred while running the executor
65632
-
65633
- `
65634
- ),
65617
+ chalk.bold.hex("#7d1a1a")("\u274C An error occurred while running the executor\n\n"),
65635
65618
  error
65636
65619
  );
65637
65620
  return {