@powerlines/nx 0.13.124 → 0.13.125

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.
@@ -1,11 +1,11 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { BaseExecutorSchema } from "./base-executor.schema.mjs";
4
+ import { ExecutionOptions, InlineConfig } from "powerlines";
4
5
  import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
5
6
  import { StormWorkspaceConfig } from "@storm-software/config/types";
6
7
  import { BaseExecutorResult } from "@storm-software/workspace-tools/types";
7
8
  import { DeepPartial } from "@stryke/types/base";
8
- import { ExecutionOptions, InlineConfig } from "powerlines";
9
9
 
10
10
  //#region src/base/base-executor.d.ts
11
11
  type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema> = ExecutorContext & {
@@ -16,6 +16,21 @@ type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = Base
16
16
  workspaceConfig: StormWorkspaceConfig;
17
17
  };
18
18
  type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
19
+ interface WithExecutorOptions {
20
+ /**
21
+ * The import path for the executor API module, which is used to dynamically import the API function that will be called during execution. This value should be a string representing the module path, and it defaults to "powerlines/api" if not provided. The specified module should export a default function that matches the expected signature for the executor API, which will be invoked with the execution parameters when the executor is run.
22
+ *
23
+ * @defaultValue "powerlines/api"
24
+ */
25
+ importPath?: string;
26
+ /**
27
+ * Default options to be merged with the execution options, which can be used to provide default values for certain execution parameters or to override specific options for all executions of the executor. This value should be an object that matches the shape of the `ExecutionOptions` type, and it will be merged with the options provided during execution to create the final set of options that will be passed to the executor API function.
28
+ *
29
+ * @remarks
30
+ * This can be useful for setting default values for options that are commonly used across multiple executions, or for providing a consistent set of options for all executions of the executor without requiring the caller to specify them each time.
31
+ */
32
+ defaultOptions?: DeepPartial<ExecutionOptions>;
33
+ }
19
34
  /**
20
35
  * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
21
36
  *
@@ -24,10 +39,10 @@ type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
24
39
  *
25
40
  * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
26
41
  * @param executorFn - The function that will be executed when the command is run.
27
- * @param defaultOptions - Default options to be merged with the execution options.
42
+ * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
28
43
  * @returns A Promise that resolves to the result of the executor function.
29
44
  */
30
- declare function withExecutor<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema>(command: string, executorFn: (context: PowerlinesExecutorContext<TExecutorSchema>, api: PowerlinesExecutorApi) => Promise<BaseExecutorResult | null | undefined> | BaseExecutorResult | null | undefined, defaultOptions?: DeepPartial<ExecutionOptions>): PromiseExecutor<TExecutorSchema>;
45
+ declare function withExecutor<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema>(command: string, executorFn: (context: PowerlinesExecutorContext<TExecutorSchema>, api: PowerlinesExecutorApi) => Promise<BaseExecutorResult | null | undefined> | BaseExecutorResult | null | undefined, options?: WithExecutorOptions): PromiseExecutor<TExecutorSchema>;
31
46
  //#endregion
32
- export { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor };
47
+ export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
33
48
  //# sourceMappingURL=base-executor.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-executor.d.mts","names":[],"sources":["../../../src/base/base-executor.ts"],"mappings":";;;;;;;;;;KA0CY,yBAAA,yBACc,kBAAA,GAAqB,kBAAA,IAC3C,eAAA;EACF,WAAA;EACA,OAAA;EACA,OAAA,EAAS,eAAA;EACT,YAAA,EAAc,YAAA;EACd,eAAA,EAAiB,oBAAA;AAAA;AAAA,KAGP,qBAAA,IACV,YAAA,EAAc,YAAA,KACX,OAAO;;;AAZZ;;;;;;;;;iBAyBgB,YAAA,yBACU,kBAAA,GAAqB,kBAAA,CAAA,CAE7C,OAAA,UACA,UAAA,GACE,OAAA,EAAS,yBAAA,CAA0B,eAAA,GACnC,GAAA,EAAK,qBAAA,KAEH,OAAA,CAAQ,kBAAA,uBACR,kBAAA,qBAGJ,cAAA,GAAgB,WAAA,CAAY,gBAAA,IAC3B,eAAA,CAAgB,eAAA"}
1
+ {"version":3,"file":"base-executor.d.mts","names":[],"sources":["../../../src/base/base-executor.ts"],"mappings":";;;;;;;;;;KA2CY,yBAAA,yBACc,kBAAA,GAAqB,kBAAA,IAC3C,eAAA;EACF,WAAA;EACA,OAAA;EACA,OAAA,EAAS,eAAA;EACT,YAAA,EAAc,YAAA;EACd,eAAA,EAAiB,oBAAA;AAAA;AAAA,KAGP,qBAAA,IACV,YAAA,EAAc,YAAA,KACX,OAAO;AAAA,UAEK,mBAAA;;AAdjB;;;;EAoBE,UAAA;EAlBE;;;;;;EA0BF,cAAA,GAAiB,WAAW,CAAC,gBAAA;AAAA;;;;;;;;;;;;iBAcf,YAAA,yBACU,kBAAA,GAAqB,kBAAA,CAAA,CAE7C,OAAA,UACA,UAAA,GACE,OAAA,EAAS,yBAAA,CAA0B,eAAA,GACnC,GAAA,EAAK,qBAAA,KAEH,OAAA,CAAQ,kBAAA,uBACR,kBAAA,qBAGJ,OAAA,GAAS,mBAAA,GACR,eAAA,CAAgB,eAAA"}
@@ -14,6 +14,21 @@ type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = Base
14
14
  workspaceConfig: StormWorkspaceConfig;
15
15
  };
16
16
  type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
17
+ interface WithExecutorOptions {
18
+ /**
19
+ * The import path for the executor API module, which is used to dynamically import the API function that will be called during execution. This value should be a string representing the module path, and it defaults to "powerlines/api" if not provided. The specified module should export a default function that matches the expected signature for the executor API, which will be invoked with the execution parameters when the executor is run.
20
+ *
21
+ * @defaultValue "powerlines/api"
22
+ */
23
+ importPath?: string;
24
+ /**
25
+ * Default options to be merged with the execution options, which can be used to provide default values for certain execution parameters or to override specific options for all executions of the executor. This value should be an object that matches the shape of the `ExecutionOptions` type, and it will be merged with the options provided during execution to create the final set of options that will be passed to the executor API function.
26
+ *
27
+ * @remarks
28
+ * This can be useful for setting default values for options that are commonly used across multiple executions, or for providing a consistent set of options for all executions of the executor without requiring the caller to specify them each time.
29
+ */
30
+ defaultOptions?: DeepPartial<ExecutionOptions>;
31
+ }
17
32
  /**
18
33
  * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
19
34
  *
@@ -22,10 +37,10 @@ type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
22
37
  *
23
38
  * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
24
39
  * @param executorFn - The function that will be executed when the command is run.
25
- * @param defaultOptions - Default options to be merged with the execution options.
40
+ * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
26
41
  * @returns A Promise that resolves to the result of the executor function.
27
42
  */
