@shell-shock/nx 0.0.83 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,468 @@
1
- import { createNxPlugin } from "@powerlines/nx/helpers/plugin-utilities";
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 { createNodesFromFiles } from "@nx/devkit";
7
+ import { withNamedInputs } from "@storm-software/workspace-tools/utils/nx-json";
8
+ import { getProjectConfigFromProjectRoot, getProjectRoot, getRoot } from "@storm-software/workspace-tools/utils/plugin-helpers";
9
+ import { addProjectTag, setDefaultProjectTags } from "@storm-software/workspace-tools/utils/project-tags";
10
+ import { joinPaths } from "@stryke/path/join-paths";
11
+ import os from "node:os";
12
+ import path from "node:path";
13
+ import { existsSync } from "node:fs";
14
+ import { readFile } from "node:fs/promises";
15
+ import { isSetString } from "@stryke/type-checks/is-set-string";
16
+ import { readNxJson } from "nx/src/config/nx-json.js";
17
+ import { readTargetsFromPackageJson } from "nx/src/utils/package-json.js";
2
18
 
19
+ //#region ../../node_modules/.pnpm/@powerlines+nx@0.13.163_9456f17d791dfffcdb67c022b29fb589/node_modules/@powerlines/nx/dist/src/helpers/constants.mjs
20
+ /**
21
+ * A list of Nx input strings that describe the Powerlines configuration file
22
+ */
23
+ const CONFIG_INPUTS = [
24
+ "{projectRoot}/{framework}.json",
25
+ "{projectRoot}/{framework}.*.json",
26
+ "{projectRoot}/{framework}.jsonc",
27
+ "{projectRoot}/{framework}.*.jsonc",
28
+ "{projectRoot}/{framework}.json5",
29
+ "{projectRoot}/{framework}.*.json5",
30
+ "{projectRoot}/{framework}.yaml",
31
+ "{projectRoot}/{framework}.*.yaml",
32
+ "{projectRoot}/{framework}.yml",
33
+ "{projectRoot}/{framework}.*.yml",
34
+ "{projectRoot}/{framework}.toml",
35
+ "{projectRoot}/{framework}.*.toml",
36
+ "{projectRoot}/{framework}.config.js",
37
+ "{projectRoot}/{framework}.*.config.js",
38
+ "{projectRoot}/{framework}.config.cjs",
39
+ "{projectRoot}/{framework}.*.config.cjs",
40
+ "{projectRoot}/{framework}.config.mjs",
41
+ "{projectRoot}/{framework}.*.config.mjs",
42
+ "{projectRoot}/{framework}.config.ts",
43
+ "{projectRoot}/{framework}.*.config.ts",
44
+ "{projectRoot}/{framework}.config.cts",
45
+ "{projectRoot}/{framework}.*.config.cts",
46
+ "{projectRoot}/{framework}.config.mts",
47
+ "{projectRoot}/{framework}.*.config.mts"
48
+ ];
49
+
50
+ //#endregion
51
+ //#region ../../node_modules/.pnpm/@stryke+env@0.20.102_@nx+jest@22.7.5_@babel+traverse@7.29.7_@swc-node+register@1.11.1_@_506406da618bb04e125369d0dfadeb01/node_modules/@stryke/env/dist/ci-checks.mjs
52
+ /**
53
+ * Returns true if the current environment is a CI environment.
54
+ *
55
+ * @returns True if the current environment is a CI environment.
56
+ */
57
+ const isCI = (env = process.env) => {
58
+ return Boolean(env.STORM_CI || env.CI || env.CONTINUOUS_INTEGRATION || env.BUILD_NUMBER || env.RUN_ID || env.AGOLA_GIT_REF || env.AC_APPCIRCLE || env.APPVEYOR || env.CODEBUILD || env.TF_BUILD || env.bamboo_planKey || env.BITBUCKET_COMMIT || env.BITRISE_IO || env.BUDDY_WORKSPACE_ID || env.BUILDKITE || env.CIRCLECI || env.CIRRUS_CI || env.CF_BUILD_ID || env.CM_BUILD_ID || env.CI_NAME || env.DRONE || env.DSARI || env.EARTHLY_CI || env.EAS_BUILD || env.GERRIT_PROJECT || env.GITEA_ACTIONS || env.GITHUB_ACTIONS || env.GITLAB_CI || env.GOCD || env.BUILDER_OUTPUT || env.HARNESS_BUILD_ID || env.JENKINS_URL || env.BUILD_ID || env.LAYERCI || env.MAGNUM || env.NETLIFY || env.NEVERCODE || env.PROW_JOB_ID || env.RELEASE_BUILD_ID || env.RENDER || env.SAILCI || env.HUDSON || env.JENKINS_URL || env.BUILD_ID || env.SCREWDRIVER || env.SEMAPHORE || env.SOURCEHUT || env.STRIDER || env.TASK_ID || env.RUN_ID || env.TEAMCITY_VERSION || env.TRAVIS || env.VELA || env.NOW_BUILDER || env.APPCENTER_BUILD_ID || env.CI_XCODE_PROJECT || env.XCS || false);
59
+ };
60
+
61
+ //#endregion
62
+ //#region ../../node_modules/.pnpm/@stryke+env@0.20.102_@nx+jest@22.7.5_@babel+traverse@7.29.7_@swc-node+register@1.11.1_@_506406da618bb04e125369d0dfadeb01/node_modules/@stryke/env/dist/environment-checks.mjs
63
+ /** Value of process.platform */
64
+ const platform = process?.platform || "";
65
+ /** Detect if stdout.TTY is available */
66
+ const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);
67
+ /** Detect if `DEBUG` environment variable is set */
68
+ const isDebug = Boolean(process.env.DEBUG);
69
+ /** Detect the `NODE_ENV` environment variable */
70
+ const mode = process.env.STORM_MODE || process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.NODE_ENV || "production";
71
+ /** Detect if the application is running in a staging environment */
72
+ const isStaging = [
73
+ "stg",
74
+ "stage",
75
+ "staging"
76
+ ].includes(mode?.toLowerCase());
77
+ /**
78
+ * Check if the current environment is production.
79
+ *
80
+ * @param mode - The mode string to check.
81
+ * @returns Whether the environment is production
82
+ */
83
+ function isProductionMode(mode) {
84
+ return [
85
+ "prd",
86
+ "prod",
87
+ "production",
88
+ "preprod",
89
+ "preproduction",
90
+ "uat"
91
+ ].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
92
+ }
93
+ /** Detect if `NODE_ENV` environment variable is `production` */
94
+ const isProduction = isProductionMode(mode);
95
+ /**
96
+ * Check if the current environment is test.
97
+ *
98
+ * @param mode - The mode string to check.
99
+ * @returns Whether the environment is test
100
+ */
101
+ function isTestMode(mode) {
102
+ return [
103
+ "tst",
104
+ "test",
105
+ "testing",
106
+ "stg",
107
+ "stage",
108
+ "staging",
109
+ "qa",
110
+ "qualityassurance"
111
+ ].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
112
+ }
113
+ /** Detect if `NODE_ENV` environment variable is `test` */
114
+ const isTest = isTestMode(mode) || isStaging || Boolean(process.env.TEST);
115
+ /**
116
+ * Check if the current environment is development.
117
+ *
118
+ * @param mode - The mode string to check.
119
+ * @returns Whether the environment is development
120
+ */
121
+ function isDevelopmentMode(mode) {
122
+ return [
123
+ "dev",
124
+ "development",
125
+ "int",
126
+ "integration"
127
+ ].includes(mode?.toLowerCase()?.replace(/[\s\-_]/g, ""));
128
+ }
129
+ /** Detect if `NODE_ENV` environment variable is `dev` or `development` */
130
+ const isDevelopment = isDevelopmentMode(mode) || isDebug;
131
+ /** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
132
+ const isMinimal = Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;
133
+ /** Detect if process.platform is Windows */
134
+ const isWindows = /^win/i.test(platform);
135
+ /** Detect if process.platform is Linux */
136
+ const isLinux = /^linux/i.test(platform);
137
+ /** Detect if process.platform is macOS (darwin kernel) */
138
+ const isMacOS = /^darwin/i.test(platform);
139
+ /** Color Support */
140
+ const isColorSupported = !process.env.NO_COLOR && (Boolean(process.env.FORCE_COLOR) || (hasTTY || isWindows) && process.env.TERM !== "dumb" || isCI());
141
+ /** Node.js versions */
142
+ const nodeVersion = (process?.versions?.node || "").replace(/^v/, "") || null;
143
+ const nodeMajorVersion = Number(nodeVersion?.split(".")[0]) || null;
144
+
145
+ //#endregion
146
+ //#region ../../node_modules/.pnpm/@stryke+env@0.20.102_@nx+jest@22.7.5_@babel+traverse@7.29.7_@swc-node+register@1.11.1_@_506406da618bb04e125369d0dfadeb01/node_modules/@stryke/env/dist/get-env-paths.mjs
147
+ const homedir = os.homedir();
148
+ const tmpdir = os.tmpdir();
149
+ const macos = (orgId) => {
150
+ const library = joinPaths(homedir, "Library");
151
+ return {
152
+ data: joinPaths(library, "Application Support", orgId),
153
+ config: joinPaths(library, "Preferences", orgId),
154
+ cache: joinPaths(library, "Caches", orgId),
155
+ log: joinPaths(library, "Logs", orgId),
156
+ temp: joinPaths(tmpdir, orgId)
157
+ };
158
+ };
159
+ const windows = (orgId) => {
160
+ const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
161
+ const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
162
+ const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
163
+ return {
164
+ data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
165
+ config: joinPaths(appData, windowsFormattedOrgId, "Config"),
166
+ cache: joinPaths(localAppData, "Cache", orgId),
167
+ log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
168
+ temp: joinPaths(tmpdir, orgId)
169
+ };
170
+ };
171
+ const linux = (orgId) => {
172
+ const username = path.basename(homedir);
173
+ return {
174
+ data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
175
+ config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
176
+ cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
177
+ log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
178
+ temp: process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR ? joinPaths(process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR, orgId) : joinPaths(tmpdir, username, orgId)
179
+ };
180
+ };
181
+ /**
182
+ * Get paths for storing things like data, config, logs, and cache in the current runtime environment.
183
+ *
184
+ * @remarks
185
+ * On macOS, directories are generally created in `~/Library/Application Support/<name>`.
186
+ * On Windows, directories are generally created in `%AppData%/<name>`.
187
+ * On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).
188
+ *
189
+ * If the `STORM_DATA_DIR`, `STORM_CONFIG_DIR`, `STORM_CACHE_DIR`, `STORM_LOG_DIR`, or `STORM_TEMP_DIR` environment variables are set, they will be used instead of the default paths.
190
+ *
191
+ * @param options - Parameters used to determine the specific paths for the current project/runtime environment
192
+ * @returns An object containing the various paths for the runtime environment
193
+ */
194
+ function getEnvPaths(options = {}) {
195
+ let orgId = options.orgId || "storm-software";
196
+ if (!orgId) throw new Error("You need to provide an orgId to the `getEnvPaths` function");
197
+ if (options.suffix) orgId += `-${typeof options.suffix === "string" ? options.suffix : "nodejs"}`;
198
+ let result = {};
199
+ if (process.platform === "darwin") result = macos(orgId);
200
+ else if (process.platform === "win32") result = windows(orgId);
201
+ else result = linux(orgId);
202
+ if (process.env.STORM_DATA_DIR) result.data = process.env.STORM_DATA_DIR;
203
+ else if (process.env.STORM_CONFIG_DIR) result.config = process.env.STORM_CONFIG_DIR;
204
+ else if (process.env.STORM_CACHE_DIR) result.cache = process.env.STORM_CACHE_DIR;
205
+ else if (process.env.STORM_LOG_DIR) result.log = process.env.STORM_LOG_DIR;
206
+ else if (process.env.STORM_TEMP_DIR) result.temp = process.env.STORM_TEMP_DIR;
207
+ if (options.workspaceRoot) {
208
+ result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
209
+ result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
210
+ result.log ??= joinPaths(result.temp, "logs");
211
+ result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
212
+ }
213
+ return Object.keys(result).reduce((ret, key) => {
214
+ if (result[key]) {
215
+ const filePath = result[key];
216
+ ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
217
+ if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) ret[key] = joinPaths(ret[key], options.nestedDir);
218
+ }
219
+ return ret;
220
+ }, {});
221
+ }
222
+
223
+ //#endregion
224
+ //#region ../../node_modules/.pnpm/@stryke+fs@0.33.85_@nx+jest@22.7.5_@babel+traverse@7.29.7_@swc-node+register@1.11.1_@sw_877f1a6d15b15de58e6bb8cae69ca90b/node_modules/@stryke/fs/dist/exists.mjs
225
+ /**
226
+ * Check if a file exists
227
+ *
228
+ * @param filePath - The file path to check
229
+ * @returns An indicator specifying if the file exists
230
+ */
231
+ function existsSync$1(filePath) {
232
+ return existsSync(filePath);
233
+ }
234
+
235
+ //#endregion
236
+ //#region ../../node_modules/.pnpm/@powerlines+nx@0.13.163_9456f17d791dfffcdb67c022b29fb589/node_modules/@powerlines/nx/dist/src/helpers/plugin-utilities.mjs
237
+ /**
238
+ * Generates Nx input strings for the Powerlines configuration file, replacing the `{framework}` placeholder with the specified framework name.
239
+ *
240
+ * @param framework - The framework name to use in the input strings
241
+ * @returns An array of Nx input strings for the configuration file
242
+ */
243
+ function getNxTargetInputs(framework) {
244
+ return CONFIG_INPUTS.map((input) => input.replace("{framework}", framework));
245
+ }
246
+ /**
247
+ * Generates Nx input strings for the Powerlines configuration file, replacing the `{framework}` placeholder with the specified framework name.
248
+ *
249
+ * @param framework - The framework name to use in the input strings
250
+ * @returns An array of Nx input strings for the configuration file
251
+ */
252
+ function getNxPluginInputs(framework) {
253
+ return `**/{${getNxTargetInputs(framework).map((input) => input.replace("{projectRoot}/", "")).join(",")}}`;
254
+ }
255
+ /**
256
+ * Creates an Nx plugin that integrates Powerlines into the Nx build process.
257
+ *
258
+ * @param opts - Options for creating the Nx plugin
259
+ * @returns A CreateNodesV2 function that can be used as an Nx plugin
260
+ */
261
+ function createNxPlugin(opts) {
262
+ const framework = kebabCase(opts?.framework) || "powerlines";
263
+ const title = `${titleCase(framework)} Nx Plugin`;
264
+ try {
265
+ const name = opts?.name || `${framework}/nx/plugin`;
266
+ const artifactsFolder = opts?.artifactsFolder || `{projectRoot}/.${framework}`;
267
+ const targetInputs = getNxTargetInputs(framework);
268
+ const pluginInputs = getNxPluginInputs(framework);
269
+ return [pluginInputs, async (configFiles, options, contextV2) => {
270
+ if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Initializing the ${title} for the following inputs: ${pluginInputs}`);
271
+ if (!getEnvPaths({
272
+ orgId: "storm-software",
273
+ appId: framework,
274
+ workspaceRoot: contextV2.workspaceRoot
275
+ }).cache) throw new Error("The cache directory could not be determined.");
276
+ const nxJson = readNxJson(contextV2.workspaceRoot);
277
+ return createNodesFromFiles(async (configFile, _, context) => {
278
+ try {
279
+ const projectRoot = getProjectRoot(configFile, contextV2.workspaceRoot);
280
+ if (!projectRoot) {
281
+ console.error(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - package.json and ${framework} configuration files (i.e. ${framework}.config.ts) must be located in the project root directory: ${configFile}`);
282
+ return {};
283
+ }
284
+ const root = getRoot(projectRoot, context);
285
+ if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Loading ${framework} user configuration for project in root directory ${projectRoot}.`);
286
+ if (!existsSync$1(joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"))) {
287
+ if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Cannot find \`package.json\` file in the project's root directory (path: "${joinPaths(contextV2.workspaceRoot, projectRoot)}"). Skipping project configuration.`);
288
+ return {};
289
+ }
290
+ const packageJsonContent = await readFile(joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"), "utf8");
291
+ if (!packageJsonContent) {
292
+ if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No package.json file found for project in root directory ${projectRoot}`);
293
+ return {};
294
+ }
295
+ const packageJson = JSON.parse(packageJsonContent);
296
+ const projectConfig = getProjectConfigFromProjectRoot(projectRoot, packageJson);
297
+ if (!projectConfig) {
298
+ if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No project configuration found for project in root directory ${projectRoot}`);
299
+ return {};
300
+ }
301
+ const targets = readTargetsFromPackageJson(packageJson, nxJson, projectRoot, context.workspaceRoot);
302
+ if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Preparing Nx targets for project in root directory ${projectRoot}.`);
303
+ if (options?.clean !== false && !targets[options?.clean?.targetName || "clean"]) targets[options?.clean?.targetName || "clean"] = {
304
+ cache: options?.clean?.cache ?? options?.cache ?? true,
305
+ inputs: Array.isArray(options?.clean?.inputs) ? options.clean.inputs : withNamedInputs(targetInputs, [options?.clean?.inputs || "typescript"]),
306
+ outputs: options?.clean?.outputs,
307
+ executor: options?.clean?.executor || `@${framework}/nx:${options?.clean?.targetName || "clean"}`,
308
+ dependsOn: options?.clean?.dependsOn ?? [`^${options?.clean?.targetName || "clean"}`],
309
+ defaultConfiguration: options?.clean?.defaultConfiguration || "production",
310
+ options: {
311
+ root: projectRoot,
312
+ configFile,
313
+ projectType: projectConfig.projectType,
314
+ outputPath: `{workspaceRoot}/${projectRoot}/dist`,
315
+ copyPath: `{workspaceRoot}/dist/${projectRoot}`
316
+ },
317
+ configurations: {
318
+ production: { mode: "production" },
319
+ test: { mode: "test" },
320
+ development: {
321
+ mode: "development",
322
+ skipCache: true
323
+ }
324
+ }
325
+ };
326
+ if (options?.prepare !== false && !targets[options?.prepare?.targetName || "prepare"]) targets[options?.prepare?.targetName || "prepare"] = {
327
+ cache: options?.prepare?.cache ?? options?.cache ?? true,
328
+ inputs: Array.isArray(options?.prepare?.inputs) ? options.prepare.inputs : withNamedInputs(targetInputs, [options?.prepare?.inputs || "typescript"]),
329
+ outputs: options?.prepare?.outputs ?? [artifactsFolder],
330
+ executor: options?.prepare?.executor || `@${framework}/nx:${options?.prepare?.targetName || "prepare"}`,
331
+ dependsOn: options?.prepare?.dependsOn ?? [`^${options?.prepare?.targetName || "build"}`].filter(Boolean),
332
+ defaultConfiguration: options?.prepare?.defaultConfiguration || "production",
333
+ options: {
334
+ projectType: projectConfig.projectType,
335
+ configFile,
336
+ outputPath: `{workspaceRoot}/${projectRoot}/dist`,
337
+ copyPath: `{workspaceRoot}/dist/${projectRoot}`
338
+ },
339
+ configurations: {
340
+ production: { mode: "production" },
341
+ test: { mode: "test" },
342
+ development: {
343
+ mode: "development",
344
+ skipCache: true
345
+ }
346
+ }
347
+ };
348
+ if (options?.build !== false && !targets[options?.build?.targetName || "build"]) targets[options?.build?.targetName || "build"] = {
349
+ cache: options?.build?.cache ?? options?.cache ?? true,
350
+ inputs: Array.isArray(options?.build?.inputs) ? options.build.inputs : withNamedInputs(targetInputs, [options?.build?.inputs || "typescript"]),
351
+ outputs: options?.build?.outputs ?? ["{options.outputPath}"],
352
+ executor: options?.build?.executor || `@${framework}/nx:${options?.build?.targetName || "build"}`,
353
+ dependsOn: options?.build?.dependsOn ?? [`^${options?.build?.targetName || "build"}`, isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"].filter(Boolean),
354
+ defaultConfiguration: options?.build?.defaultConfiguration || "production",
355
+ options: {
356
+ projectType: projectConfig.projectType,
357
+ configFile,
358
+ outputPath: `{workspaceRoot}/${projectRoot}/dist`,
359
+ copyPath: `{workspaceRoot}/dist/${projectRoot}`
360
+ },
361
+ configurations: {
362
+ production: { mode: "production" },
363
+ test: { mode: "test" },
364
+ development: {
365
+ mode: "development",
366
+ skipCache: true
367
+ }
368
+ }
369
+ };
370
+ if (options?.lint !== false && !targets[options?.lint?.targetName || "lint"]) targets[options?.lint?.targetName || "lint"] = {
371
+ cache: options?.lint?.cache ?? options?.cache ?? true,
372
+ inputs: Array.isArray(options?.lint?.inputs) ? options.lint.inputs : withNamedInputs([...targetInputs, artifactsFolder], options?.lint?.inputs ? [options.lint.inputs] : ["linting", "typescript"]),
373
+ outputs: options?.lint?.outputs ?? ["{options.outputPath}"],
374
+ executor: options?.lint?.executor || `@${framework}/nx:${options?.lint?.targetName || "lint"}`,
375
+ dependsOn: options?.lint?.dependsOn ?? [`^${options?.lint?.targetName || "lint"}`, isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"].filter(Boolean),
376
+ defaultConfiguration: options?.lint?.defaultConfiguration || "production",
377
+ options: {
378
+ projectType: projectConfig.projectType,
379
+ configFile,
380
+ outputPath: `{workspaceRoot}/${projectRoot}/dist`,
381
+ copyPath: `{workspaceRoot}/dist/${projectRoot}`
382
+ },
383
+ configurations: {
384
+ production: { mode: "production" },
385
+ test: { mode: "test" },
386
+ development: {
387
+ mode: "development",
388
+ skipCache: true
389
+ }
390
+ }
391
+ };
392
+ if (options?.docs !== false && !targets[options?.docs?.targetName || "docs"]) targets[options?.docs?.targetName || "docs"] = {
393
+ cache: options?.docs?.cache ?? options?.cache ?? true,
394
+ inputs: Array.isArray(options?.docs?.inputs) ? options.docs.inputs : withNamedInputs([...targetInputs, artifactsFolder], options?.docs?.inputs ? [options.docs.inputs] : ["documentation", "typescript"]),
395
+ outputs: options?.docs?.outputs ?? ["{options.outputPath}"],
396
+ executor: options?.docs?.executor || `@${framework}/nx:${options?.docs?.targetName || "docs"}`,
397
+ dependsOn: options?.docs?.dependsOn ?? [
398
+ `^${options?.docs?.targetName || "docs"}`,
399
+ options?.build !== false && `${options?.build?.targetName || "build"}`,
400
+ isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"
401
+ ].filter(Boolean),
402
+ defaultConfiguration: options?.docs?.defaultConfiguration || "production",
403
+ options: {
404
+ projectType: projectConfig.projectType,
405
+ configFile,
406
+ outputPath: `{workspaceRoot}/${projectRoot}/dist`,
407
+ copyPath: `{workspaceRoot}/dist/${projectRoot}`
408
+ },
409
+ configurations: {
410
+ production: { mode: "production" },
411
+ test: { mode: "test" },
412
+ development: {
413
+ mode: "development",
414
+ skipCache: true
415
+ }
416
+ }
417
+ };
418
+ if (options?.deploy !== false && !targets[options?.deploy?.targetName || "deploy"]) targets[options?.deploy?.targetName || "deploy"] = {
419
+ cache: options?.deploy?.cache ?? false,
420
+ inputs: Array.isArray(options?.deploy?.inputs) ? options.deploy.inputs : withNamedInputs([...targetInputs, artifactsFolder], options?.deploy?.inputs ? [options.deploy.inputs] : ["documentation", "typescript"]),
421
+ outputs: options?.deploy?.outputs ?? ["{options.outputPath}"],
422
+ executor: options?.deploy?.executor || `@${framework}/nx:${options?.deploy?.targetName || "deploy"}`,
423
+ dependsOn: options?.deploy?.dependsOn ?? [
424
+ `^${options?.deploy?.targetName || "deploy"}`,
425
+ options?.build !== false && `${options?.build?.targetName || "build"}`,
426
+ isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"
427
+ ].filter(Boolean),
428
+ defaultConfiguration: options?.deploy?.defaultConfiguration || "production",
429
+ options: {
430
+ projectType: projectConfig.projectType,
431
+ configFile,
432
+ outputPath: `{workspaceRoot}/${projectRoot}/dist`,
433
+ copyPath: `{workspaceRoot}/dist/${projectRoot}`
434
+ },
435
+ configurations: {
436
+ production: { mode: "production" },
437
+ test: { mode: "test" },
438
+ development: {
439
+ mode: "development",
440
+ skipCache: true
441
+ }
442
+ }
443
+ };
444
+ setDefaultProjectTags(projectConfig, name);
445
+ addProjectTag(projectConfig, framework, projectConfig.projectType || "library", { overwrite: true });
446
+ if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Completed preparing Nx configuration for project in root directory ${projectRoot}.`);
447
+ return { projects: { [root]: defu(projectConfig, {
448
+ projectType: projectConfig.projectType || "library",
449
+ root,
450
+ sourceRoot: joinPaths(root, "src"),
451
+ targets
452
+ }) } };
453
+ } catch (error) {
454
+ console.error(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Failed to process the project configuration for file "${configFile}" - ${isError(error) ? error.message : isSetString(error) ? error : "Unknown fatal error"}`);
455
+ return {};
456
+ }
457
+ }, configFiles, options, contextV2);
458
+ }];
459
+ } catch (error) {
460
+ console.error(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - ${isError(error) ? error.message : isSetString(error) ? error : "Unknown fatal error during plugin initialization"}`);
461
+ throw new Error(`Failed to initialize the ${title} - ${isError(error) ? error.message : isSetString(error) ? error : "See previous logs for more details"}`, { cause: error instanceof Error ? error : void 0 });
462
+ }
463
+ }
464
+
465
+ //#endregion
3
466
  //#region src/plugin/index.ts
4
467
  const createNodesV2 = createNxPlugin({ framework: "shell-shock" });
5
468
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/nx",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
4
4
  "description": "A Nx plugin to support Shell Shock development in Nx monorepos.",
5
5
  "repository": {
6
6
  "type": "github",
@@ -104,5 +104,5 @@
104
104
  "peerDependencies": { "nx": ">=22.7.0" },
105
105
  "publishConfig": { "access": "public" },
106
106
  "executors": "./executors.json",
107
- "gitHead": "9401c1de122d800040306fc89ad1835930c1a826"
107
+ "gitHead": "75ec717085aa5dd47d8840c84dee8aa953fb0f41"
108
108
  }