@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.
Files changed (85) hide show
  1. package/dist/src/base/base-executor.d.mts +2 -60
  2. package/dist/src/base/base-executor.d.ts +2 -60
  3. package/dist/src/base/base-executor.js +7 -4
  4. package/dist/src/base/base-executor.mjs +5 -2
  5. package/dist/src/base/base-executor.mjs.map +1 -1
  6. package/dist/src/base/base-executor.untyped.d.mts +2 -5
  7. package/dist/src/base/base-executor.untyped.d.ts +2 -4
  8. package/dist/src/base/index.d.mts +1 -1
  9. package/dist/src/base/index.d.ts +1 -1
  10. package/dist/src/base-executor-BCcpfw61.d.ts +60 -0
  11. package/dist/src/base-executor-BCcpfw61.d.ts.map +1 -0
  12. package/dist/src/base-executor-C9j1WGyX.d.mts +60 -0
  13. package/dist/src/base-executor-C9j1WGyX.d.mts.map +1 -0
  14. package/dist/src/base-executor.untyped-DJ2f40oh.d.mts +5 -0
  15. package/dist/src/base-executor.untyped-DJ2f40oh.d.mts.map +1 -0
  16. package/dist/src/base-executor.untyped-DJ2f40oh.d.ts +5 -0
  17. package/dist/src/base-executor.untyped-DJ2f40oh.d.ts.map +1 -0
  18. package/dist/src/constants-QuvxQ1Kt.d.mts +8 -0
  19. package/dist/src/constants-QuvxQ1Kt.d.mts.map +1 -0
  20. package/dist/src/constants-QuvxQ1Kt.d.ts +8 -0
  21. package/dist/src/constants-QuvxQ1Kt.d.ts.map +1 -0
  22. package/dist/src/executors/build/executor.js +2 -2
  23. package/dist/src/executors/build/executor.mjs +1 -1
  24. package/dist/src/executors/clean/executor.js +2 -2
  25. package/dist/src/executors/clean/executor.mjs +1 -1
  26. package/dist/src/executors/clean/untyped.js +2 -2
  27. package/dist/src/executors/clean/untyped.mjs +1 -1
  28. package/dist/src/executors/docs/executor.js +2 -2
  29. package/dist/src/executors/docs/executor.mjs +1 -1
  30. package/dist/src/executors/lint/executor.js +2 -2
  31. package/dist/src/executors/lint/executor.mjs +1 -1
  32. package/dist/src/executors/prepare/executor.js +2 -2
  33. package/dist/src/executors/prepare/executor.mjs +1 -1
  34. package/dist/src/executors/prepare/untyped.js +2 -2
  35. package/dist/src/executors/prepare/untyped.mjs +1 -1
  36. package/dist/src/helpers/constants.d.mts +2 -8
  37. package/dist/src/helpers/constants.d.ts +2 -8
  38. package/dist/src/helpers/index.d.mts +2 -2
  39. package/dist/src/helpers/index.d.ts +2 -2
  40. package/dist/src/helpers/plugin-utilities.d.mts +2 -56
  41. package/dist/src/helpers/plugin-utilities.d.ts +2 -56
  42. package/dist/src/helpers/plugin-utilities.js +2 -2
  43. package/dist/src/helpers/plugin-utilities.mjs +2 -2
  44. package/dist/src/helpers/plugin-utilities.mjs.map +1 -1
  45. package/dist/src/index.d.mts +4 -4
  46. package/dist/src/index.d.ts +4 -4
  47. package/dist/src/index.js +1 -0
  48. package/dist/src/index.mjs +1 -0
  49. package/dist/src/plugin/index.d.mts +1 -286
  50. package/dist/src/plugin/index.d.mts.map +1 -1
  51. package/dist/src/plugin/index.d.ts +1 -286
  52. package/dist/src/plugin/index.d.ts.map +1 -1
  53. package/dist/src/plugin/index.js +2 -284
  54. package/dist/src/plugin/index.mjs +1 -281
  55. package/dist/src/plugin/index.mjs.map +1 -1
  56. package/dist/src/plugin-B94-9IvO.d.mts +288 -0
  57. package/dist/src/plugin-B94-9IvO.d.mts.map +1 -0
  58. package/dist/src/plugin-B94-9IvO.d.ts +288 -0
  59. package/dist/src/plugin-B94-9IvO.d.ts.map +1 -0
  60. package/dist/src/plugin-utilities-TozKPwW0.d.ts +56 -0
  61. package/dist/src/plugin-utilities-TozKPwW0.d.ts.map +1 -0
  62. package/dist/src/plugin-utilities-dOdjrrHD.d.mts +56 -0
  63. package/dist/src/plugin-utilities-dOdjrrHD.d.mts.map +1 -0
  64. package/dist/src/types/index.d.mts +1 -1
  65. package/dist/src/types/index.d.ts +1 -1
  66. package/dist/src/types/plugin.d.mts +2 -288
  67. package/dist/src/types/plugin.d.ts +2 -288
  68. package/package.json +3 -3
  69. package/dist/src/_virtual/_rolldown/runtime.js +0 -28
  70. package/dist/src/base/base-executor.d.mts.map +0 -1
  71. package/dist/src/base/base-executor.d.ts.map +0 -1
  72. package/dist/src/base/base-executor.untyped.d.mts.map +0 -1
  73. package/dist/src/base/base-executor.untyped.d.ts.map +0 -1
  74. package/dist/src/base-executor-BVYmsZ3I.mjs +0 -114
  75. package/dist/src/base-executor-BVYmsZ3I.mjs.map +0 -1
  76. package/dist/src/base-executor-CBgW5wY1.js +0 -120
  77. package/dist/src/base-executor.untyped-But-48Iy.js +0 -183
  78. package/dist/src/base-executor.untyped-Bz2f75UY.mjs +0 -179
  79. package/dist/src/base-executor.untyped-Bz2f75UY.mjs.map +0 -1
  80. package/dist/src/helpers/constants.d.mts.map +0 -1
  81. package/dist/src/helpers/constants.d.ts.map +0 -1
  82. package/dist/src/helpers/plugin-utilities.d.mts.map +0 -1
  83. package/dist/src/helpers/plugin-utilities.d.ts.map +0 -1
  84. package/dist/src/types/plugin.d.mts.map +0 -1
  85. package/dist/src/types/plugin.d.ts.map +0 -1