28
- declare function withExecutor<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema>(command: string, executorFn: (context: PowerlinesExecutorContext<TExecutorSchema>, api: PowerlinesExecutorApi) => Promise<BaseExecutorResult | null | undefined> | BaseExecutorResult | null | undefined, defaultOptions?: DeepPartial<ExecutionOptions>): PromiseExecutor<TExecutorSchema>;
43
+ declare function withExecutor<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema>(command: string, executorFn: (context: PowerlinesExecutorContext<TExecutorSchema>, api: PowerlinesExecutorApi) => Promise<BaseExecutorResult | null | undefined> | BaseExecutorResult | null | undefined, options?: WithExecutorOptions): PromiseExecutor<TExecutorSchema>;
29
44
  //#endregion
30
- export { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor };
45
+ export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
31
46
  //# sourceMappingURL=base-executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-executor.d.ts","names":[],"sources":["../../../src/base/base-executor.ts"],"mappings":";;;;;;;;KA0CY,yBAAA,yBACc,kBAAA,GAAqB,kBAAA,IAC3C,eAAA;EACF,WAAA;EACA,OAAA;EACA,OAAA,EAAS,eAAA;EACT,YAAA,EAAc,YAAA;EACd,eAAA,EAAiB,oBAAA;AAAA;AAAA,KAGP,qBAAA,IACV,YAAA,EAAc,YAAA,KACX,OAAO;;;;;;;;;;;;iBAaI,YAAA,yBACU,kBAAA,GAAqB,kBAAA,CAAA,CAE7C,OAAA,UACA,UAAA,GACE,OAAA,EAAS,yBAAA,CAA0B,eAAA,GACnC,GAAA,EAAK,qBAAA,KAEH,OAAA,CAAQ,kBAAA,uBACR,kBAAA,qBAGJ,cAAA,GAAgB,WAAA,CAAY,gBAAA,IAC3B,eAAA,CAAgB,eAAA"}
1
+ {"version":3,"file":"base-executor.d.ts","names":[],"sources":["../../../src/base/base-executor.ts"],"mappings":";;;;;;;;KA2CY,yBAAA,yBACc,kBAAA,GAAqB,kBAAA,IAC3C,eAAA;EACF,WAAA;EACA,OAAA;EACA,OAAA,EAAS,eAAA;EACT,YAAA,EAAc,YAAA;EACd,eAAA,EAAiB,oBAAA;AAAA;AAAA,KAGP,qBAAA,IACV,YAAA,EAAc,YAAA,KACX,OAAO;AAAA,UAEK,mBAAA;EARD;;;;;EAcd,UAAA;EAnB6C;;;;;;EA2B7C,cAAA,GAAiB,WAAW,CAAC,gBAAA;AAAA;;;;AArBQ;AAGvC;;;;;;;iBAgCgB,YAAA,yBACU,kBAAA,GAAqB,kBAAA,CAAA,CAE7C,OAAA,UACA,UAAA,GACE,OAAA,EAAS,yBAAA,CAA0B,eAAA,GACnC,GAAA,EAAK,qBAAA,KAEH,OAAA,CAAQ,kBAAA,uBACR,kBAAA,qBAGJ,OAAA,GAAS,mBAAA,GACR,eAAA,CAAgB,eAAA"}
@@ -20,6 +20,7 @@ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-obje
20
20
  let defu = require("defu");
21
21
  defu = require_runtime.__toESM(defu);
22
22
  let jiti = require("jiti");
23
+ let powerlines = require("powerlines");
23
24
 
24
25
  //#region src/base/base-executor.ts
25
26
  /**
@@ -30,10 +31,11 @@ let jiti = require("jiti");
30
31
  *
31
32
  * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
32
33
  * @param executorFn - The function that will be executed when the command is run.
33
- * @param defaultOptions - Default options to be merged with the execution options.
34
+ * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
34
35
  * @returns A Promise that resolves to the result of the executor function.
35
36
  */
