@powerlines/nx 0.13.249 → 0.13.250
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/src/base/base-executor.d.mts +2 -60
- package/dist/src/base/base-executor.d.ts +2 -60
- package/dist/src/base/base-executor.js +7 -4
- package/dist/src/base/base-executor.mjs +5 -2
- package/dist/src/base/base-executor.mjs.map +1 -1
- package/dist/src/base/base-executor.untyped.d.mts +2 -5
- package/dist/src/base/base-executor.untyped.d.ts +2 -4
- package/dist/src/base/index.d.mts +1 -1
- package/dist/src/base/index.d.ts +1 -1
- package/dist/src/base-executor-BCcpfw61.d.ts +60 -0
- package/dist/src/base-executor-BCcpfw61.d.ts.map +1 -0
- package/dist/src/base-executor-C9j1WGyX.d.mts +60 -0
- package/dist/src/base-executor-C9j1WGyX.d.mts.map +1 -0
- package/dist/src/base-executor.untyped-DJ2f40oh.d.mts +5 -0
- package/dist/src/base-executor.untyped-DJ2f40oh.d.mts.map +1 -0
- package/dist/src/base-executor.untyped-DJ2f40oh.d.ts +5 -0
- package/dist/src/base-executor.untyped-DJ2f40oh.d.ts.map +1 -0
- package/dist/src/constants-QuvxQ1Kt.d.mts +8 -0
- package/dist/src/constants-QuvxQ1Kt.d.mts.map +1 -0
- package/dist/src/constants-QuvxQ1Kt.d.ts +8 -0
- package/dist/src/constants-QuvxQ1Kt.d.ts.map +1 -0
- package/dist/src/executors/build/executor.js +2 -2
- package/dist/src/executors/build/executor.mjs +1 -1
- package/dist/src/executors/clean/executor.js +2 -2
- package/dist/src/executors/clean/executor.mjs +1 -1
- package/dist/src/executors/clean/untyped.js +2 -2
- package/dist/src/executors/clean/untyped.mjs +1 -1
- package/dist/src/executors/docs/executor.js +2 -2
- package/dist/src/executors/docs/executor.mjs +1 -1
- package/dist/src/executors/lint/executor.js +2 -2
- package/dist/src/executors/lint/executor.mjs +1 -1
- package/dist/src/executors/prepare/executor.js +2 -2
- package/dist/src/executors/prepare/executor.mjs +1 -1
- package/dist/src/executors/prepare/untyped.js +2 -2
- package/dist/src/executors/prepare/untyped.mjs +1 -1
- package/dist/src/helpers/constants.d.mts +2 -8
- package/dist/src/helpers/constants.d.ts +2 -8
- package/dist/src/helpers/index.d.mts +2 -2
- package/dist/src/helpers/index.d.ts +2 -2
- package/dist/src/helpers/plugin-utilities.d.mts +2 -56
- package/dist/src/helpers/plugin-utilities.d.ts +2 -56
- package/dist/src/helpers/plugin-utilities.js +2 -2
- package/dist/src/helpers/plugin-utilities.mjs +2 -2
- package/dist/src/helpers/plugin-utilities.mjs.map +1 -1
- package/dist/src/index.d.mts +4 -4
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +1 -0
- package/dist/src/index.mjs +1 -0
- package/dist/src/plugin/index.d.mts +1 -286
- package/dist/src/plugin/index.d.mts.map +1 -1
- package/dist/src/plugin/index.d.ts +1 -286
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +2 -284
- package/dist/src/plugin/index.mjs +1 -281
- package/dist/src/plugin/index.mjs.map +1 -1
- package/dist/src/plugin-B94-9IvO.d.mts +288 -0
- package/dist/src/plugin-B94-9IvO.d.mts.map +1 -0
- package/dist/src/plugin-B94-9IvO.d.ts +288 -0
- package/dist/src/plugin-B94-9IvO.d.ts.map +1 -0
- package/dist/src/plugin-utilities-TozKPwW0.d.ts +56 -0
- package/dist/src/plugin-utilities-TozKPwW0.d.ts.map +1 -0
- package/dist/src/plugin-utilities-dOdjrrHD.d.mts +56 -0
- package/dist/src/plugin-utilities-dOdjrrHD.d.mts.map +1 -0
- package/dist/src/types/index.d.mts +1 -1
- package/dist/src/types/index.d.ts +1 -1
- package/dist/src/types/plugin.d.mts +2 -288
- package/dist/src/types/plugin.d.ts +2 -288
- package/package.json +3 -3
- package/dist/src/_virtual/_rolldown/runtime.js +0 -28
- package/dist/src/base/base-executor.d.mts.map +0 -1
- package/dist/src/base/base-executor.d.ts.map +0 -1
- package/dist/src/base/base-executor.untyped.d.mts.map +0 -1
- package/dist/src/base/base-executor.untyped.d.ts.map +0 -1
- package/dist/src/base-executor-BVYmsZ3I.mjs +0 -114
- package/dist/src/base-executor-BVYmsZ3I.mjs.map +0 -1
- package/dist/src/base-executor-CBgW5wY1.js +0 -120
- package/dist/src/base-executor.untyped-But-48Iy.js +0 -183
- package/dist/src/base-executor.untyped-Bz2f75UY.mjs +0 -179
- package/dist/src/base-executor.untyped-Bz2f75UY.mjs.map +0 -1
- package/dist/src/helpers/constants.d.mts.map +0 -1
- package/dist/src/helpers/constants.d.ts.map +0 -1
- package/dist/src/helpers/plugin-utilities.d.mts.map +0 -1
- package/dist/src/helpers/plugin-utilities.d.ts.map +0 -1
- package/dist/src/types/plugin.d.mts.map +0 -1
- package/dist/src/types/plugin.d.ts.map +0 -1
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
4
|
-
import { BaseExecutorResult } from "@storm-software/workspace-tools/types";
|
|
5
|
-
import { DeepPartial } from "@stryke/types/base";
|
|
6
|
-
import { ExecutionOptions, FrameworkOptions, InlineConfig } from "powerlines";
|
|
7
|
-
//#region src/base/base-executor.d.ts
|
|
8
|
-
type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema> = ExecutorContext & {
|
|
9
|
-
projectName: string;
|
|
10
|
-
command: string;
|
|
11
|
-
options: TExecutorSchema;
|
|
12
|
-
inlineConfig: InlineConfig;
|
|
13
|
-
workspaceConfig: StormWorkspaceConfig;
|
|
14
|
-
};
|
|
15
|
-
type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
|
|
16
|
-
interface WithExecutorOptions {
|
|
17
|
-
/**
|
|
18
|
-
* 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.
|
|
19
|
-
*
|
|
20
|
-
* @defaultValue "powerlines/api"
|
|
21
|
-
*/
|
|
22
|
-
importPath?: string;
|
|
23
|
-
/**
|
|
24
|
-
* 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.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* 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.
|
|
28
|
-
*/
|
|
29
|
-
defaultOptions?: DeepPartial<ExecutionOptions>;
|
|
30
|
-
/**
|
|
31
|
-
* Details about the framework being used in the current execution, which can be used by plugins and other parts of the system to customize behavior based on the framework.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* This should only be used by framework plugins to ensure the correct framework name is applied
|
|
35
|
-
*
|
|
36
|
-
* @defaultValue
|
|
37
|
-
* ```ts
|
|
38
|
-
* {
|
|
39
|
-
* name: "powerlines",
|
|
40
|
-
* orgId: "storm-software"
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
framework?: FrameworkOptions;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
|
|
51
|
-
*
|
|
52
|
-
* @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
|
|
53
|
-
* @param executorFn - The function that will be executed when the command is run.
|
|
54
|
-
* @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
|
|
55
|
-
* @returns A Promise that resolves to the result of the executor function.
|
|
56
|
-
*/
|
|
57
|
-
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>;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
|
|
60
|
-
//# sourceMappingURL=base-executor.d.mts.map
|
|
1
|
+
import { i as withExecutor, n as PowerlinesExecutorContext, r as WithExecutorOptions, t as PowerlinesExecutorApi } from "../base-executor-C9j1WGyX.mjs";
|
|
2
|
+
export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
|
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
4
|
-
import { BaseExecutorResult } from "@storm-software/workspace-tools/types";
|
|
5
|
-
import { DeepPartial } from "@stryke/types/base";
|
|
6
|
-
import { ExecutionOptions, FrameworkOptions, InlineConfig } from "powerlines";
|
|
7
|
-
//#region src/base/base-executor.d.ts
|
|
8
|
-
type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema> = ExecutorContext & {
|
|
9
|
-
projectName: string;
|
|
10
|
-
command: string;
|
|
11
|
-
options: TExecutorSchema;
|
|
12
|
-
inlineConfig: InlineConfig;
|
|
13
|
-
workspaceConfig: StormWorkspaceConfig;
|
|
14
|
-
};
|
|
15
|
-
type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
|
|
16
|
-
interface WithExecutorOptions {
|
|
17
|
-
/**
|
|
18
|
-
* 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.
|
|
19
|
-
*
|
|
20
|
-
* @defaultValue "powerlines/api"
|
|
21
|
-
*/
|
|
22
|
-
importPath?: string;
|
|
23
|
-
/**
|
|
24
|
-
* 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.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* 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.
|
|
28
|
-
*/
|
|
29
|
-
defaultOptions?: DeepPartial<ExecutionOptions>;
|
|
30
|
-
/**
|
|
31
|
-
* Details about the framework being used in the current execution, which can be used by plugins and other parts of the system to customize behavior based on the framework.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* This should only be used by framework plugins to ensure the correct framework name is applied
|
|
35
|
-
*
|
|
36
|
-
* @defaultValue
|
|
37
|
-
* ```ts
|
|
38
|
-
* {
|
|
39
|
-
* name: "powerlines",
|
|
40
|
-
* orgId: "storm-software"
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
framework?: FrameworkOptions;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
|
|
51
|
-
*
|
|
52
|
-
* @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
|
|
53
|
-
* @param executorFn - The function that will be executed when the command is run.
|
|
54
|
-
* @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
|
|
55
|
-
* @returns A Promise that resolves to the result of the executor function.
|
|
56
|
-
*/
|
|
57
|
-
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>;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
|
|
60
|
-
//# sourceMappingURL=base-executor.d.ts.map
|
|
1
|
+
import { i as withExecutor, n as PowerlinesExecutorContext, r as WithExecutorOptions, t as PowerlinesExecutorApi } from "../base-executor-BCcpfw61.js";
|
|
2
|
+
export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require('../rolldown-runtime-C24Yb2bl.js');
|
|
3
3
|
let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
4
4
|
let _storm_software_workspace_tools_base_base_executor = require("@storm-software/workspace-tools/base/base-executor");
|
|
5
5
|
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
@@ -11,7 +11,7 @@ let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
|
11
11
|
let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
|
|
12
12
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
13
13
|
let defu = require("defu");
|
|
14
|
-
defu =
|
|
14
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
15
15
|
let jiti = require("jiti");
|
|
16
16
|
|
|
17
17
|
//#region src/base/base-executor.ts
|
|
@@ -34,8 +34,11 @@ function withExecutor(command, executorFn, options = {}) {
|
|
|
34
34
|
if (!context.projectName) throw new Error(`The ${(0, _stryke_string_format_title_case.titleCase)(framework.name)} - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor requires \`projectName\` on the context object.`);
|
|
35
35
|
if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) throw new Error(`The ${(0, _stryke_string_format_title_case.titleCase)(framework.name)} - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor requires \`projectsConfigurations\` on the context object.`);
|
|
36
36
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
37
|
-
const jiti$1 = (0, jiti.createJiti)(
|
|
38
|
-
|
|
37
|
+
const jiti$1 = (0, jiti.createJiti)(require("url").pathToFileURL(__filename).href, {
|
|
38
|
+
cache: false,
|
|
39
|
+
interopDefault: true
|
|
40
|
+
});
|
|
41
|
+
const [{ formatExecutionId, getName }, api] = await Promise.all([jiti$1.import("powerlines/plugin-utils"), jiti$1.import(jiti$1.esmResolve(importPath), { default: true })]);
|
|
39
42
|
try {
|
|
40
43
|
return await Promise.resolve(executorFn((0, defu.default)({
|
|
41
44
|
projectName: context.projectName,
|
|
@@ -31,8 +31,11 @@ function withExecutor(command, executorFn, options = {}) {
|
|
|
31
31
|
if (!context.projectName) throw new Error(`The ${titleCase(framework.name)} - ${titleCase(command)} executor requires \`projectName\` on the context object.`);
|
|
32
32
|
if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) throw new Error(`The ${titleCase(framework.name)} - ${titleCase(command)} executor requires \`projectsConfigurations\` on the context object.`);
|
|
33
33
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
34
|
-
const jiti = createJiti(
|
|
35
|
-
|
|
34
|
+
const jiti = createJiti(import.meta.url, {
|
|
35
|
+
cache: false,
|
|
36
|
+
interopDefault: true
|
|
37
|
+
});
|
|
38
|
+
const [{ formatExecutionId, getName }, api] = await Promise.all([jiti.import("powerlines/plugin-utils"), jiti.import(jiti.esmResolve(importPath), { default: true })]);
|
|
36
39
|
try {
|
|
37
40
|
return await Promise.resolve(executorFn(defu({
|
|
38
41
|
projectName: context.projectName,
|
|
@@ -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 type { ExecutorContext, PromiseExecutor } from \"@nx/devkit\";\nimport { writeError } from \"@storm-software/config-tools/logger\";\nimport type { StormWorkspaceConfig } from \"@storm-software/config/types\";\nimport { withRunExecutor } from \"@storm-software/workspace-tools/base/base-executor\";\nimport type { BaseExecutorResult } from \"@storm-software/workspace-tools/types\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\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 FrameworkOptions,\n InlineConfig,\n Mode,\n OutputConfig\n} from \"powerlines\";\nimport type { 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 * Details about the framework being used in the current execution, which can be used by plugins and other parts of the system to customize behavior based on the framework.\n *\n * @remarks\n * This should only be used by framework plugins to ensure the correct framework name is applied\n *\n * @defaultValue\n * ```ts\n * {\n * name: \"powerlines\",\n * orgId: \"storm-software\"\n * }\n * ```\n */\n framework?: FrameworkOptions;\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 {\n importPath = \"powerlines/api\",\n defaultOptions = {},\n framework = {} as FrameworkOptions\n } = options;\n\n framework.name ??= \"powerlines\";\n framework.orgId ??= \"storm-software\";\n\n return withRunExecutor(\n `${titleCase(framework.name)} - ${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 ${titleCase(framework.name)} - ${titleCase(\n command\n )} 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 ${titleCase(framework.name)} - ${titleCase(\n command\n )} 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 });\n // Load via jiti — static require() of powerlines/plugin-utils fails when Nx\n // registers ts-node + tsconfig paths (maps to ESM .ts source under type:module).\n const [{ formatExecutionId, getName }, api] = await Promise.all([\n jiti.import<{\n formatExecutionId: (\n projectName: string,\n command: string,\n configIndex?: number\n ) => string;\n getName: (cwd: string, root: string) => Promise<string>;\n }>(\"powerlines/plugin-utils\"),\n jiti\n .import<{\n default: (params: ExecutionApiParams) => Promise<void>;\n }>(jiti.esmResolve(importPath))\n .then(mod => mod.default)\n ]);\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 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 ...(isSetArray(options.format)\n ? { format: options.format }\n : {})\n } as OutputConfig,\n resolve:\n isSetArray(options.external) ||\n isSetArray(options.noExternal) ||\n isSet(options.skipNodeModulesBundle)\n ? {\n ...(isSetArray(options.external)\n ? { external: options.external }\n : {}),\n ...(isSetArray(options.noExternal)\n ? { noExternal: options.noExternal }\n : {}),\n ...(isSet(options.skipNodeModulesBundle)\n ? {\n skipNodeModulesBundle:\n options.skipNodeModulesBundle\n }\n : {})\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 const name =\n inlineConfig.name ||\n context.projectName ||\n (await getName(context.root, projectConfig.root));\n\n return api({\n options: defu(defaultOptions, {\n name,\n executionId: formatExecutionId(\n name,\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(\n projectConfig.root,\n `${kebabCase(framework.name)}.config.ts`\n ),\n configIndex: options.configIndex,\n framework\n }) as ExecutionOptions,\n command,\n inlineConfig\n });\n }\n )\n );\n } catch (error) {\n writeError(\n `An error occurred while executing the ${titleCase(\n framework.name\n )} - ${titleCase(command)} 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":";;;;;;;;;;;;;;;;;;;;;;;;;AAsGA,SAAgB,aAGd,SACA,YAQA,UAA+B,CAAC,GACE;CAClC,MAAM,EACJ,aAAa,kBACb,iBAAiB,CAAC,GAClB,YAAY,CA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
+
{"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 type { ExecutorContext, PromiseExecutor } from \"@nx/devkit\";\nimport { writeError } from \"@storm-software/config-tools/logger\";\nimport type { StormWorkspaceConfig } from \"@storm-software/config/types\";\nimport { withRunExecutor } from \"@storm-software/workspace-tools/base/base-executor\";\nimport type { BaseExecutorResult } from \"@storm-software/workspace-tools/types\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\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 FrameworkOptions,\n InlineConfig,\n Mode,\n OutputConfig\n} from \"powerlines\";\nimport type { 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 * Details about the framework being used in the current execution, which can be used by plugins and other parts of the system to customize behavior based on the framework.\n *\n * @remarks\n * This should only be used by framework plugins to ensure the correct framework name is applied\n *\n * @defaultValue\n * ```ts\n * {\n * name: \"powerlines\",\n * orgId: \"storm-software\"\n * }\n * ```\n */\n framework?: FrameworkOptions;\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 {\n importPath = \"powerlines/api\",\n defaultOptions = {},\n framework = {} as FrameworkOptions\n } = options;\n\n framework.name ??= \"powerlines\";\n framework.orgId ??= \"storm-software\";\n\n return withRunExecutor(\n `${titleCase(framework.name)} - ${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 ${titleCase(framework.name)} - ${titleCase(\n command\n )} 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 ${titleCase(framework.name)} - ${titleCase(\n command\n )} executor requires \\`projectsConfigurations\\` on the context object.`\n );\n }\n\n const projectConfig =\n context.projectsConfigurations.projects[context.projectName]!;\n\n const jiti = createJiti(import.meta.url, {\n cache: false,\n interopDefault: true\n });\n // Load via jiti — static require() of powerlines/plugin-utils fails when Nx\n // registers ts-node + tsconfig paths (maps to ESM .ts source under type:module).\n const [{ formatExecutionId, getName }, api] = await Promise.all([\n jiti.import<{\n formatExecutionId: (\n projectName: string,\n command: string,\n configIndex?: number\n ) => string;\n getName: (cwd: string, root: string) => Promise<string>;\n }>(\"powerlines/plugin-utils\"),\n jiti.import<(params: ExecutionApiParams) => Promise<void>>(\n jiti.esmResolve(importPath),\n { default: true }\n )\n ]);\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 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 ...(isSetArray(options.format)\n ? { format: options.format }\n : {})\n } as OutputConfig,\n resolve:\n isSetArray(options.external) ||\n isSetArray(options.noExternal) ||\n isSet(options.skipNodeModulesBundle)\n ? {\n ...(isSetArray(options.external)\n ? { external: options.external }\n : {}),\n ...(isSetArray(options.noExternal)\n ? { noExternal: options.noExternal }\n : {}),\n ...(isSet(options.skipNodeModulesBundle)\n ? {\n skipNodeModulesBundle:\n options.skipNodeModulesBundle\n }\n : {})\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 const name =\n inlineConfig.name ||\n context.projectName ||\n (await getName(context.root, projectConfig.root));\n\n return api({\n options: defu(defaultOptions, {\n name,\n executionId: formatExecutionId(\n name,\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(\n projectConfig.root,\n `${kebabCase(framework.name)}.config.ts`\n ),\n configIndex: options.configIndex,\n framework\n }) as ExecutionOptions,\n command,\n inlineConfig\n });\n }\n )\n );\n } catch (error) {\n writeError(\n `An error occurred while executing the ${titleCase(\n framework.name\n )} - ${titleCase(command)} 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":";;;;;;;;;;;;;;;;;;;;;;;;;AAsGA,SAAgB,aAGd,SACA,YAQA,UAA+B,CAAC,GACE;CAClC,MAAM,EACJ,aAAa,kBACb,iBAAiB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CACF;AACF"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//#endregion
|
|
4
|
-
export { _default as default };
|
|
5
|
-
//# sourceMappingURL=base-executor.untyped.d.mts.map
|
|
1
|
+
import { t as _default } from "../base-executor.untyped-DJ2f40oh.mjs";
|
|
2
|
+
export { _default as default };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export = _default;
|
|
4
|
-
//# sourceMappingURL=base-executor.untyped.d.ts.map
|
|
1
|
+
import { t as _default } from "../base-executor.untyped-DJ2f40oh.js";
|
|
2
|
+
export = _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as withExecutor, n as PowerlinesExecutorContext, r as WithExecutorOptions, t as PowerlinesExecutorApi } from "../base-executor-C9j1WGyX.mjs";
|
|
2
2
|
export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
|
package/dist/src/base/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as withExecutor, n as PowerlinesExecutorContext, r as WithExecutorOptions, t as PowerlinesExecutorApi } from "../base-executor-BCcpfw61.js";
|
|
2
2
|
export { PowerlinesExecutorApi, PowerlinesExecutorContext, WithExecutorOptions, withExecutor };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { BaseExecutorSchema } from "./base/base-executor.schema.js";
|
|
2
|
+
import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
|
|
3
|
+
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
4
|
+
import { BaseExecutorResult } from "@storm-software/workspace-tools/types";
|
|
5
|
+
import { DeepPartial } from "@stryke/types/base";
|
|
6
|
+
import { ExecutionOptions, FrameworkOptions, InlineConfig } from "powerlines";
|
|
7
|
+
//#region src/base/base-executor.d.ts
|
|
8
|
+
type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema> = ExecutorContext & {
|
|
9
|
+
projectName: string;
|
|
10
|
+
command: string;
|
|
11
|
+
options: TExecutorSchema;
|
|
12
|
+
inlineConfig: InlineConfig;
|
|
13
|
+
workspaceConfig: StormWorkspaceConfig;
|
|
14
|
+
};
|
|
15
|
+
type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
|
|
16
|
+
interface WithExecutorOptions {
|
|
17
|
+
/**
|
|
18
|
+
* 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.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue "powerlines/api"
|
|
21
|
+
*/
|
|
22
|
+
importPath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 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.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* 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.
|
|
28
|
+
*/
|
|
29
|
+
defaultOptions?: DeepPartial<ExecutionOptions>;
|
|
30
|
+
/**
|
|
31
|
+
* Details about the framework being used in the current execution, which can be used by plugins and other parts of the system to customize behavior based on the framework.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This should only be used by framework plugins to ensure the correct framework name is applied
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue
|
|
37
|
+
* ```ts
|
|
38
|
+
* {
|
|
39
|
+
* name: "powerlines",
|
|
40
|
+
* orgId: "storm-software"
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
framework?: FrameworkOptions;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
|
|
51
|
+
*
|
|
52
|
+
* @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
|
|
53
|
+
* @param executorFn - The function that will be executed when the command is run.
|
|
54
|
+
* @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
|
|
55
|
+
* @returns A Promise that resolves to the result of the executor function.
|
|
56
|
+
*/
|
|
57
|
+
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>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { withExecutor as i, PowerlinesExecutorContext as n, WithExecutorOptions as r, PowerlinesExecutorApi as t };
|
|
60
|
+
//# sourceMappingURL=base-executor-BCcpfw61.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-executor-BCcpfw61.d.ts","names":[],"sources":["../../src/base/base-executor.ts"],"mappings":";;;;;;;KA4CY,0BACV,wBAAwB,qBAAqB,sBAC3C;EACF;EACA;EACA,SAAS;EACT,cAAc;EACd,iBAAiB;;KAGP,yBACV,cAAc,iBACX;UAEY;;;;;;EAMf;;;;;;;EAQA,iBAAiB,YAAY;;;;;;;;;;;;;;;EAgB7B,YAAY;;;;;;;;;;;;;iBAcE,aACd,wBAAwB,qBAAqB,oBAE7C,iBACA,aACE,SAAS,0BAA0B,kBACnC,KAAK,0BAEH,QAAQ,yCACR,uCAGJ,UAAS,sBACR,gBAAgB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { BaseExecutorSchema } from "./base/base-executor.schema.mjs";
|
|
2
|
+
import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
|
|
3
|
+
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
4
|
+
import { BaseExecutorResult } from "@storm-software/workspace-tools/types";
|
|
5
|
+
import { DeepPartial } from "@stryke/types/base";
|
|
6
|
+
import { ExecutionOptions, FrameworkOptions, InlineConfig } from "powerlines";
|
|
7
|
+
//#region src/base/base-executor.d.ts
|
|
8
|
+
type PowerlinesExecutorContext<TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema> = ExecutorContext & {
|
|
9
|
+
projectName: string;
|
|
10
|
+
command: string;
|
|
11
|
+
options: TExecutorSchema;
|
|
12
|
+
inlineConfig: InlineConfig;
|
|
13
|
+
workspaceConfig: StormWorkspaceConfig;
|
|
14
|
+
};
|
|
15
|
+
type PowerlinesExecutorApi = (inlineConfig: InlineConfig) => Promise<void>;
|
|
16
|
+
interface WithExecutorOptions {
|
|
17
|
+
/**
|
|
18
|
+
* 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.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue "powerlines/api"
|
|
21
|
+
*/
|
|
22
|
+
importPath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 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.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* 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.
|
|
28
|
+
*/
|
|
29
|
+
defaultOptions?: DeepPartial<ExecutionOptions>;
|
|
30
|
+
/**
|
|
31
|
+
* Details about the framework being used in the current execution, which can be used by plugins and other parts of the system to customize behavior based on the framework.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This should only be used by framework plugins to ensure the correct framework name is applied
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue
|
|
37
|
+
* ```ts
|
|
38
|
+
* {
|
|
39
|
+
* name: "powerlines",
|
|
40
|
+
* orgId: "storm-software"
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
framework?: FrameworkOptions;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
|
|
51
|
+
*
|
|
52
|
+
* @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
|
|
53
|
+
* @param executorFn - The function that will be executed when the command is run.
|
|
54
|
+
* @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
|
|
55
|
+
* @returns A Promise that resolves to the result of the executor function.
|
|
56
|
+
*/
|
|
57
|
+
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>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { withExecutor as i, PowerlinesExecutorContext as n, WithExecutorOptions as r, PowerlinesExecutorApi as t };
|
|
60
|
+
//# sourceMappingURL=base-executor-C9j1WGyX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-executor-C9j1WGyX.d.mts","names":[],"sources":["../../src/base/base-executor.ts"],"mappings":";;;;;;;KA4CY,0BACV,wBAAwB,qBAAqB,sBAC3C;EACF;EACA;EACA,SAAS;EACT,cAAc;EACd,iBAAiB;;KAGP,yBACV,cAAc,iBACX;UAEY;;;;;;EAMf;;;;;;;EAQA,iBAAiB,YAAY;;;;;;;;;;;;;;;EAgB7B,YAAY;;;;;;;;;;;;;iBAcE,aACd,wBAAwB,qBAAqB,oBAE7C,iBACA,aACE,SAAS,0BAA0B,kBACnC,KAAK,0BAEH,QAAQ,yCACR,uCAGJ,UAAS,sBACR,gBAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-executor.untyped-DJ2f40oh.d.mts","names":[],"sources":["../../src/base/base-executor.untyped.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-executor.untyped-DJ2f40oh.d.ts","names":[],"sources":["../../src/base/base-executor.untyped.ts"],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/helpers/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A list of Nx input strings that describe the Powerlines configuration file
|
|
4
|
+
*/
|
|
5
|
+
declare const CONFIG_INPUTS: readonly ["{projectRoot}/{framework}.json", "{projectRoot}/{framework}.*.json", "{projectRoot}/{framework}.jsonc", "{projectRoot}/{framework}.*.jsonc", "{projectRoot}/{framework}.json5", "{projectRoot}/{framework}.*.json5", "{projectRoot}/{framework}.yaml", "{projectRoot}/{framework}.*.yaml", "{projectRoot}/{framework}.yml", "{projectRoot}/{framework}.*.yml", "{projectRoot}/{framework}.toml", "{projectRoot}/{framework}.*.toml", "{projectRoot}/{framework}.config.js", "{projectRoot}/{framework}.*.config.js", "{projectRoot}/{framework}.config.cjs", "{projectRoot}/{framework}.*.config.cjs", "{projectRoot}/{framework}.config.mjs", "{projectRoot}/{framework}.*.config.mjs", "{projectRoot}/{framework}.config.ts", "{projectRoot}/{framework}.*.config.ts", "{projectRoot}/{framework}.config.cts", "{projectRoot}/{framework}.*.config.cts", "{projectRoot}/{framework}.config.mts", "{projectRoot}/{framework}.*.config.mts"];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { CONFIG_INPUTS as t };
|
|
8
|
+
//# sourceMappingURL=constants-QuvxQ1Kt.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-QuvxQ1Kt.d.mts","names":[],"sources":["../../src/helpers/constants.ts"],"mappings":";;;;cAqBa"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/helpers/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A list of Nx input strings that describe the Powerlines configuration file
|
|
4
|
+
*/
|
|
5
|
+
declare const CONFIG_INPUTS: readonly ["{projectRoot}/{framework}.json", "{projectRoot}/{framework}.*.json", "{projectRoot}/{framework}.jsonc", "{projectRoot}/{framework}.*.jsonc", "{projectRoot}/{framework}.json5", "{projectRoot}/{framework}.*.json5", "{projectRoot}/{framework}.yaml", "{projectRoot}/{framework}.*.yaml", "{projectRoot}/{framework}.yml", "{projectRoot}/{framework}.*.yml", "{projectRoot}/{framework}.toml", "{projectRoot}/{framework}.*.toml", "{projectRoot}/{framework}.config.js", "{projectRoot}/{framework}.*.config.js", "{projectRoot}/{framework}.config.cjs", "{projectRoot}/{framework}.*.config.cjs", "{projectRoot}/{framework}.config.mjs", "{projectRoot}/{framework}.*.config.mjs", "{projectRoot}/{framework}.config.ts", "{projectRoot}/{framework}.*.config.ts", "{projectRoot}/{framework}.config.cts", "{projectRoot}/{framework}.*.config.cts", "{projectRoot}/{framework}.config.mts", "{projectRoot}/{framework}.*.config.mts"];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { CONFIG_INPUTS as t };
|
|
8
|
+
//# sourceMappingURL=constants-QuvxQ1Kt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-QuvxQ1Kt.d.ts","names":[],"sources":["../../src/helpers/constants.ts"],"mappings":";;;;cAqBa"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor = require('../../base/base-executor.js');
|
|
2
2
|
|
|
3
3
|
//#region src/executors/build/executor.ts
|
|
4
4
|
async function executorFn(context, api) {
|
|
5
5
|
await api(context.inlineConfig);
|
|
6
6
|
return { success: true };
|
|
7
7
|
}
|
|
8
|
-
const executor =
|
|
8
|
+
const executor = require_base_base_executor.withExecutor("build", executorFn);
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
module.exports = executor;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor = require('../../base/base-executor.js');
|
|
2
2
|
|
|
3
3
|
//#region src/executors/clean/executor.ts
|
|
4
4
|
async function executorFn(context, api) {
|
|
5
5
|
await api(context.inlineConfig);
|
|
6
6
|
return { success: true };
|
|
7
7
|
}
|
|
8
|
-
const executor =
|
|
8
|
+
const executor = require_base_base_executor.withExecutor("clean", executorFn);
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
module.exports = executor;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor_untyped = require('../../base/base-executor.untyped.js');
|
|
2
2
|
let untyped = require("untyped");
|
|
3
3
|
|
|
4
4
|
//#region src/executors/clean/untyped.ts
|
|
5
5
|
var untyped_default = (0, untyped.defineUntypedSchema)({
|
|
6
|
-
...
|
|
6
|
+
...require_base_base_executor_untyped,
|
|
7
7
|
$schema: {
|
|
8
8
|
id: "CleanExecutorSchema",
|
|
9
9
|
title: "Clean Executor",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import base_executor_untyped_default from "../../base/base-executor.untyped.mjs";
|
|
2
2
|
import { defineUntypedSchema } from "untyped";
|
|
3
3
|
|
|
4
4
|
//#region src/executors/clean/untyped.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor = require('../../base/base-executor.js');
|
|
2
2
|
|
|
3
3
|
//#region src/executors/docs/executor.ts
|
|
4
4
|
async function executorFn(context, api) {
|
|
5
5
|
await api(context.inlineConfig);
|
|
6
6
|
return { success: true };
|
|
7
7
|
}
|
|
8
|
-
const executor =
|
|
8
|
+
const executor = require_base_base_executor.withExecutor("docs", executorFn);
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
module.exports = executor;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor = require('../../base/base-executor.js');
|
|
2
2
|
|
|
3
3
|
//#region src/executors/lint/executor.ts
|
|
4
4
|
async function executorFn(context, api) {
|
|
5
5
|
await api(context.inlineConfig);
|
|
6
6
|
return { success: true };
|
|
7
7
|
}
|
|
8
|
-
const executor =
|
|
8
|
+
const executor = require_base_base_executor.withExecutor("lint", executorFn);
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
module.exports = executor;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor = require('../../base/base-executor.js');
|
|
2
2
|
|
|
3
3
|
//#region src/executors/prepare/executor.ts
|
|
4
4
|
async function executorFn(context, api) {
|
|
5
5
|
await api(context.inlineConfig);
|
|
6
6
|
return { success: true };
|
|
7
7
|
}
|
|
8
|
-
const executor =
|
|
8
|
+
const executor = require_base_base_executor.withExecutor("prepare", executorFn);
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
module.exports = executor;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_base_base_executor_untyped = require('../../base/base-executor.untyped.js');
|
|
2
2
|
let untyped = require("untyped");
|
|
3
3
|
|
|
4
4
|
//#region src/executors/prepare/untyped.ts
|
|
5
5
|
var untyped_default = (0, untyped.defineUntypedSchema)({
|
|
6
|
-
...
|
|
6
|
+
...require_base_base_executor_untyped,
|
|
7
7
|
$schema: {
|
|
8
8
|
id: "PrepareExecutorSchema",
|
|
9
9
|
title: "Prepare Executor",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import base_executor_untyped_default from "../../base/base-executor.untyped.mjs";
|
|
2
2
|
import { defineUntypedSchema } from "untyped";
|
|
3
3
|
|
|
4
4
|
//#region src/executors/prepare/untyped.ts
|