@@ -1,288 +1,2 @@
1
- //#region src/types/plugin.d.ts
2
- interface NxPluginOptions {
3
- /**
4
- * Configuration options for the clean target added by the Nx plugin
5
- */
6
- clean?: false | {
7
- /**
8
- * The name of the clean target to use when cleaning the project
9
- *
10
- * @defaultValue "clean"
11
- */
12
- targetName?: string;
13
- /**
14
- * An indicator to control the behavior of Nx caching for the target
15
- *
16
- * @defaultValue true
17
- */
18
- cache?: boolean;
19
- /**
20
- * The name of the clean configuration to use when cleaning the project
21
- *
22
- * @defaultValue "production"
23
- */
24
- defaultConfiguration?: "production" | "test" | "development";
25
- /**
26
- * An array specifying any other target identifiers the clean target depends on
27
- *
28
- * @defaultValue ["^clean"]
29
- */
30
- dependsOn?: string[];
31
- /**
32
- * An array specifying any input files or globs to consider when determining if the clean target needs to be re-run
33
- */
34
- inputs?: string[] | "production" | "allProjectFiles" | "sharedGlobals" | "testing" | "linting" | "documentation" | "rust" | "typescript";
35
- /**
36
- * An array specifying the output files or globs generated by the clean target
37
- */
38
- outputs?: string[];
39
- /**
40
- * The executor to use for the clean target
41
- *
42
- * @defaultValue "\@powerlines/nx:clean"
43
- */
44
- executor?: string;
45
- };
46
- /**
47
- * Configuration options for the prepare target added by the Nx plugin
48
- */
49
- prepare?: false | {
50
- /**
51
- * The name of the prepare target to use when preparing the project
52
- *
53
- * @defaultValue "prepare"
54
- */
55
- targetName?: string;
56
- /**
57
- * An indicator to control the behavior of Nx caching for the target
58
- *
59
- * @defaultValue true
60
- */
61
- cache?: boolean;
62
- /**
63
- * The name of the prepare configuration to use when preparing the project
64
- *
65
- * @defaultValue "production"
66
- */
67
- defaultConfiguration?: "production" | "test" | "development";
68
- /**
69
- * An array specifying any other target identifiers the prepare target depends on
70
- *
71
- * @defaultValue ["^build", "clean"]
72
- */
73
- dependsOn?: string[];
74
- /**
75
- * An array specifying any input files or globs to consider when determining if the prepare target needs to be re-run
76
- */
77
- inputs?: string[] | "production" | "allProjectFiles" | "sharedGlobals" | "testing" | "linting" | "documentation" | "rust" | "typescript";
78
- /**
79
- * An array specifying the output files or globs generated by the prepare target
80
- */
81
- outputs?: string[];
82
- /**
83
- * The executor to use for the prepare target
84
- *
85
- * @defaultValue "\@powerlines/nx:prepare"
86
- */
87
- executor?: string;
88
- };
89
- /**
90
- * Configuration options for the lint target added by the Nx plugin
91
- */
92
- lint?: false | {
93
- /**
94
- * The name of the lint target to use when linting the project
95
- *
96
- * @defaultValue "lint"
97
- */
98
- targetName?: string;
99
- /**
100
- * An indicator to control the behavior of Nx caching for the target
101
- *
102
- * @defaultValue true
103
- */
104
- cache?: boolean;
105
- /**
106
- * The name of the lint configuration to use when linting the project
107
- *
108
- * @defaultValue "production"
109
- */
110
- defaultConfiguration?: "production" | "test" | "development";
111
- /**
112
- * An array specifying any other target identifiers the lint target depends on
113
- *
114
- * @defaultValue ["^lint"]
115
- */
116
- dependsOn?: string[];
117
- /**
118
- * An array specifying any input files or globs to consider when determining if the lint target needs to be re-run
119
- */
120
- inputs?: string[] | "production" | "allProjectFiles" | "sharedGlobals" | "testing" | "linting" | "documentation" | "rust" | "typescript";
121
- /**
122
- * An array specifying the output files or globs generated by the lint target
123
- */
124
- outputs?: string[];
125
- /**
126
- * The executor to use for the lint target
127
- *
128
- * @defaultValue "\@powerlines/nx:lint"
129
- */
130
- executor?: string;
131
- };
132
- /**
133
- * Configuration options for the build target added by the Nx plugin
134
- */
135
- build?: false | {
136
- /**
137
- * The name of the build target to use when building the project
138
- *
139
- * @defaultValue "build"
140
- */
141
- targetName?: string;
142
- /**
143
- * An indicator to control the behavior of Nx caching for the target
144
- *
145
- * @defaultValue true
146
- */
147
- cache?: boolean;
148
- /**
149
- * The name of the build configuration to use when building the project
150
- *
151
- * @defaultValue "production"
152
- */
153
- defaultConfiguration?: "production" | "test" | "development";
154
- /**
155
- * An array specifying any other target identifiers the build target depends on
156
- *
157
- * @defaultValue ["^build"]
158
- */
159
- dependsOn?: string[];
160
- /**
161
- * An array specifying any input files or globs to consider when determining if the build target needs to be re-run
162
- */
163
- inputs?: string[] | "production" | "allProjectFiles" | "sharedGlobals" | "testing" | "linting" | "documentation" | "rust" | "typescript";
164
- /**
165
- * An array specifying the output files or globs generated by the build target
166
- */
167
- outputs?: string[];
168
- /**
169
- * The executor to use for the build target
170
- *
171
- * @defaultValue "\@powerlines/nx:build"
172
- */
173
- executor?: string;
174
- };
175
- /**
176
- * Configuration options for the docs target added by the Nx plugin
177
- */
178
- docs?: false | {
179
- /**
180
- * The name of the docs target to use when generating documentation for the project
181
- *
182
- * @defaultValue "docs"
183
- */
184
- targetName?: string;
185
- /**
186
- * An indicator to control the behavior of Nx caching for the target
187
- *
188
- * @defaultValue true
189
- */
190
- cache?: boolean;
191
- /**
192
- * The name of the docs configuration to use when generating documentation for the project
193
- *
194
- * @defaultValue "production"
195
- */
196
- defaultConfiguration?: "production" | "test" | "development";
197
- /**
198
- * An array specifying any other target identifiers the docs target depends on
199
- *
200
- * @defaultValue ["^docs", "build"]
201
- */
202
- dependsOn?: string[];
203
- /**
204
- * An array specifying any input files or globs to consider when determining if the docs target needs to be re-run
205
- */
206
- inputs?: string[] | "production" | "allProjectFiles" | "sharedGlobals" | "testing" | "linting" | "documentation" | "rust" | "typescript";
207
- /**
208
- * An array specifying the output files or globs generated by the docs target
209
- */
210
- outputs?: string[];
211
- /**
212
- * The executor to use for the docs target
213
- *
214
- * @defaultValue "\@powerlines/nx:docs"
215
- */
216
- executor?: string;
217
- };
218
- /**
219
- * Configuration options for the deploy target added by the Nx plugin
220
- */
221
- deploy?: false | {
222
- /**
223
- * The name of the deploy target to use when deploying the project
224
- *
225
- * @defaultValue "deploy"
226
- */
227
- targetName?: string;
228
- /**
229
- * An indicator to control the behavior of Nx caching for the target
230
- *
231
- * @defaultValue false
232
- */
233
- cache?: boolean;
234
- /**
235
- * The name of the deploy configuration to use when deploying the project
236
- *
237
- * @defaultValue "production"
238
- */
239
- defaultConfiguration?: "production" | "test" | "development";
240
- /**
241
- * An array specifying any other target identifiers the deploy target depends on
242
- *
243
- * @defaultValue ["^deploy", "build"]
244
- */
245
- dependsOn?: string[];
246
- /**
247
- * An array specifying any input files or globs to consider when determining if the deploy target needs to be re-run
248
- */
249
- inputs?: string[] | "production" | "allProjectFiles" | "sharedGlobals" | "rust" | "typescript";
250
- /**
251
- * An array specifying the output files or globs generated by the deploy target
252
- */
253
- outputs?: string[];
254
- /**
255
- * The executor to use for the deploy target
256
- *
257
- * @defaultValue "\@powerlines/nx:deploy"
258
- */
259
- executor?: string;
260
- };
261
- /**
262
- * Whether to enable verbose logging for the Nx plugin.
263
- *
264
- * @remarks
265
- * If enabled, the plugin will log more detailed information about its operations, which can be useful for debugging and troubleshooting.
266
- *
267
- * @defaultValue false
268
- */
269
- verboseOutput?: boolean;
270
- /**
271
- * Enable resolver debug logging for the plugin
272
- *
273
- * @defaultValue false
274
- */
275
- debug?: boolean;
276
- /**
277
- * An indicator to control the behavior of Nx caching for all of the targets
278
- *
279
- * @remarks
280
- * The `cache` value on the target specific options will override the value provided in this field.
281
- *
282
- * @defaultValue true
283
- */
284
- cache?: boolean;
285
- }
286
- //#endregion
287
- export { NxPluginOptions };
288
- //# sourceMappingURL=plugin.d.ts.map
1
+ import { t as NxPluginOptions } from "../plugin-B94-9IvO.js";
2
+ export { NxPluginOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/nx",
3
- "version": "0.13.249",
3
+ "version": "0.13.250",
4
4
  "private": false,
5
5
  "description": "A Nx plugin to support Powerlines development in Nx monorepos.",
6
6
  "repository": {
@@ -196,7 +196,7 @@
196
196
  "@stryke/type-checks": "^0.6.41",
197
197
  "defu": "^6.1.7",
198
198
  "jiti": "^2.7.0",
199
- "powerlines": "^0.47.209"
199
+ "powerlines": "^0.47.210"
200
200
  },
201
201
  "devDependencies": {
202
202
  "@nx/workspace": "23.1.0",
@@ -216,5 +216,5 @@
216
216
  "publishConfig": { "access": "public" },
217
217
  "executors": "./executors.json",
218
218
  "generators": "./generators.json",
219
- "gitHead": "88974b224a5cdb97dbd377373c9ed7f8a8780324"
219
+ "gitHead": "4ee69b33975e2fa912d2c73700dc7e949f25b2d4"
220
220
  }
@@ -1,28 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- exports.__toESM = __toESM;
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-executor.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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-executor.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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-executor.untyped.d.mts","names":[],"sources":["../../../src/base/base-executor.untyped.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-executor.untyped.d.ts","names":[],"sources":["../../../src/base/base-executor.untyped.ts"],"mappings":""}
@@ -1,114 +0,0 @@
1
- import { kebabCase } from "@stryke/string-format/kebab-case";
2
- import { titleCase } from "@stryke/string-format/title-case";
3
- import { isError } from "@stryke/type-checks/is-error";
4
- import { isSetObject } from "@stryke/type-checks/is-set-object";
5
- import defu from "defu";
6
- import { writeError } from "@storm-software/config-tools/logger";
7
- import { withRunExecutor } from "@storm-software/workspace-tools/base/base-executor";
8
- import { omit } from "@stryke/helpers/omit";
9
- import { joinPaths } from "@stryke/path/join";
10
- import { isSet } from "@stryke/type-checks/is-set";
11
- import { isSetArray } from "@stryke/type-checks/is-set-array";
12
- import { createJiti } from "jiti";
13
-
14
- //#region src/base/base-executor.ts
15
- /**
16
- * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
17
- *
18
- * @remarks
19
- * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
20
- *
21
- * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
22
- * @param executorFn - The function that will be executed when the command is run.
23
- * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
24
- * @returns A Promise that resolves to the result of the executor function.
25
- */
26
- function withExecutor(command, executorFn, options = {}) {
27
- const { importPath = "powerlines/api", defaultOptions = {}, framework = {} } = options;
28
- framework.name ??= "powerlines";
29
- framework.orgId ??= "storm-software";
30
- return withRunExecutor(`${titleCase(framework.name)} - ${titleCase(command)} executor`, async (options, context, workspaceConfig) => {
31
- if (!context.projectName) throw new Error(`The ${titleCase(framework.name)} - ${titleCase(command)} executor requires \`projectName\` on the context object.`);
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
- const projectConfig = context.projectsConfigurations.projects[context.projectName];
34
- const jiti = createJiti(context.root, { cache: false });
35
- const [{ formatExecutionId, getName }, api] = await Promise.all([jiti.import("powerlines/plugin-utils"), jiti.import(jiti.esmResolve(importPath)).then((mod) => mod.default)]);
36
- try {
37
- return await Promise.resolve(executorFn(defu({
38
- projectName: context.projectName,
39
- options,
40
- workspaceConfig,
41
- command,
42
- inlineConfig: defu({
43
- command,
44
- root: projectConfig.root,
45
- configFile: options.configFile || options.config,
46
- configIndex: options.configIndex,
47
- projectType: projectConfig.projectType,
48
- mode: options.mode,
49
- output: {
50
- path: options.outputPath,
51
- copy: options.copyPath === false ? false : {
52
- path: options.copyPath,
53
- assets: options.assets
54
- },
55
- minify: options.minify,
56
- sourceMap: options.sourceMap,
57
- ...isSetArray(options.format) ? { format: options.format } : {}
58
- },
59
- resolve: isSetArray(options.external) || isSetArray(options.noExternal) || isSet(options.skipNodeModulesBundle) ? {
60
- ...isSetArray(options.external) ? { external: options.external } : {},
61
- ...isSetArray(options.noExternal) ? { noExternal: options.noExternal } : {},
62
- ...isSet(options.skipNodeModulesBundle) ? { skipNodeModulesBundle: options.skipNodeModulesBundle } : {}
63
- } : void 0,
64
- define: isSetObject(options.define) ? options.define : void 0,
65
- assets: isSetObject(options.assets) ? options.assets : void 0
66
- }, omit(options, [
67
- "config",
68
- "configFile",
69
- "outputPath",
70
- "copyPath",
71
- "sourceMap",
72
- "minify",
73
- "format",
74
- "external",
75
- "noExternal",
76
- "skipNodeModulesBundle",
77
- "mode",
78
- "define",
79
- "assets"
80
- ]))
81
- }, context), async (inlineConfig) => {
82
- const name = inlineConfig.name || context.projectName || await getName(context.root, projectConfig.root);
83
- return api({
84
- options: defu(defaultOptions, {
85
- name,
86
- executionId: formatExecutionId(name, command, options.configIndex ?? 0),
87
- cwd: context.root,
88
- root: projectConfig.root,
89
- configFile: options.configFile || options.config || joinPaths(projectConfig.root, `${kebabCase(framework.name)}.config.ts`),
90
- configIndex: options.configIndex,
91
- framework
92
- }),
93
- command,
94
- inlineConfig
95
- });
96
- }));
97
- } catch (error) {
98
- writeError(`An error occurred while executing the ${titleCase(framework.name)} - ${titleCase(command)} executor: ${isError(error) ? `${error.message}
99
-
100
- ${error.stack}` : "Unknown error"}`);
101
- return { success: false };
102
- }
103
- }, {
104
- skipReadingConfig: false,
105
- hooks: { applyDefaultOptions: (options) => {
106
- options.copyPath ??= "dist/{projectRoot}";
107
- return options;
108
- } }
109
- });
110
- }
111
-
112
- //#endregion
113
- export { withExecutor as t };
114
- //# sourceMappingURL=base-executor-BVYmsZ3I.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-executor-BVYmsZ3I.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":"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"}
@@ -1,120 +0,0 @@
1
- const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.js');
2
- let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
3
- let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
4
- let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
5
- let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
6
- let defu = require("defu");
7
- defu = require_rolldown_runtime.__toESM(defu);
8
- let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
9
- let _storm_software_workspace_tools_base_base_executor = require("@storm-software/workspace-tools/base/base-executor");
10
- let _stryke_helpers_omit = require("@stryke/helpers/omit");
11
- let _stryke_path_join = require("@stryke/path/join");
12
- let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
13
- let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
14
- let jiti = require("jiti");
15
-
16
- //#region src/base/base-executor.ts
17
- /**
18
- * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
19
- *
20
- * @remarks
21
- * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
22
- *
23
- * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
24
- * @param executorFn - The function that will be executed when the command is run.
25
- * @param options - Additional options for configuring the executor, such as the import path for the API module and default execution options.
26
- * @returns A Promise that resolves to the result of the executor function.
27
- */
28
- function withExecutor(command, executorFn, options = {}) {
29
- const { importPath = "powerlines/api", defaultOptions = {}, framework = {} } = options;
30
- framework.name ??= "powerlines";
31
- framework.orgId ??= "storm-software";
32
- return (0, _storm_software_workspace_tools_base_base_executor.withRunExecutor)(`${(0, _stryke_string_format_title_case.titleCase)(framework.name)} - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor`, async (options, context, workspaceConfig) => {
33
- 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.`);
34
- 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.`);
35
- const projectConfig = context.projectsConfigurations.projects[context.projectName];
36
- const jiti$1 = (0, jiti.createJiti)(context.root, { cache: false });
37
- const [{ formatExecutionId, getName }, api] = await Promise.all([jiti$1.import("powerlines/plugin-utils"), jiti$1.import(jiti$1.esmResolve(importPath)).then((mod) => mod.default)]);
38
- try {
39
- return await Promise.resolve(executorFn((0, defu.default)({
40
- projectName: context.projectName,
41
- options,
42
- workspaceConfig,
43
- command,
44
- inlineConfig: (0, defu.default)({
45
- command,
46
- root: projectConfig.root,
47
- configFile: options.configFile || options.config,
48
- configIndex: options.configIndex,
49
- projectType: projectConfig.projectType,
50
- mode: options.mode,
51
- output: {
52
- path: options.outputPath,
53
- copy: options.copyPath === false ? false : {
54
- path: options.copyPath,
55
- assets: options.assets
56
- },
57
- minify: options.minify,
58
- sourceMap: options.sourceMap,
59
- ...(0, _stryke_type_checks_is_set_array.isSetArray)(options.format) ? { format: options.format } : {}
60
- },
61
- resolve: (0, _stryke_type_checks_is_set_array.isSetArray)(options.external) || (0, _stryke_type_checks_is_set_array.isSetArray)(options.noExternal) || (0, _stryke_type_checks_is_set.isSet)(options.skipNodeModulesBundle) ? {
62
- ...(0, _stryke_type_checks_is_set_array.isSetArray)(options.external) ? { external: options.external } : {},
63
- ...(0, _stryke_type_checks_is_set_array.isSetArray)(options.noExternal) ? { noExternal: options.noExternal } : {},
64
- ...(0, _stryke_type_checks_is_set.isSet)(options.skipNodeModulesBundle) ? { skipNodeModulesBundle: options.skipNodeModulesBundle } : {}
65
- } : void 0,
66
- define: (0, _stryke_type_checks_is_set_object.isSetObject)(options.define) ? options.define : void 0,
67
- assets: (0, _stryke_type_checks_is_set_object.isSetObject)(options.assets) ? options.assets : void 0
68
- }, (0, _stryke_helpers_omit.omit)(options, [
69
- "config",
70
- "configFile",
71
- "outputPath",
72
- "copyPath",
73
- "sourceMap",
74
- "minify",
75
- "format",
76
- "external",
77
- "noExternal",
78
- "skipNodeModulesBundle",
79
- "mode",
80
- "define",
81
- "assets"
82
- ]))
83
- }, context), async (inlineConfig) => {
84
- const name = inlineConfig.name || context.projectName || await getName(context.root, projectConfig.root);
85
- return api({
86
- options: (0, defu.default)(defaultOptions, {
87
- name,
88
- executionId: formatExecutionId(name, command, options.configIndex ?? 0),
89
- cwd: context.root,
90
- root: projectConfig.root,
91
- configFile: options.configFile || options.config || (0, _stryke_path_join.joinPaths)(projectConfig.root, `${(0, _stryke_string_format_kebab_case.kebabCase)(framework.name)}.config.ts`),
92
- configIndex: options.configIndex,
93
- framework
94
- }),
95
- command,
96
- inlineConfig
97
- });
98
- }));
99
- } catch (error) {
100
- (0, _storm_software_config_tools_logger.writeError)(`An error occurred while executing the ${(0, _stryke_string_format_title_case.titleCase)(framework.name)} - ${(0, _stryke_string_format_title_case.titleCase)(command)} executor: ${(0, _stryke_type_checks_is_error.isError)(error) ? `${error.message}
101
-
102
- ${error.stack}` : "Unknown error"}`);
103
- return { success: false };
104
- }
105
- }, {
106
- skipReadingConfig: false,
107
- hooks: { applyDefaultOptions: (options) => {
108
- options.copyPath ??= "dist/{projectRoot}";
109
- return options;
110
- } }
111
- });
112
- }
113
-
114
- //#endregion
115
- Object.defineProperty(exports, 'withExecutor', {
116
- enumerable: true,
117
- get: function () {
118
- return withExecutor;
119
- }
120
- });