36
- function withExecutor(command, executorFn, defaultOptions = {}) {
37
+ function withExecutor(command, executorFn, options = {}) {
38
+ const { importPath = "powerlines/api", defaultOptions = {} } = options;
37
39
  return (0, _storm_software_workspace_tools_base_base_executor.withRunExecutor)(`Powerlines - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor`, async (options, context, workspaceConfig) => {
38
40
  if (!context.projectName) throw new Error(`The Powerlines - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor requires \`projectName\` on the context object.`);
39
41
  if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) throw new Error(`The Powerlines - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor requires \`projectsConfigurations\` on the context object.`);
@@ -42,7 +44,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
42
44
  cache: false,
43
45
  tsconfigPaths: true
44
46
  });
45
- const api = await jiti$1.import(jiti$1.esmResolve("powerlines/api")).then((mod) => mod.default);
47
+ const api = await jiti$1.import(jiti$1.esmResolve(importPath)).then((mod) => mod.default);
46
48
  try {
47
49
  return await Promise.resolve(executorFn((0, defu.default)({
48
50
  projectName: context.projectName,
@@ -90,7 +92,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
90
92
  ]))
91
93
  }, context), async (inlineConfig) => api({
92
94
  options: (0, defu.default)(defaultOptions, {
93
- executionId: `${context.projectName}-${command}-${options.configIndex}`,
95
+ executionId: (0, powerlines.formatExecutionId)(inlineConfig.name || context.projectName || projectConfig.root, command, options.configIndex ?? 0),
94
96
  cwd: context.root,
95
97
  root: projectConfig.root,
96
98
  configFile: options.configFile || options.config || (0, _stryke_path_join.joinPaths)(projectConfig.root, "powerlines.config.ts"),
@@ -17,6 +17,7 @@ import { isSetArray } from "@stryke/type-checks/is-set-array";
17
17
  import { isSetObject } from "@stryke/type-checks/is-set-object";
18
18
  import defu from "defu";
19
19
  import { createJiti } from "jiti";
20
+ import { formatExecutionId } from "powerlines";
20
21
 
21
22
  //#region src/base/base-executor.ts
22
23
  /**
@@ -27,10 +28,11 @@ import { createJiti } from "jiti";
27
28
  *
28
29
  * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
29
30
  * @param executorFn - The function that will be executed when the command is run.
30
- * @param defaultOptions - Default options to be merged with the execution options.
31
+ * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
31
32
  * @returns A Promise that resolves to the result of the executor function.
32
33
  */
33
- function withExecutor(command, executorFn, defaultOptions = {}) {
34
+ function withExecutor(command, executorFn, options = {}) {
35
+ const { importPath = "powerlines/api", defaultOptions = {} } = options;
34
36
  return withRunExecutor(`Powerlines - ${titleCase(command)} executor`, async (options, context, workspaceConfig) => {
35
37
  if (!context.projectName) throw new Error(`The Powerlines - ${titleCase(command)} executor requires \`projectName\` on the context object.`);
36
38
  if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) throw new Error(`The Powerlines - ${titleCase(command)} executor requires \`projectsConfigurations\` on the context object.`);
@@ -39,7 +41,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
39
41
  cache: false,
40
42
  tsconfigPaths: true
41
43
  });
42
- const api = await jiti.import(jiti.esmResolve("powerlines/api")).then((mod) => mod.default);
44
+ const api = await jiti.import(jiti.esmResolve(importPath)).then((mod) => mod.default);
43
45
  try {
44
46
  return await Promise.resolve(executorFn(defu({
45
47
  projectName: context.projectName,
@@ -87,7 +89,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
87
89
  ]))
88
90
  }, context), async (inlineConfig) => api({
89
91
  options: defu(defaultOptions, {
90
- executionId: `${context.projectName}-${command}-${options.configIndex}`,
92
+ executionId: formatExecutionId(inlineConfig.name || context.projectName || projectConfig.root, command, options.configIndex ?? 0),
91
93
  cwd: context.root,
92
94
  root: projectConfig.root,
93
95
  configFile: options.configFile || options.config || joinPaths(projectConfig.root, "powerlines.config.ts"),
@@ -1 +1 @@
1
- {"version":3,"file":"base-executor.mjs","names":[],"sources":["../../../src/base/base-executor.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ExecutorContext, PromiseExecutor } from \"@nx/devkit\";\nimport { writeError } from \"@storm-software/config-tools/logger\";\nimport { StormWorkspaceConfig } from \"@storm-software/config/types\";\nimport { withRunExecutor } from \"@storm-software/workspace-tools/base/base-executor\";\nimport { BaseExecutorResult } from \"@storm-software/workspace-tools/types\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createJiti } from \"jiti\";\nimport type {\n ExecutionApiParams,\n ExecutionOptions,\n InlineConfig,\n Mode,\n OutputConfig\n} from \"powerlines\";\nimport { BaseExecutorSchema } from \"./base-executor.schema\";\n\nexport type PowerlinesExecutorContext<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n> = ExecutorContext & {\n projectName: string;\n command: string;\n options: TExecutorSchema;\n inlineConfig: InlineConfig;\n workspaceConfig: StormWorkspaceConfig;\n};\n\nexport type PowerlinesExecutorApi = (\n inlineConfig: InlineConfig\n) => Promise<void>;\n\n/**\n * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.\n *\n * @remarks\n * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.\n *\n * @param command - The command that the executor will handle (e.g., \"new\", \"prepare\", \"build\", etc.).\n * @param executorFn - The function that will be executed when the command is run.\n * @param defaultOptions - Default options to be merged with the execution options.\n * @returns A Promise that resolves to the result of the executor function.\n */\nexport function withExecutor<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n>(\n command: string,\n executorFn: (\n context: PowerlinesExecutorContext<TExecutorSchema>,\n api: PowerlinesExecutorApi\n ) =>\n | Promise<BaseExecutorResult | null | undefined>\n | BaseExecutorResult\n | null\n | undefined,\n defaultOptions: DeepPartial<ExecutionOptions> = {}\n): PromiseExecutor<TExecutorSchema> {\n return withRunExecutor(\n `Powerlines - ${titleCase(command)} executor`,\n async (\n options: TExecutorSchema,\n context: ExecutorContext,\n workspaceConfig: StormWorkspaceConfig\n ): Promise<BaseExecutorResult | null | undefined> => {\n if (!context.projectName) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectName\\` on the context object.`\n );\n }\n\n if (\n !context.projectName ||\n !context.projectsConfigurations?.projects ||\n !context.projectsConfigurations.projects[context.projectName] ||\n !context.projectsConfigurations.projects[context.projectName]?.root\n ) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectsConfigurations\\` on the context object.`\n );\n }\n\n const projectConfig =\n context.projectsConfigurations.projects[context.projectName]!;\n\n const jiti = createJiti(context.root, {\n cache: false,\n tsconfigPaths: true\n });\n const api = await jiti\n .import<{\n default: (params: ExecutionApiParams) => Promise<void>;\n }>(jiti.esmResolve(\"powerlines/api\"))\n .then(mod => mod.default);\n\n try {\n return await Promise.resolve(\n executorFn(\n defu(\n {\n projectName: context.projectName,\n options,\n workspaceConfig,\n command,\n inlineConfig: defu(\n {\n name: context.projectName,\n command,\n root: projectConfig.root,\n configFile: options.configFile || options.config,\n configIndex: options.configIndex,\n projectType: projectConfig.projectType,\n mode: options.mode as Mode,\n output: {\n path: options.outputPath,\n copy:\n options.copyPath === false\n ? false\n : {\n path: options.copyPath,\n assets: options.assets\n },\n minify: options.minify,\n sourceMap: options.sourceMap\n } as OutputConfig,\n resolve:\n isSetArray(options.external) ||\n isSetArray(options.noExternal) ||\n isSet(options.skipNodeModulesBundle)\n ? {\n external: isSetArray(options.external)\n ? options.external\n : undefined,\n noExternal: isSetArray(options.noExternal)\n ? options.noExternal\n : undefined,\n skipNodeModulesBundle: isSet(\n options.skipNodeModulesBundle\n )\n ? options.skipNodeModulesBundle\n : undefined\n }\n : undefined,\n define: isSetObject(options.define)\n ? options.define\n : undefined,\n assets: isSetObject(options.assets)\n ? options.assets\n : undefined\n },\n omit(options, [\n \"config\",\n \"configFile\",\n \"outputPath\",\n \"copyPath\",\n \"sourceMap\",\n \"minify\",\n \"format\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"mode\",\n \"define\",\n \"assets\"\n ])\n ) as InlineConfig\n },\n context\n ),\n async (inlineConfig: InlineConfig) =>\n api({\n // eslint-disable-next-line ts/no-unnecessary-type-assertion\n options: defu(defaultOptions, {\n executionId: `${context.projectName}-${command}-${options.configIndex}`,\n cwd: context.root,\n root: projectConfig.root,\n configFile:\n options.configFile ||\n options.config ||\n joinPaths(projectConfig.root, \"powerlines.config.ts\"),\n configIndex: options.configIndex,\n framework: {\n name: \"powerlines\",\n orgId: \"storm-software\"\n }\n }) as ExecutionOptions,\n command,\n inlineConfig\n })\n )\n );\n } catch (error) {\n writeError(\n `An error occurred while executing the Powerlines - ${titleCase(\n command\n )} executor: ${\n isError(error)\n ? `${error.message}\n\n${error.stack}`\n : \"Unknown error\"\n }`\n );\n\n return { success: false };\n }\n },\n {\n skipReadingConfig: false,\n hooks: {\n applyDefaultOptions: (options: Partial<TExecutorSchema>) => {\n options.copyPath ??= \"dist/{projectRoot}\";\n\n return options as TExecutorSchema;\n }\n }\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,SAAgB,aAGd,SACA,YAQA,iBAAgD,CAAC,GACf;CAClC,OAAO,gBACL,gBAAgB,UAAU,OAAO,EAAE,YACnC,OACE,SACA,SACA,oBACmD;EACnD,IAAI,CAAC,QAAQ,aACX,MAAM,IAAI,MACR,oBAAoB,UAAU,OAAO,EAAE,0DACzC;EAGF,IACE,CAAC,QAAQ,eACT,CAAC,QAAQ,wBAAwB,YACjC,CAAC,QAAQ,uBAAuB,SAAS,QAAQ,gBACjD,CAAC,QAAQ,uBAAuB,SAAS,QAAQ,cAAc,MAE/D,MAAM,IAAI,MACR,oBAAoB,UAAU,OAAO,EAAE,qEACzC;EAGF,MAAM,gBACJ,QAAQ,uBAAuB,SAAS,QAAQ;EAElD,MAAM,OAAO,WAAW,QAAQ,MAAM;GACpC,OAAO;GACP,eAAe;EACjB,CAAC;EACD,MAAM,MAAM,MAAM,KACf,OAEE,KAAK,WAAW,gBAAgB,CAAC,EACnC,MAAK,QAAO,IAAI,OAAO;EAE1B,IAAI;GACF,OAAO,MAAM,QAAQ,QACnB,WACE,KACE;IACE,aAAa,QAAQ;IACrB;IACA;IACA;IACA,cAAc,KACZ;KACE,MAAM,QAAQ;KACd;KACA,MAAM,cAAc;KACpB,YAAY,QAAQ,cAAc,QAAQ;KAC1C,aAAa,QAAQ;KACrB,aAAa,cAAc;KAC3B,MAAM,QAAQ;KACd,QAAQ;MACN,MAAM,QAAQ;MACd,MACE,QAAQ,aAAa,QACjB,QACA;OACE,MAAM,QAAQ;OACd,QAAQ,QAAQ;MAClB;MACN,QAAQ,QAAQ;MAChB,WAAW,QAAQ;KACrB;KACA,SACE,WAAW,QAAQ,QAAQ,KAC3B,WAAW,QAAQ,UAAU,KAC7B,MAAM,QAAQ,qBAAqB,IAC/B;MACE,UAAU,WAAW,QAAQ,QAAQ,IACjC,QAAQ,WACR;MACJ,YAAY,WAAW,QAAQ,UAAU,IACrC,QAAQ,aACR;MACJ,uBAAuB,MACrB,QAAQ,qBACV,IACI,QAAQ,wBACR;KACN,IACA;KACN,QAAQ,YAAY,QAAQ,MAAM,IAC9B,QAAQ,SACR;KACJ,QAAQ,YAAY,QAAQ,MAAM,IAC9B,QAAQ,SACR;IACN,GACA,KAAK,SAAS;KACZ;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAAC,CACH;GACF,GACA,OACF,GACA,OAAO,iBACL,IAAI;IAEF,SAAS,KAAK,gBAAgB;KAC5B,aAAa,GAAG,QAAQ,YAAY,GAAG,QAAQ,GAAG,QAAQ;KAC1D,KAAK,QAAQ;KACb,MAAM,cAAc;KACpB,YACE,QAAQ,cACR,QAAQ,UACR,UAAU,cAAc,MAAM,sBAAsB;KACtD,aAAa,QAAQ;KACrB,WAAW;MACT,MAAM;MACN,OAAO;KACT;IACF,CAAC;IACD;IACA;GACF,CAAC,CACL,CACF;EACF,SAAS,OAAO;GACd,WACE,sDAAsD,UACpD,OACF,EAAE,aACA,QAAQ,KAAK,IACT,GAAG,MAAM,QAAQ;;EAE/B,MAAM,UACQ,iBAER;GAEA,OAAO,EAAE,SAAS,MAAM;EAC1B;CACF,GACA;EACE,mBAAmB;EACnB,OAAO,EACL,sBAAsB,YAAsC;GAC1D,QAAQ,aAAa;GAErB,OAAO;EACT,EACF;CACF,CACF;AACF"}
1
+ {"version":3,"file":"base-executor.mjs","names":[],"sources":["../../../src/base/base-executor.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ExecutorContext, PromiseExecutor } from \"@nx/devkit\";\nimport { writeError } from \"@storm-software/config-tools/logger\";\nimport { StormWorkspaceConfig } from \"@storm-software/config/types\";\nimport { withRunExecutor } from \"@storm-software/workspace-tools/base/base-executor\";\nimport { BaseExecutorResult } from \"@storm-software/workspace-tools/types\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createJiti } from \"jiti\";\nimport type {\n ExecutionApiParams,\n ExecutionOptions,\n InlineConfig,\n Mode,\n OutputConfig\n} from \"powerlines\";\nimport { formatExecutionId } from \"powerlines\";\nimport { BaseExecutorSchema } from \"./base-executor.schema\";\n\nexport type PowerlinesExecutorContext<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n> = ExecutorContext & {\n projectName: string;\n command: string;\n options: TExecutorSchema;\n inlineConfig: InlineConfig;\n workspaceConfig: StormWorkspaceConfig;\n};\n\nexport type PowerlinesExecutorApi = (\n inlineConfig: InlineConfig\n) => Promise<void>;\n\nexport interface WithExecutorOptions {\n /**\n * The import path for the executor API module, which is used to dynamically import the API function that will be called during execution. This value should be a string representing the module path, and it defaults to \"powerlines/api\" if not provided. The specified module should export a default function that matches the expected signature for the executor API, which will be invoked with the execution parameters when the executor is run.\n *\n * @defaultValue \"powerlines/api\"\n */\n importPath?: string;\n\n /**\n * Default options to be merged with the execution options, which can be used to provide default values for certain execution parameters or to override specific options for all executions of the executor. This value should be an object that matches the shape of the `ExecutionOptions` type, and it will be merged with the options provided during execution to create the final set of options that will be passed to the executor API function.\n *\n * @remarks\n * This can be useful for setting default values for options that are commonly used across multiple executions, or for providing a consistent set of options for all executions of the executor without requiring the caller to specify them each time.\n */\n defaultOptions?: DeepPartial<ExecutionOptions>;\n}\n\n/**\n * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.\n *\n * @remarks\n * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.\n *\n * @param command - The command that the executor will handle (e.g., \"new\", \"prepare\", \"build\", etc.).\n * @param executorFn - The function that will be executed when the command is run.\n * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.\n * @returns A Promise that resolves to the result of the executor function.\n */\nexport function withExecutor<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n>(\n command: string,\n executorFn: (\n context: PowerlinesExecutorContext<TExecutorSchema>,\n api: PowerlinesExecutorApi\n ) =>\n | Promise<BaseExecutorResult | null | undefined>\n | BaseExecutorResult\n | null\n | undefined,\n options: WithExecutorOptions = {}\n): PromiseExecutor<TExecutorSchema> {\n const { importPath = \"powerlines/api\", defaultOptions = {} } = options;\n\n return withRunExecutor(\n `Powerlines - ${titleCase(command)} executor`,\n async (\n options: TExecutorSchema,\n context: ExecutorContext,\n workspaceConfig: StormWorkspaceConfig\n ): Promise<BaseExecutorResult | null | undefined> => {\n if (!context.projectName) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectName\\` on the context object.`\n );\n }\n\n if (\n !context.projectName ||\n !context.projectsConfigurations?.projects ||\n !context.projectsConfigurations.projects[context.projectName] ||\n !context.projectsConfigurations.projects[context.projectName]?.root\n ) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectsConfigurations\\` on the context object.`\n );\n }\n\n const projectConfig =\n context.projectsConfigurations.projects[context.projectName]!;\n\n const jiti = createJiti(context.root, {\n cache: false,\n tsconfigPaths: true\n });\n const api = await jiti\n .import<{\n default: (params: ExecutionApiParams) => Promise<void>;\n }>(jiti.esmResolve(importPath))\n .then(mod => mod.default);\n\n try {\n return await Promise.resolve(\n executorFn(\n defu(\n {\n projectName: context.projectName,\n options,\n workspaceConfig,\n command,\n inlineConfig: defu(\n {\n name: context.projectName,\n command,\n root: projectConfig.root,\n configFile: options.configFile || options.config,\n configIndex: options.configIndex,\n projectType: projectConfig.projectType,\n mode: options.mode as Mode,\n output: {\n path: options.outputPath,\n copy:\n options.copyPath === false\n ? false\n : {\n path: options.copyPath,\n assets: options.assets\n },\n minify: options.minify,\n sourceMap: options.sourceMap\n } as OutputConfig,\n resolve:\n isSetArray(options.external) ||\n isSetArray(options.noExternal) ||\n isSet(options.skipNodeModulesBundle)\n ? {\n external: isSetArray(options.external)\n ? options.external\n : undefined,\n noExternal: isSetArray(options.noExternal)\n ? options.noExternal\n : undefined,\n skipNodeModulesBundle: isSet(\n options.skipNodeModulesBundle\n )\n ? options.skipNodeModulesBundle\n : undefined\n }\n : undefined,\n define: isSetObject(options.define)\n ? options.define\n : undefined,\n assets: isSetObject(options.assets)\n ? options.assets\n : undefined\n },\n omit(options, [\n \"config\",\n \"configFile\",\n \"outputPath\",\n \"copyPath\",\n \"sourceMap\",\n \"minify\",\n \"format\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"mode\",\n \"define\",\n \"assets\"\n ])\n ) as InlineConfig\n },\n context\n ),\n async (inlineConfig: InlineConfig) =>\n api({\n options: defu(defaultOptions, {\n executionId: formatExecutionId(\n inlineConfig.name ||\n context.projectName ||\n projectConfig.root,\n command,\n options.configIndex ?? 0\n ),\n cwd: context.root,\n root: projectConfig.root,\n configFile:\n options.configFile ||\n options.config ||\n joinPaths(projectConfig.root, \"powerlines.config.ts\"),\n configIndex: options.configIndex,\n framework: {\n name: \"powerlines\",\n orgId: \"storm-software\"\n }\n }) as ExecutionOptions,\n command,\n inlineConfig\n })\n )\n );\n } catch (error) {\n writeError(\n `An error occurred while executing the Powerlines - ${titleCase(\n command\n )} executor: ${\n isError(error)\n ? `${error.message}\n\n${error.stack}`\n : \"Unknown error\"\n }`\n );\n\n return { success: false };\n }\n },\n {\n skipReadingConfig: false,\n hooks: {\n applyDefaultOptions: (options: Partial<TExecutorSchema>) => {\n options.copyPath ??= \"dist/{projectRoot}\";\n\n return options as TExecutorSchema;\n }\n }\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,aAGd,SACA,YAQA,UAA+B,CAAC,GACE;CAClC,MAAM,EAAE,aAAa,kBAAkB,iBAAiB,CAAC,MAAM;CAE/D,OAAO,gBACL,gBAAgB,UAAU,OAAO,EAAE,YACnC,OACE,SACA,SACA,oBACmD;EACnD,IAAI,CAAC,QAAQ,aACX,MAAM,IAAI,MACR,oBAAoB,UAAU,OAAO,EAAE,0DACzC;EAGF,IACE,CAAC,QAAQ,eACT,CAAC,QAAQ,wBAAwB,YACjC,CAAC,QAAQ,uBAAuB,SAAS,QAAQ,gBACjD,CAAC,QAAQ,uBAAuB,SAAS,QAAQ,cAAc,MAE/D,MAAM,IAAI,MACR,oBAAoB,UAAU,OAAO,EAAE,qEACzC;EAGF,MAAM,gBACJ,QAAQ,uBAAuB,SAAS,QAAQ;EAElD,MAAM,OAAO,WAAW,QAAQ,MAAM;GACpC,OAAO;GACP,eAAe;EACjB,CAAC;EACD,MAAM,MAAM,MAAM,KACf,OAEE,KAAK,WAAW,UAAU,CAAC,EAC7B,MAAK,QAAO,IAAI,OAAO;EAE1B,IAAI;GACF,OAAO,MAAM,QAAQ,QACnB,WACE,KACE;IACE,aAAa,QAAQ;IACrB;IACA;IAC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SAAS,MAAM;EAC1B;CACF,GACA;EACE,mBAAmB;EACnB,OAAO,EACL,sBAAsB,YAAsC;GAC1D,QAAQ,aAAa;GAErB,OAAO;EACT,EACF;CACF,CACF;AACF"}
@@ -1,4 +1,4 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
- import { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor } from "./base-executor.mjs";
4
- export { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor };
3
+ import { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor } from "./base-executor.mjs";
4
+ export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
@@ -1,2 +1,2 @@
1
- import { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor } from "./base-executor.js";
2
- export { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor };
1
+ import { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor } from "./base-executor.js";
2
+ export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
@@ -9,6 +9,7 @@ import { joinPaths } from "@stryke/path/join";
9
9
  import { isSet } from "@stryke/type-checks/is-set";
10
10
  import { isSetArray } from "@stryke/type-checks/is-set-array";
11
11
  import { createJiti } from "jiti";
12
+ import { formatExecutionId } from "powerlines";
12
13
 
13
14
  //#region src/base/base-executor.ts
14
15
  /**
@@ -19,10 +20,11 @@ import { createJiti } from "jiti";
19
20
  *
20
21
  * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
21
22
  * @param executorFn - The function that will be executed when the command is run.
22
- * @param defaultOptions - Default options to be merged with the execution options.
23
+ * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
23
24
  * @returns A Promise that resolves to the result of the executor function.
24
25
  */
25
- function withExecutor(command, executorFn, defaultOptions = {}) {
26
+ function withExecutor(command, executorFn, options = {}) {
27
+ const { importPath = "powerlines/api", defaultOptions = {} } = options;
26
28
  return withRunExecutor(`Powerlines - ${titleCase(command)} executor`, async (options, context, workspaceConfig) => {
27
29
  if (!context.projectName) throw new Error(`The Powerlines - ${titleCase(command)} executor requires \`projectName\` on the context object.`);
28
30
  if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) throw new Error(`The Powerlines - ${titleCase(command)} executor requires \`projectsConfigurations\` on the context object.`);
@@ -31,7 +33,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
31
33
  cache: false,
32
34
  tsconfigPaths: true
33
35
  });
34
- const api = await jiti.import(jiti.esmResolve("powerlines/api")).then((mod) => mod.default);
36
+ const api = await jiti.import(jiti.esmResolve(importPath)).then((mod) => mod.default);
35
37
  try {
36
38
  return await Promise.resolve(executorFn(defu({
37
39
  projectName: context.projectName,
@@ -79,7 +81,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
79
81
  ]))
80
82
  }, context), async (inlineConfig) => api({
81
83
  options: defu(defaultOptions, {
82
- executionId: `${context.projectName}-${command}-${options.configIndex}`,
84
+ executionId: formatExecutionId(inlineConfig.name || context.projectName || projectConfig.root, command, options.configIndex ?? 0),
83
85
  cwd: context.root,
84
86
  root: projectConfig.root,
85
87
  configFile: options.configFile || options.config || joinPaths(projectConfig.root, "powerlines.config.ts"),
@@ -109,4 +111,4 @@ ${error.stack}` : "Unknown error"}`);
109
111
 
110
112
  //#endregion
111
113
  export { withExecutor as t };
112
- //# sourceMappingURL=base-executor-0AtMZrSx.mjs.map
114
+ //# sourceMappingURL=base-executor-Ba__ui5X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-executor-Ba__ui5X.mjs","names":[],"sources":["../../src/base/base-executor.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ExecutorContext, PromiseExecutor } from \"@nx/devkit\";\nimport { writeError } from \"@storm-software/config-tools/logger\";\nimport { StormWorkspaceConfig } from \"@storm-software/config/types\";\nimport { withRunExecutor } from \"@storm-software/workspace-tools/base/base-executor\";\nimport { BaseExecutorResult } from \"@storm-software/workspace-tools/types\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createJiti } from \"jiti\";\nimport type {\n ExecutionApiParams,\n ExecutionOptions,\n InlineConfig,\n Mode,\n OutputConfig\n} from \"powerlines\";\nimport { formatExecutionId } from \"powerlines\";\nimport { BaseExecutorSchema } from \"./base-executor.schema\";\n\nexport type PowerlinesExecutorContext<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n> = ExecutorContext & {\n projectName: string;\n command: string;\n options: TExecutorSchema;\n inlineConfig: InlineConfig;\n workspaceConfig: StormWorkspaceConfig;\n};\n\nexport type PowerlinesExecutorApi = (\n inlineConfig: InlineConfig\n) => Promise<void>;\n\nexport interface WithExecutorOptions {\n /**\n * The import path for the executor API module, which is used to dynamically import the API function that will be called during execution. This value should be a string representing the module path, and it defaults to \"powerlines/api\" if not provided. The specified module should export a default function that matches the expected signature for the executor API, which will be invoked with the execution parameters when the executor is run.\n *\n * @defaultValue \"powerlines/api\"\n */\n importPath?: string;\n\n /**\n * Default options to be merged with the execution options, which can be used to provide default values for certain execution parameters or to override specific options for all executions of the executor. This value should be an object that matches the shape of the `ExecutionOptions` type, and it will be merged with the options provided during execution to create the final set of options that will be passed to the executor API function.\n *\n * @remarks\n * This can be useful for setting default values for options that are commonly used across multiple executions, or for providing a consistent set of options for all executions of the executor without requiring the caller to specify them each time.\n */\n defaultOptions?: DeepPartial<ExecutionOptions>;\n}\n\n/**\n * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.\n *\n * @remarks\n * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.\n *\n * @param command - The command that the executor will handle (e.g., \"new\", \"prepare\", \"build\", etc.).\n * @param executorFn - The function that will be executed when the command is run.\n * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.\n * @returns A Promise that resolves to the result of the executor function.\n */\nexport function withExecutor<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n>(\n command: string,\n executorFn: (\n context: PowerlinesExecutorContext<TExecutorSchema>,\n api: PowerlinesExecutorApi\n ) =>\n | Promise<BaseExecutorResult | null | undefined>\n | BaseExecutorResult\n | null\n | undefined,\n options: WithExecutorOptions = {}\n): PromiseExecutor<TExecutorSchema> {\n const { importPath = \"powerlines/api\", defaultOptions = {} } = options;\n\n return withRunExecutor(\n `Powerlines - ${titleCase(command)} executor`,\n async (\n options: TExecutorSchema,\n context: ExecutorContext,\n workspaceConfig: StormWorkspaceConfig\n ): Promise<BaseExecutorResult | null | undefined> => {\n if (!context.projectName) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectName\\` on the context object.`\n );\n }\n\n if (\n !context.projectName ||\n !context.projectsConfigurations?.projects ||\n !context.projectsConfigurations.projects[context.projectName] ||\n !context.projectsConfigurations.projects[context.projectName]?.root\n ) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectsConfigurations\\` on the context object.`\n );\n }\n\n const projectConfig =\n context.projectsConfigurations.projects[context.projectName]!;\n\n const jiti = createJiti(context.root, {\n cache: false,\n tsconfigPaths: true\n });\n const api = await jiti\n .import<{\n default: (params: ExecutionApiParams) => Promise<void>;\n }>(jiti.esmResolve(importPath))\n .then(mod => mod.default);\n\n try {\n return await Promise.resolve(\n executorFn(\n defu(\n {\n projectName: context.projectName,\n options,\n workspaceConfig,\n command,\n inlineConfig: defu(\n {\n name: context.projectName,\n command,\n root: projectConfig.root,\n configFile: options.configFile || options.config,\n configIndex: options.configIndex,\n projectType: projectConfig.projectType,\n mode: options.mode as Mode,\n output: {\n path: options.outputPath,\n copy:\n options.copyPath === false\n ? false\n : {\n path: options.copyPath,\n assets: options.assets\n },\n minify: options.minify,\n sourceMap: options.sourceMap\n } as OutputConfig,\n resolve:\n isSetArray(options.external) ||\n isSetArray(options.noExternal) ||\n isSet(options.skipNodeModulesBundle)\n ? {\n external: isSetArray(options.external)\n ? options.external\n : undefined,\n noExternal: isSetArray(options.noExternal)\n ? options.noExternal\n : undefined,\n skipNodeModulesBundle: isSet(\n options.skipNodeModulesBundle\n )\n ? options.skipNodeModulesBundle\n : undefined\n }\n : undefined,\n define: isSetObject(options.define)\n ? options.define\n : undefined,\n assets: isSetObject(options.assets)\n ? options.assets\n : undefined\n },\n omit(options, [\n \"config\",\n \"configFile\",\n \"outputPath\",\n \"copyPath\",\n \"sourceMap\",\n \"minify\",\n \"format\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"mode\",\n \"define\",\n \"assets\"\n ])\n ) as InlineConfig\n },\n context\n ),\n async (inlineConfig: InlineConfig) =>\n api({\n options: defu(defaultOptions, {\n executionId: formatExecutionId(\n inlineConfig.name ||\n context.projectName ||\n projectConfig.root,\n command,\n options.configIndex ?? 0\n ),\n cwd: context.root,\n root: projectConfig.root,\n configFile:\n options.configFile ||\n options.config ||\n joinPaths(projectConfig.root, \"powerlines.config.ts\"),\n configIndex: options.configIndex,\n framework: {\n name: \"powerlines\",\n orgId: \"storm-software\"\n }\n }) as ExecutionOptions,\n command,\n inlineConfig\n })\n )\n );\n } catch (error) {\n writeError(\n `An error occurred while executing the Powerlines - ${titleCase(\n command\n )} executor: ${\n isError(error)\n ? `${error.message}\n\n${error.stack}`\n : \"Unknown error\"\n }`\n );\n\n return { success: false };\n }\n },\n {\n skipReadingConfig: false,\n hooks: {\n applyDefaultOptions: (options: Partial<TExecutorSchema>) => {\n options.copyPath ??= \"dist/{projectRoot}\";\n\n return options as TExecutorSchema;\n }\n }\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,aAGd,SACA,YAQA,UAA+B,CAAC,GACE;CAClC,MAAM,EAAE,aAAa,kBAAkB,iBAAiB,CAAC,MAAM;CAE/D,OAAO,gBACL,gBAAgB,UAAU,OAAO,EAAE,YACnC,OACE,SACA,SACA,oBACmD;EACnD,IAAI,CAAC,QAAQ,aACX,MAAM,IAAI,MACR,oBAAoB,UAAU,OAAO,EAAE,0DACzC;EAGF,IACE,CAAC,QAAQ,eACT,CAAC,QAAQ,wBAAwB,YACjC,CAAC,QAAQ,uBAAuB,SAAS,QAAQ,gBACjD,CAAC,QAAQ,uBAAuB,SAAS,QAAQ,cAAc,MAE/D,MAAM,IAAI,MACR,oBAAoB,UAAU,OAAO,EAAE,qEACzC;EAGF,MAAM,gBACJ,QAAQ,uBAAuB,SAAS,QAAQ;EAElD,MAAM,OAAO,WAAW,QAAQ,MAAM;GACpC,OAAO;GACP,eAAe;EACjB,CAAC;EACD,MAAM,MAAM,MAAM,KACf,OAEE,KAAK,WAAW,UAAU,CAAC,EAC7B,MAAK,QAAO,IAAI,OAAO;EAE1B,IAAI;GACF,OAAO,MAAM,QAAQ,QACnB,WACE,KACE;IACE,aAAa,QAAQ;IACrB;IACA;IACA;IACA,cAAc,KACZ;KACE,MAAM,QAAQ;KACd;KACA,MAAM,cAAc;KACpB,YAAY,QAAQ,cAAc,QAAQ;KAC1C,aAAa,QAAQ;KACrB,aAAa,cAAc;KAC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@@ -11,6 +11,7 @@ let _stryke_path_join = require("@stryke/path/join");
11
11
  let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
12
12
  let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
13
13
  let jiti = require("jiti");
14
+ let powerlines = require("powerlines");
14
15
 
15
16
  //#region src/base/base-executor.ts
16
17
  /**
@@ -21,10 +22,11 @@ let jiti = require("jiti");
21
22
  *
22
23
  * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
23
24
  * @param executorFn - The function that will be executed when the command is run.
24
- * @param defaultOptions - Default options to be merged with the execution options.
25
+ * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
25
26
  * @returns A Promise that resolves to the result of the executor function.
26
27
  */
27
- function withExecutor(command, executorFn, defaultOptions = {}) {
28
+ function withExecutor(command, executorFn, options = {}) {
29
+ const { importPath = "powerlines/api", defaultOptions = {} } = options;
28
30
  return (0, _storm_software_workspace_tools_base_base_executor.withRunExecutor)(`Powerlines - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor`, async (options, context, workspaceConfig) => {
29
31
  if (!context.projectName) throw new Error(`The Powerlines - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor requires \`projectName\` on the context object.`);
30
32
  if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) throw new Error(`The Powerlines - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor requires \`projectsConfigurations\` on the context object.`);
@@ -33,7 +35,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
33
35
  cache: false,
34
36
  tsconfigPaths: true
35
37
  });
36
- const api = await jiti$1.import(jiti$1.esmResolve("powerlines/api")).then((mod) => mod.default);
38
+ const api = await jiti$1.import(jiti$1.esmResolve(importPath)).then((mod) => mod.default);
37
39
  try {
38
40
  return await Promise.resolve(executorFn((0, defu.default)({
39
41
  projectName: context.projectName,
@@ -81,7 +83,7 @@ function withExecutor(command, executorFn, defaultOptions = {}) {
81
83
  ]))
82
84
  }, context), async (inlineConfig) => api({
83
85
  options: (0, defu.default)(defaultOptions, {
84
- executionId: `${context.projectName}-${command}-${options.configIndex}`,
86
+ executionId: (0, powerlines.formatExecutionId)(inlineConfig.name || context.projectName || projectConfig.root, command, options.configIndex ?? 0),
85
87
  cwd: context.root,
86
88
  root: projectConfig.root,
87
89
  configFile: options.configFile || options.config || (0, _stryke_path_join.joinPaths)(projectConfig.root, "powerlines.config.ts"),
@@ -1,4 +1,4 @@
1
- const require_base_executor = require('../../base-executor-BIhn6u5E.js');
1
+ const require_base_executor = require('../../base-executor-OabtICR5.js');
2
2
 
3
3
  //#region src/executors/build/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../../base-executor-0AtMZrSx.mjs";
1
+ import { t as withExecutor } from "../../base-executor-Ba__ui5X.mjs";
2
2
 
3
3
  //#region src/executors/build/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- const require_base_executor = require('../../base-executor-BIhn6u5E.js');
1
+ const require_base_executor = require('../../base-executor-OabtICR5.js');
2
2
 
3
3
  //#region src/executors/clean/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../../base-executor-0AtMZrSx.mjs";
1
+ import { t as withExecutor } from "../../base-executor-Ba__ui5X.mjs";
2
2
 
3
3
  //#region src/executors/clean/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- const require_base_executor = require('../../base-executor-BIhn6u5E.js');
1
+ const require_base_executor = require('../../base-executor-OabtICR5.js');
2
2
 
3
3
  //#region src/executors/docs/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../../base-executor-0AtMZrSx.mjs";
1
+ import { t as withExecutor } from "../../base-executor-Ba__ui5X.mjs";
2
2
 
3
3
  //#region src/executors/docs/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- const require_base_executor = require('../../base-executor-BIhn6u5E.js');
1
+ const require_base_executor = require('../../base-executor-OabtICR5.js');
2
2
 
3
3
  //#region src/executors/lint/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../../base-executor-0AtMZrSx.mjs";
1
+ import { t as withExecutor } from "../../base-executor-Ba__ui5X.mjs";
2
2
 
3
3
  //#region src/executors/lint/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- const require_base_executor = require('../../base-executor-BIhn6u5E.js');
1
+ const require_base_executor = require('../../base-executor-OabtICR5.js');
2
2
 
3
3
  //#region src/executors/prepare/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../../base-executor-0AtMZrSx.mjs";
1
+ import { t as withExecutor } from "../../base-executor-Ba__ui5X.mjs";
2
2
 
3
3
  //#region src/executors/prepare/executor.ts
4
4
  async function executorFn(context, api) {
@@ -1,7 +1,7 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
- import { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor } from "./base/base-executor.mjs";
3
+ import { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor } from "./base/base-executor.mjs";
4
4
  import { CONFIG_INPUTS } from "./helpers/constants.mjs";
5
5
  import { NxPluginOptions } from "./types/plugin.mjs";
6
6
  import { CreateNxPluginOptions, createNxPlugin, getNxPluginInputs, getNxTargetInputs } from "./helpers/plugin-utilities.mjs";
7
- export { CONFIG_INPUTS, CreateNxPluginOptions, NxPluginOptions, PowerlinesExecutorApi, PowerlinesExecutorContext, createNxPlugin, getNxPluginInputs, getNxTargetInputs, withExecutor };
7
+ export { CONFIG_INPUTS, CreateNxPluginOptions, NxPluginOptions, PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, createNxPlugin, getNxPluginInputs, getNxTargetInputs, withExecutor };
@@ -1,5 +1,5 @@
1
- import { PowerlinesExecutorApi, PowerlinesExecutorContext, withExecutor } from "./base/base-executor.js";
1
+ import { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor } from "./base/base-executor.js";
2
2
  import { CONFIG_INPUTS } from "./helpers/constants.js";
3
3
  import { NxPluginOptions } from "./types/plugin.js";
4
4
  import { CreateNxPluginOptions, createNxPlugin, getNxPluginInputs, getNxTargetInputs } from "./helpers/plugin-utilities.js";
5
- export { CONFIG_INPUTS, CreateNxPluginOptions, NxPluginOptions, PowerlinesExecutorApi, PowerlinesExecutorContext, createNxPlugin, getNxPluginInputs, getNxTargetInputs, withExecutor };
5
+ export { CONFIG_INPUTS, CreateNxPluginOptions, NxPluginOptions, PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, createNxPlugin, getNxPluginInputs, getNxTargetInputs, withExecutor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/nx",
3
- "version": "0.13.124",
3
+ "version": "0.13.125",
4
4
  "private": false,
5
5
  "description": "A Nx plugin to support Powerlines development in Nx monorepos.",
6
6
  "repository": {
@@ -187,7 +187,7 @@
187
187
  "@stryke/type-checks": "^0.6.12",
188
188
  "defu": "^6.1.7",
189
189
  "jiti": "^2.7.0",
190
- "powerlines": "^0.47.86"
190
+ "powerlines": "^0.47.87"
191
191
  },
192
192
  "devDependencies": {
193
193
  "@nx/workspace": "22.7.5",
@@ -206,5 +206,5 @@
206
206
  "publishConfig": { "access": "public" },
207
207
  "executors": "./executors.json",
208
208
  "generators": "./generators.json",
209
- "gitHead": "2a7208605db4b9d25c7e6462fe44deb0284e3b8c"
209
+ "gitHead": "96a654a26c414db84da2bd824d8f821e6c0fe3ff"
210
210
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-executor-0AtMZrSx.mjs","names":[],"sources":["../../src/base/base-executor.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ExecutorContext, PromiseExecutor } from \"@nx/devkit\";\nimport { writeError } from \"@storm-software/config-tools/logger\";\nimport { StormWorkspaceConfig } from \"@storm-software/config/types\";\nimport { withRunExecutor } from \"@storm-software/workspace-tools/base/base-executor\";\nimport { BaseExecutorResult } from \"@storm-software/workspace-tools/types\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createJiti } from \"jiti\";\nimport type {\n ExecutionApiParams,\n ExecutionOptions,\n InlineConfig,\n Mode,\n OutputConfig\n} from \"powerlines\";\nimport { BaseExecutorSchema } from \"./base-executor.schema\";\n\nexport type PowerlinesExecutorContext<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n> = ExecutorContext & {\n projectName: string;\n command: string;\n options: TExecutorSchema;\n inlineConfig: InlineConfig;\n workspaceConfig: StormWorkspaceConfig;\n};\n\nexport type PowerlinesExecutorApi = (\n inlineConfig: InlineConfig\n) => Promise<void>;\n\n/**\n * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.\n *\n * @remarks\n * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.\n *\n * @param command - The command that the executor will handle (e.g., \"new\", \"prepare\", \"build\", etc.).\n * @param executorFn - The function that will be executed when the command is run.\n * @param defaultOptions - Default options to be merged with the execution options.\n * @returns A Promise that resolves to the result of the executor function.\n */\nexport function withExecutor<\n TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema\n>(\n command: string,\n executorFn: (\n context: PowerlinesExecutorContext<TExecutorSchema>,\n api: PowerlinesExecutorApi\n ) =>\n | Promise<BaseExecutorResult | null | undefined>\n | BaseExecutorResult\n | null\n | undefined,\n defaultOptions: DeepPartial<ExecutionOptions> = {}\n): PromiseExecutor<TExecutorSchema> {\n return withRunExecutor(\n `Powerlines - ${titleCase(command)} executor`,\n async (\n options: TExecutorSchema,\n context: ExecutorContext,\n workspaceConfig: StormWorkspaceConfig\n ): Promise<BaseExecutorResult | null | undefined> => {\n if (!context.projectName) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectName\\` on the context object.`\n );\n }\n\n if (\n !context.projectName ||\n !context.projectsConfigurations?.projects ||\n !context.projectsConfigurations.projects[context.projectName] ||\n !context.projectsConfigurations.projects[context.projectName]?.root\n ) {\n throw new Error(\n `The Powerlines - ${titleCase(command)} executor requires \\`projectsConfigurations\\` on the context object.`\n );\n }\n\n const projectConfig =\n context.projectsConfigurations.projects[context.projectName]!;\n\n const jiti = createJiti(context.root, {\n cache: false,\n tsconfigPaths: true\n });\n const api = await jiti\n .import<{\n default: (params: ExecutionApiParams) => Promise<void>;\n }>(jiti.esmResolve(\"powerlines/api\"))\n .then(mod => mod.default);\n\n try {\n return await Promise.resolve(\n executorFn(\n defu(\n {\n projectName: context.projectName,\n options,\n workspaceConfig,\n command,\n inlineConfig: defu(\n {\n name: context.projectName,\n command,\n root: projectConfig.root,\n configFile: options.configFile || options.config,\n configIndex: options.configIndex,\n projectType: projectConfig.projectType,\n mode: options.mode as Mode,\n output: {\n path: options.outputPath,\n copy:\n options.copyPath === false\n ? false\n : {\n path: options.copyPath,\n assets: options.assets\n },\n minify: options.minify,\n sourceMap: options.sourceMap\n } as OutputConfig,\n resolve:\n isSetArray(options.external) ||\n isSetArray(options.noExternal) ||\n isSet(options.skipNodeModulesBundle)\n ? {\n external: isSetArray(options.external)\n ? options.external\n : undefined,\n noExternal: isSetArray(options.noExternal)\n ? options.noExternal\n : undefined,\n skipNodeModulesBundle: isSet(\n options.skipNodeModulesBundle\n )\n ? options.skipNodeModulesBundle\n : undefined\n }\n : undefined,\n define: isSetObject(options.define)\n ? options.define\n : undefined,\n assets: isSetObject(options.assets)\n ? options.assets\n : undefined\n },\n omit(options, [\n \"config\",\n \"configFile\",\n \"outputPath\",\n \"copyPath\",\n \"sourceMap\",\n \"minify\",\n \"format\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"mode\",\n \"define\",\n \"assets\"\n ])\n ) as InlineConfig\n },\n context\n ),\n async (inlineConfig: InlineConfig) =>\n api({\n // eslint-disable-next-line ts/no-unnecessary-type-assertion\n options: defu(defaultOptions, {\n executionId: `${context.projectName}-${command}-${options.configIndex}`,\n cwd: context.root,\n root: projectConfig.root,\n configFile:\n options.configFile ||\n options.config ||\n joinPaths(projectConfig.root, \"powerlines.config.ts\"),\n configIndex: options.configIndex,\n framework: {\n name: \"powerlines\",\n orgId: \"storm-software\"\n }\n }) as ExecutionOptions,\n command,\n inlineConfig\n })\n )\n );\n } catch (error) {\n writeError(\n `An error occurred while executing the Powerlines - ${titleCase(\n command\n )} executor: ${\n isError(error)\n ? `${error.message}\n\n${error.stack}`\n : \"Unknown error\"\n }`\n );\n\n return { success: false };\n }\n },\n {\n skipReadingConfig: false,\n hooks: {\n applyDefaultOptions: (options: Partial<TExecutorSchema>) => {\n options.copyPath ??= \"dist/{projectRoot}\";\n\n return options as TExecutorSchema;\n }\n }\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmEA,SAAgB,aAGd,SACA,YAQA,iBAAgD,CAAC,GACf;CAClC,OAAO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