@powerlines/nx 0.10.23 → 0.10.24

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 (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/chunk-4QIKRF4D.mjs +339 -0
  3. package/dist/chunk-676DOF5H.js +347 -0
  4. package/dist/{chunk-JZFLLKX7.js → chunk-AQAUVXZI.js} +2 -2
  5. package/dist/{chunk-Z6JAOALZ.js → chunk-BGLSTX6F.js} +2 -2
  6. package/dist/{chunk-JFEKW6WO.mjs → chunk-ECQAG447.mjs} +1 -1
  7. package/dist/{chunk-7JI7SNPI.js → chunk-EYCHNX35.js} +2 -2
  8. package/dist/chunk-GFUZORW3.js +10 -0
  9. package/dist/{chunk-OY7HISJN.mjs → chunk-HJUENOPY.mjs} +3 -484
  10. package/dist/{chunk-C7YXZ6X3.mjs → chunk-JV366LTN.mjs} +1 -1
  11. package/dist/{chunk-SJ6WM4OK.js → chunk-N5IOYNUV.js} +2 -2
  12. package/dist/{chunk-NQA6VVBG.mjs → chunk-PNGMBVSP.mjs} +1 -1
  13. package/dist/{chunk-SBOWIOOS.js → chunk-PZGSOSV4.js} +2 -2
  14. package/dist/{chunk-IPVB7OAF.js → chunk-RAUJ3U2D.js} +2 -483
  15. package/dist/{chunk-XL4OPEOX.mjs → chunk-RCEEHPJE.mjs} +1 -1
  16. package/dist/chunk-SAVSMAFN.mjs +8 -0
  17. package/dist/{chunk-IZ2DVA7V.mjs → chunk-TSJZC5A3.mjs} +1 -1
  18. package/dist/executors.js +11 -11
  19. package/dist/executors.mjs +6 -6
  20. package/dist/index.js +18 -18
  21. package/dist/index.mjs +9 -9
  22. package/dist/src/base/base-executor.js +2 -2
  23. package/dist/src/base/base-executor.mjs +1 -1
  24. package/dist/src/executors/build/executor.js +4 -4
  25. package/dist/src/executors/build/executor.mjs +2 -2
  26. package/dist/src/executors/clean/executor.js +4 -4
  27. package/dist/src/executors/clean/executor.mjs +2 -2
  28. package/dist/src/executors/docs/executor.js +4 -4
  29. package/dist/src/executors/docs/executor.mjs +2 -2
  30. package/dist/src/executors/lint/executor.js +4 -4
  31. package/dist/src/executors/lint/executor.mjs +2 -2
  32. package/dist/src/executors/prepare/executor.js +4 -4
  33. package/dist/src/executors/prepare/executor.mjs +2 -2
  34. package/dist/src/helpers/plugin-utilities.js +5 -5
  35. package/dist/src/helpers/plugin-utilities.mjs +2 -2
  36. package/dist/src/plugin/index.js +4 -4
  37. package/dist/src/plugin/index.mjs +3 -3
  38. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  # Changelog for Powerlines - Nx
4
4
 
5
+ ## [0.10.24](https://github.com/storm-software/powerlines/releases/tag/nx%400.10.24) (11/20/2025)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **powerlines** to **v0.23.7**
10
+
5
11
  ## [0.10.23](https://github.com/storm-software/powerlines/releases/tag/nx%400.10.23) (11/20/2025)
6
12
 
7
13
  ### Updated Dependencies
@@ -0,0 +1,339 @@
1
+ import { CONFIG_INPUTS } from './chunk-LQU7XWFP.mjs';
2
+ import { PROJECT_ROOT_HASH_LENGTH, loadUserConfigFile } from './chunk-FMYWKI25.mjs';
3
+ import { __name } from './chunk-O6YSETKJ.mjs';
4
+ import { createNodesFromFiles } from '@nx/devkit';
5
+ import { withNamedInputs } from '@storm-software/workspace-tools/utils/nx-json';
6
+ import { getProjectRoot, getRoot, getProjectConfigFromProjectRoot } from '@storm-software/workspace-tools/utils/plugin-helpers';
7
+ import { setDefaultProjectTags, addProjectTag } from '@storm-software/workspace-tools/utils/project-tags';
8
+ import { getEnvPaths } from '@stryke/env/get-env-paths';
9
+ import { existsSync } from '@stryke/fs/exists';
10
+ import { murmurhash } from '@stryke/hash/murmurhash';
11
+ import { joinPaths } from '@stryke/path/join-paths';
12
+ import { kebabCase } from '@stryke/string-format/kebab-case';
13
+ import { titleCase } from '@stryke/string-format/title-case';
14
+ import { isError } from '@stryke/type-checks/is-error';
15
+ import defu from 'defu';
16
+ import { createJiti } from 'jiti';
17
+ import { readFile } from 'node:fs/promises';
18
+ import { readNxJson } from 'nx/src/config/nx-json.js';
19
+ import { readTargetsFromPackageJson } from 'nx/src/utils/package-json.js';
20
+
21
+ function getNxTargetInputs(framework) {
22
+ return CONFIG_INPUTS.map((input) => input.replace("{framework}", framework));
23
+ }
24
+ __name(getNxTargetInputs, "getNxTargetInputs");
25
+ function getNxPluginInputs(framework) {
26
+ return `**/{${getNxTargetInputs(framework).map((input) => input.replace("{projectRoot}/", "")).join(",")}}`;
27
+ }
28
+ __name(getNxPluginInputs, "getNxPluginInputs");
29
+ function createNxPlugin(opts) {
30
+ const framework = opts?.framework || "powerlines";
31
+ const name = opts?.name || `${framework}/nx/plugin`;
32
+ const artifactsFolder = opts?.artifactsFolder || `{projectRoot}/.${framework}`;
33
+ const targetInputs = getNxTargetInputs(framework);
34
+ const pluginInputs = getNxPluginInputs(framework);
35
+ console.debug(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Initializing the ${titleCase(framework)} Nx plugin for the following inputs: ${pluginInputs}`);
36
+ return [
37
+ pluginInputs,
38
+ async (configFiles, options, contextV2) => {
39
+ const envPaths = getEnvPaths({
40
+ orgId: "storm-software",
41
+ appId: framework,
42
+ workspaceRoot: contextV2.workspaceRoot
43
+ });
44
+ if (!envPaths.cache) {
45
+ throw new Error("The cache directory could not be determined.");
46
+ }
47
+ const nxJson = readNxJson(contextV2.workspaceRoot);
48
+ return createNodesFromFiles(async (configFile, _, context) => {
49
+ try {
50
+ const projectRoot = getProjectRoot(configFile, contextV2.workspaceRoot);
51
+ if (!projectRoot) {
52
+ console.error(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - package.json and ${framework} configuration files (i.e. ${framework}.config.ts) must be located in the project root directory: ${configFile}`);
53
+ return {};
54
+ }
55
+ const root = getRoot(projectRoot, context);
56
+ const cacheDir = joinPaths(envPaths.cache, "nx-plugin", murmurhash(contextV2.workspaceRoot, {
57
+ maxLength: PROJECT_ROOT_HASH_LENGTH
58
+ }));
59
+ const jiti = createJiti(joinPaths(contextV2.workspaceRoot, projectRoot), {
60
+ interopDefault: true,
61
+ fsCache: joinPaths(cacheDir, "jiti"),
62
+ moduleCache: true
63
+ });
64
+ console.debug(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Loading ${framework} user configuration for project in root directory ${projectRoot}.`);
65
+ const userConfig = await loadUserConfigFile(joinPaths(contextV2.workspaceRoot, projectRoot), jiti, "build", "development", joinPaths(contextV2.workspaceRoot, configFile), framework);
66
+ if (!existsSync(joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"))) {
67
+ console.warn(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Cannot find \`package.json\` file in the project's root directory (path: "${joinPaths(contextV2.workspaceRoot, projectRoot)}"). Skipping project configuration.`);
68
+ return {};
69
+ }
70
+ const packageJsonContent = await readFile(joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"), "utf8");
71
+ if (!packageJsonContent) {
72
+ console.warn(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No package.json file found for project in root directory ${projectRoot}`);
73
+ return {};
74
+ }
75
+ const packageJson = JSON.parse(packageJsonContent);
76
+ if (!userConfig.configFile && !packageJson?.storm) {
77
+ console.debug(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Skipping ${projectRoot} - no ${framework} configuration found for project in root directory.`);
78
+ return {};
79
+ }
80
+ const projectConfig = getProjectConfigFromProjectRoot(projectRoot, packageJson);
81
+ if (!projectConfig) {
82
+ console.warn(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No project configuration found for project in root directory ${projectRoot}`);
83
+ return {};
84
+ }
85
+ const tsconfig = userConfig?.tsconfig || (existsSync(joinPaths(projectRoot, "tsconfig.json")) ? joinPaths(projectRoot, "tsconfig.json") : void 0);
86
+ const targets = readTargetsFromPackageJson(packageJson, nxJson, projectRoot, context.workspaceRoot);
87
+ console.debug(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Preparing Nx targets for project in root directory ${projectRoot}.`);
88
+ if (options?.clean !== false && !targets[options?.clean?.targetName || "clean"]) {
89
+ targets[options?.clean?.targetName || "clean"] = {
90
+ inputs: Array.isArray(options?.clean?.inputs) ? options.clean.inputs : withNamedInputs(targetInputs, [
91
+ options?.clean?.inputs || "typescript"
92
+ ]),
93
+ outputs: options?.clean?.outputs,
94
+ executor: options?.clean?.executor || `@${framework}/nx:${options?.clean?.targetName || "clean"}`,
95
+ dependsOn: [
96
+ `^${options?.clean?.targetName || "clean"}`
97
+ ],
98
+ defaultConfiguration: options?.clean?.defaultConfiguration || "production",
99
+ options: {
100
+ outputPath: userConfig.output?.outputPath || "dist/{projectRoot}",
101
+ projectType: projectConfig.projectType || userConfig.type,
102
+ skipInstalls: userConfig.skipInstalls
103
+ },
104
+ configurations: {
105
+ production: {
106
+ mode: "production"
107
+ },
108
+ test: {
109
+ mode: "test"
110
+ },
111
+ development: {
112
+ mode: "development",
113
+ skipCache: true
114
+ }
115
+ }
116
+ };
117
+ }
118
+ if (options?.prepare !== false && !targets[options?.prepare?.targetName || "prepare"]) {
119
+ targets[options?.prepare?.targetName || "prepare"] = {
120
+ cache: true,
121
+ inputs: Array.isArray(options?.prepare?.inputs) ? options.prepare.inputs : withNamedInputs(targetInputs, [
122
+ options?.prepare?.inputs || "typescript"
123
+ ]),
124
+ outputs: options?.prepare?.outputs ?? [
125
+ artifactsFolder
126
+ ],
127
+ executor: options?.prepare?.executor || `@${framework}/nx:${options?.prepare?.targetName || "prepare"}`,
128
+ dependsOn: [
129
+ `^${options?.prepare?.targetName || "prepare"}`,
130
+ "clean"
131
+ ],
132
+ defaultConfiguration: options?.prepare?.defaultConfiguration || "production",
133
+ options: {
134
+ entry: userConfig.entry || "{sourceRoot}/index.ts",
135
+ projectType: projectConfig.projectType || userConfig.type,
136
+ tsconfig,
137
+ skipInstalls: userConfig.skipInstalls,
138
+ skipCache: userConfig.skipCache
139
+ },
140
+ configurations: {
141
+ production: {
142
+ mode: "production"
143
+ },
144
+ test: {
145
+ mode: "test"
146
+ },
147
+ development: {
148
+ mode: "development",
149
+ skipCache: true
150
+ }
151
+ }
152
+ };
153
+ }
154
+ if (options?.build !== false && !targets[options?.build?.targetName || "build"]) {
155
+ targets[options?.build?.targetName || "build"] = {
156
+ inputs: Array.isArray(options?.build?.inputs) ? options.build.inputs : withNamedInputs(targetInputs, [
157
+ options?.build?.inputs || "typescript"
158
+ ]),
159
+ outputs: options?.build?.outputs ?? [
160
+ "{options.outputPath}"
161
+ ],
162
+ executor: options?.build?.executor || `@${framework}/nx:${options?.build?.targetName || "build"}`,
163
+ dependsOn: [
164
+ `^${options?.build?.targetName || "build"}`,
165
+ options?.prepare !== false && `^${options?.prepare?.targetName || "prepare"}`
166
+ ].filter(Boolean),
167
+ defaultConfiguration: options?.build?.defaultConfiguration || "production",
168
+ options: {
169
+ entry: userConfig.entry || "{sourceRoot}/index.ts",
170
+ outputPath: userConfig.output?.outputPath || "dist/{projectRoot}",
171
+ projectType: projectConfig.projectType || userConfig.type,
172
+ tsconfig,
173
+ skipInstalls: userConfig.skipInstalls,
174
+ skipCache: userConfig.skipCache
175
+ },
176
+ configurations: {
177
+ production: {
178
+ mode: "production"
179
+ },
180
+ test: {
181
+ mode: "test"
182
+ },
183
+ development: {
184
+ mode: "development",
185
+ skipCache: true
186
+ }
187
+ }
188
+ };
189
+ }
190
+ if (options?.lint !== false && !targets[options?.lint?.targetName || "lint"]) {
191
+ targets[options?.lint?.targetName || "lint"] = {
192
+ inputs: Array.isArray(options?.lint?.inputs) ? options.lint.inputs : withNamedInputs([
193
+ ...targetInputs,
194
+ artifactsFolder
195
+ ], options?.lint?.inputs ? [
196
+ options.lint.inputs
197
+ ] : [
198
+ "linting",
199
+ "typescript"
200
+ ]),
201
+ outputs: options?.lint?.outputs ?? [
202
+ "{options.outputPath}"
203
+ ],
204
+ executor: options?.lint?.executor || `@${framework}/nx:${options?.lint?.targetName || "lint"}`,
205
+ dependsOn: [
206
+ `^${options?.lint?.targetName || "lint"}`,
207
+ options?.prepare !== false && `^${options?.prepare?.targetName || "prepare"}`
208
+ ].filter(Boolean),
209
+ defaultConfiguration: options?.lint?.defaultConfiguration || "production",
210
+ options: {
211
+ entry: userConfig.entry || "{sourceRoot}/index.ts",
212
+ projectType: projectConfig.projectType || userConfig.type,
213
+ tsconfig,
214
+ skipInstalls: userConfig.skipInstalls,
215
+ skipCache: userConfig.skipCache
216
+ },
217
+ configurations: {
218
+ production: {
219
+ mode: "production"
220
+ },
221
+ test: {
222
+ mode: "test"
223
+ },
224
+ development: {
225
+ mode: "development",
226
+ skipCache: true
227
+ }
228
+ }
229
+ };
230
+ }
231
+ if (options?.docs !== false && !targets[options?.docs?.targetName || "docs"]) {
232
+ targets[options?.docs?.targetName || "docs"] = {
233
+ inputs: Array.isArray(options?.docs?.inputs) ? options.docs.inputs : withNamedInputs([
234
+ ...targetInputs,
235
+ artifactsFolder
236
+ ], options?.docs?.inputs ? [
237
+ options.docs.inputs
238
+ ] : [
239
+ "documentation",
240
+ "typescript"
241
+ ]),
242
+ outputs: options?.docs?.outputs ?? [
243
+ "{options.outputPath}"
244
+ ],
245
+ executor: options?.docs?.executor || `@${framework}/nx:${options?.docs?.targetName || "docs"}`,
246
+ dependsOn: [
247
+ `^${options?.docs?.targetName || "docs"}`,
248
+ options?.build !== false && `^${options?.build?.targetName || "build"}`
249
+ ].filter(Boolean),
250
+ defaultConfiguration: options?.docs?.defaultConfiguration || "production",
251
+ options: {
252
+ entry: userConfig.entry || "{sourceRoot}/index.ts",
253
+ projectType: projectConfig.projectType || userConfig.type,
254
+ tsconfig,
255
+ skipInstalls: userConfig.skipInstalls,
256
+ skipCache: userConfig.skipCache
257
+ },
258
+ configurations: {
259
+ production: {
260
+ mode: "production"
261
+ },
262
+ test: {
263
+ mode: "test"
264
+ },
265
+ development: {
266
+ mode: "development",
267
+ skipCache: true
268
+ }
269
+ }
270
+ };
271
+ }
272
+ if (options?.deploy !== false && !targets[options?.deploy?.targetName || "deploy"]) {
273
+ targets[options?.deploy?.targetName || "deploy"] = {
274
+ inputs: Array.isArray(options?.deploy?.inputs) ? options.deploy.inputs : withNamedInputs([
275
+ ...targetInputs,
276
+ artifactsFolder
277
+ ], options?.deploy?.inputs ? [
278
+ options.deploy.inputs
279
+ ] : [
280
+ "documentation",
281
+ "typescript"
282
+ ]),
283
+ outputs: options?.deploy?.outputs ?? [
284
+ "{options.outputPath}"
285
+ ],
286
+ executor: options?.deploy?.executor || `@${framework}/nx:${options?.deploy?.targetName || "deploy"}`,
287
+ dependsOn: [
288
+ `^${options?.deploy?.targetName || "deploy"}`,
289
+ options?.build !== false && `^${options?.build?.targetName || "build"}`
290
+ ].filter(Boolean),
291
+ defaultConfiguration: options?.deploy?.defaultConfiguration || "production",
292
+ options: {
293
+ entry: userConfig.entry || "{sourceRoot}/index.ts",
294
+ projectType: projectConfig.projectType || userConfig.type,
295
+ tsconfig,
296
+ skipInstalls: userConfig.skipInstalls,
297
+ skipCache: userConfig.skipCache
298
+ },
299
+ configurations: {
300
+ production: {
301
+ mode: "production"
302
+ },
303
+ test: {
304
+ mode: "test"
305
+ },
306
+ development: {
307
+ mode: "development",
308
+ skipCache: true
309
+ }
310
+ }
311
+ };
312
+ }
313
+ setDefaultProjectTags(projectConfig, name);
314
+ addProjectTag(projectConfig, framework, projectConfig.projectType || userConfig.type || "library", {
315
+ overwrite: true
316
+ });
317
+ console.debug(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Completed preparing Nx configuration for project in root directory ${projectRoot}.`);
318
+ return {
319
+ projects: {
320
+ [root]: defu(projectConfig, {
321
+ name: kebabCase(userConfig.name),
322
+ projectType: userConfig.type || "library",
323
+ root,
324
+ sourceRoot: joinPaths(root, "src"),
325
+ targets
326
+ })
327
+ }
328
+ };
329
+ } catch (error) {
330
+ console.error(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - ${isError(error) ? error.message : "Unknown fatal error"}`);
331
+ return {};
332
+ }
333
+ }, configFiles, options, contextV2);
334
+ }
335
+ ];
336
+ }
337
+ __name(createNxPlugin, "createNxPlugin");
338
+
339
+ export { createNxPlugin, getNxPluginInputs, getNxTargetInputs };