@powerlines/nx 0.13.231 → 0.13.233
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.schema.d.ts +175 -164
- package/package.json +28 -18
- package/dist/src/_virtual/_rolldown/runtime.js +0 -28
- package/dist/src/base/base-executor.d.mts +0 -60
- package/dist/src/base/base-executor.d.mts.map +0 -1
- package/dist/src/base/base-executor.d.ts +0 -60
- package/dist/src/base/base-executor.d.ts.map +0 -1
- package/dist/src/base/base-executor.js +0 -118
- package/dist/src/base/base-executor.mjs +0 -116
- package/dist/src/base/base-executor.mjs.map +0 -1
- package/dist/src/base/base-executor.schema.d.js +0 -0
- package/dist/src/base/base-executor.schema.d.mts +0 -167
- package/dist/src/base/base-executor.schema.d.mts.map +0 -1
- package/dist/src/base/base-executor.schema.d.ts.map +0 -1
- package/dist/src/base/base-executor.untyped.d.mts +0 -5
- package/dist/src/base/base-executor.untyped.d.mts.map +0 -1
- package/dist/src/base/base-executor.untyped.d.ts +0 -4
- package/dist/src/base/base-executor.untyped.d.ts.map +0 -1
- package/dist/src/base/base-executor.untyped.js +0 -176
- package/dist/src/base/base-executor.untyped.mjs +0 -177
- package/dist/src/base/base-executor.untyped.mjs.map +0 -1
- package/dist/src/base/index.d.mts +0 -2
- package/dist/src/base/index.d.ts +0 -2
- package/dist/src/base/index.js +0 -5
- package/dist/src/base/index.mjs +0 -4
- package/dist/src/base-executor-BTwUZeOz.js +0 -122
- package/dist/src/base-executor-HCD7M10I.mjs +0 -116
- package/dist/src/base-executor-HCD7M10I.mjs.map +0 -1
- package/dist/src/base-executor.untyped-B9Vk-kJC.mjs +0 -177
- package/dist/src/base-executor.untyped-B9Vk-kJC.mjs.map +0 -1
- package/dist/src/base-executor.untyped-DZhWL1zT.js +0 -181
- package/dist/src/executors/build/executor.d.mts +0 -194
- package/dist/src/executors/build/executor.d.mts.map +0 -1
- package/dist/src/executors/build/executor.d.ts +0 -193
- package/dist/src/executors/build/executor.d.ts.map +0 -1
- package/dist/src/executors/build/executor.js +0 -11
- package/dist/src/executors/build/executor.mjs +0 -12
- package/dist/src/executors/build/executor.mjs.map +0 -1
- package/dist/src/executors/build/untyped.d.mts +0 -5
- package/dist/src/executors/build/untyped.d.mts.map +0 -1
- package/dist/src/executors/build/untyped.d.ts +0 -4
- package/dist/src/executors/build/untyped.d.ts.map +0 -1
- package/dist/src/executors/build/untyped.js +0 -24
- package/dist/src/executors/build/untyped.mjs +0 -25
- package/dist/src/executors/build/untyped.mjs.map +0 -1
- package/dist/src/executors/clean/executor.d.mts +0 -171
- package/dist/src/executors/clean/executor.d.mts.map +0 -1
- package/dist/src/executors/clean/executor.d.ts +0 -170
- package/dist/src/executors/clean/executor.d.ts.map +0 -1
- package/dist/src/executors/clean/executor.js +0 -11
- package/dist/src/executors/clean/executor.mjs +0 -12
- package/dist/src/executors/clean/executor.mjs.map +0 -1
- package/dist/src/executors/clean/untyped.d.mts +0 -5
- package/dist/src/executors/clean/untyped.d.mts.map +0 -1
- package/dist/src/executors/clean/untyped.d.ts +0 -4
- package/dist/src/executors/clean/untyped.d.ts.map +0 -1
- package/dist/src/executors/clean/untyped.js +0 -16
- package/dist/src/executors/clean/untyped.mjs +0 -17
- package/dist/src/executors/clean/untyped.mjs.map +0 -1
- package/dist/src/executors/docs/executor.d.mts +0 -185
- package/dist/src/executors/docs/executor.d.mts.map +0 -1
- package/dist/src/executors/docs/executor.d.ts +0 -184
- package/dist/src/executors/docs/executor.d.ts.map +0 -1
- package/dist/src/executors/docs/executor.js +0 -11
- package/dist/src/executors/docs/executor.mjs +0 -12
- package/dist/src/executors/docs/executor.mjs.map +0 -1
- package/dist/src/executors/docs/untyped.d.mts +0 -5
- package/dist/src/executors/docs/untyped.d.mts.map +0 -1
- package/dist/src/executors/docs/untyped.d.ts +0 -4
- package/dist/src/executors/docs/untyped.d.ts.map +0 -1
- package/dist/src/executors/docs/untyped.js +0 -16
- package/dist/src/executors/docs/untyped.mjs +0 -17
- package/dist/src/executors/docs/untyped.mjs.map +0 -1
- package/dist/src/executors/lint/executor.d.mts +0 -185
- package/dist/src/executors/lint/executor.d.mts.map +0 -1
- package/dist/src/executors/lint/executor.d.ts +0 -184
- package/dist/src/executors/lint/executor.d.ts.map +0 -1
- package/dist/src/executors/lint/executor.js +0 -11
- package/dist/src/executors/lint/executor.mjs +0 -12
- package/dist/src/executors/lint/executor.mjs.map +0 -1
- package/dist/src/executors/lint/untyped.d.mts +0 -5
- package/dist/src/executors/lint/untyped.d.mts.map +0 -1
- package/dist/src/executors/lint/untyped.d.ts +0 -4
- package/dist/src/executors/lint/untyped.d.ts.map +0 -1
- package/dist/src/executors/lint/untyped.js +0 -16
- package/dist/src/executors/lint/untyped.mjs +0 -17
- package/dist/src/executors/lint/untyped.mjs.map +0 -1
- package/dist/src/executors/prepare/executor.d.mts +0 -185
- package/dist/src/executors/prepare/executor.d.mts.map +0 -1
- package/dist/src/executors/prepare/executor.d.ts +0 -184
- package/dist/src/executors/prepare/executor.d.ts.map +0 -1
- package/dist/src/executors/prepare/executor.js +0 -11
- package/dist/src/executors/prepare/executor.mjs +0 -12
- package/dist/src/executors/prepare/executor.mjs.map +0 -1
- package/dist/src/executors/prepare/untyped.d.mts +0 -5
- package/dist/src/executors/prepare/untyped.d.mts.map +0 -1
- package/dist/src/executors/prepare/untyped.d.ts +0 -4
- package/dist/src/executors/prepare/untyped.d.ts.map +0 -1
- package/dist/src/executors/prepare/untyped.js +0 -26
- package/dist/src/executors/prepare/untyped.mjs +0 -27
- package/dist/src/executors/prepare/untyped.mjs.map +0 -1
- package/dist/src/generators/sync/generator.d.mts +0 -7
- package/dist/src/generators/sync/generator.d.mts.map +0 -1
- package/dist/src/generators/sync/generator.d.ts +0 -7
- package/dist/src/generators/sync/generator.d.ts.map +0 -1
- package/dist/src/generators/sync/generator.js +0 -11
- package/dist/src/generators/sync/generator.mjs +0 -10
- package/dist/src/generators/sync/generator.mjs.map +0 -1
- package/dist/src/generators/sync/untyped.d.mts +0 -5
- package/dist/src/generators/sync/untyped.d.mts.map +0 -1
- package/dist/src/generators/sync/untyped.d.ts +0 -4
- package/dist/src/generators/sync/untyped.d.ts.map +0 -1
- package/dist/src/generators/sync/untyped.js +0 -22
- package/dist/src/generators/sync/untyped.mjs +0 -23
- package/dist/src/generators/sync/untyped.mjs.map +0 -1
- package/dist/src/helpers/constants.d.mts +0 -8
- package/dist/src/helpers/constants.d.mts.map +0 -1
- package/dist/src/helpers/constants.d.ts +0 -8
- package/dist/src/helpers/constants.d.ts.map +0 -1
- package/dist/src/helpers/constants.js +0 -34
- package/dist/src/helpers/constants.mjs +0 -34
- package/dist/src/helpers/constants.mjs.map +0 -1
- package/dist/src/helpers/index.d.mts +0 -3
- package/dist/src/helpers/index.d.ts +0 -3
- package/dist/src/helpers/index.js +0 -8
- package/dist/src/helpers/index.mjs +0 -4
- package/dist/src/helpers/plugin-utilities.d.mts +0 -56
- package/dist/src/helpers/plugin-utilities.d.mts.map +0 -1
- package/dist/src/helpers/plugin-utilities.d.ts +0 -56
- package/dist/src/helpers/plugin-utilities.d.ts.map +0 -1
- package/dist/src/helpers/plugin-utilities.js +0 -255
- package/dist/src/helpers/plugin-utilities.mjs +0 -251
- package/dist/src/helpers/plugin-utilities.mjs.map +0 -1
- package/dist/src/index.d.mts +0 -7
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.js +0 -12
- package/dist/src/index.mjs +0 -7
- package/dist/src/plugin/index.d.mts +0 -291
- package/dist/src/plugin/index.d.mts.map +0 -1
- package/dist/src/plugin/index.d.ts +0 -291
- package/dist/src/plugin/index.d.ts.map +0 -1
- package/dist/src/plugin/index.js +0 -288
- package/dist/src/plugin/index.mjs +0 -286
- package/dist/src/plugin/index.mjs.map +0 -1
- package/dist/src/rolldown-runtime-C24Yb2bl.js +0 -33
- package/dist/src/types/index.d.mts +0 -2
- package/dist/src/types/index.d.ts +0 -2
- package/dist/src/types/index.js +0 -0
- package/dist/src/types/index.mjs +0 -1
- package/dist/src/types/plugin.d.mts +0 -288
- package/dist/src/types/plugin.d.mts.map +0 -1
- package/dist/src/types/plugin.d.ts +0 -288
- package/dist/src/types/plugin.d.ts.map +0 -1
- package/dist/src/types/plugin.js +0 -0
- package/dist/src/types/plugin.mjs +0 -1
package/dist/src/plugin/index.js
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_rolldown_runtime = require('../rolldown-runtime-C24Yb2bl.js');
|
|
3
|
-
let _nx_devkit = require("@nx/devkit");
|
|
4
|
-
let _storm_software_workspace_tools_utils_nx_json = require("@storm-software/workspace-tools/utils/nx-json");
|
|
5
|
-
let _storm_software_workspace_tools_utils_plugin_helpers = require("@storm-software/workspace-tools/utils/plugin-helpers");
|
|
6
|
-
let _storm_software_workspace_tools_utils_project_tags = require("@storm-software/workspace-tools/utils/project-tags");
|
|
7
|
-
let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
|
|
8
|
-
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
9
|
-
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
10
|
-
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
11
|
-
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
12
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
13
|
-
let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
|
|
14
|
-
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
15
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
16
|
-
let defu = require("defu");
|
|
17
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
18
|
-
let node_fs_promises = require("node:fs/promises");
|
|
19
|
-
let nx_src_config_nx_json_js = require("nx/src/config/nx-json.js");
|
|
20
|
-
let nx_src_utils_package_json_js = require("nx/src/utils/package-json.js");
|
|
21
|
-
|
|
22
|
-
//#region src/helpers/constants.ts
|
|
23
|
-
/**
|
|
24
|
-
* A list of Nx input strings that describe the Powerlines configuration file
|
|
25
|
-
*/
|
|
26
|
-
const CONFIG_INPUTS = [
|
|
27
|
-
"{projectRoot}/{framework}.json",
|
|
28
|
-
"{projectRoot}/{framework}.*.json",
|
|
29
|
-
"{projectRoot}/{framework}.jsonc",
|
|
30
|
-
"{projectRoot}/{framework}.*.jsonc",
|
|
31
|
-
"{projectRoot}/{framework}.json5",
|
|
32
|
-
"{projectRoot}/{framework}.*.json5",
|
|
33
|
-
"{projectRoot}/{framework}.yaml",
|
|
34
|
-
"{projectRoot}/{framework}.*.yaml",
|
|
35
|
-
"{projectRoot}/{framework}.yml",
|
|
36
|
-
"{projectRoot}/{framework}.*.yml",
|
|
37
|
-
"{projectRoot}/{framework}.toml",
|
|
38
|
-
"{projectRoot}/{framework}.*.toml",
|
|
39
|
-
"{projectRoot}/{framework}.config.js",
|
|
40
|
-
"{projectRoot}/{framework}.*.config.js",
|
|
41
|
-
"{projectRoot}/{framework}.config.cjs",
|
|
42
|
-
"{projectRoot}/{framework}.*.config.cjs",
|
|
43
|
-
"{projectRoot}/{framework}.config.mjs",
|
|
44
|
-
"{projectRoot}/{framework}.*.config.mjs",
|
|
45
|
-
"{projectRoot}/{framework}.config.ts",
|
|
46
|
-
"{projectRoot}/{framework}.*.config.ts",
|
|
47
|
-
"{projectRoot}/{framework}.config.cts",
|
|
48
|
-
"{projectRoot}/{framework}.*.config.cts",
|
|
49
|
-
"{projectRoot}/{framework}.config.mts",
|
|
50
|
-
"{projectRoot}/{framework}.*.config.mts"
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/helpers/plugin-utilities.ts
|
|
55
|
-
/**
|
|
56
|
-
* Generates Nx input strings for the Powerlines configuration file, replacing the `{framework}` placeholder with the specified framework name.
|
|
57
|
-
*
|
|
58
|
-
* @param framework - The framework name to use in the input strings
|
|
59
|
-
* @returns An array of Nx input strings for the configuration file
|
|
60
|
-
*/
|
|
61
|
-
function getNxTargetInputs(framework) {
|
|
62
|
-
return CONFIG_INPUTS.map((input) => input.replace("{framework}", framework));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Generates Nx input strings for the Powerlines configuration file, replacing the `{framework}` placeholder with the specified framework name.
|
|
66
|
-
*
|
|
67
|
-
* @param framework - The framework name to use in the input strings
|
|
68
|
-
* @returns An array of Nx input strings for the configuration file
|
|
69
|
-
*/
|
|
70
|
-
function getNxPluginInputs(framework) {
|
|
71
|
-
return `**/{${getNxTargetInputs(framework).map((input) => input.replace("{projectRoot}/", "")).join(",")}}`;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Creates an Nx plugin that integrates Powerlines into the Nx build process.
|
|
75
|
-
*
|
|
76
|
-
* @param opts - Options for creating the Nx plugin
|
|
77
|
-
* @returns A CreateNodesV2 function that can be used as an Nx plugin
|
|
78
|
-
*/
|
|
79
|
-
function createNxPlugin(opts) {
|
|
80
|
-
const framework = (0, _stryke_string_format_kebab_case.kebabCase)(opts?.framework) || "powerlines";
|
|
81
|
-
const title = `${(0, _stryke_string_format_title_case.titleCase)(framework)} Nx Plugin`;
|
|
82
|
-
try {
|
|
83
|
-
const name = opts?.name || `${framework}/nx/plugin`;
|
|
84
|
-
const artifactsFolder = opts?.artifactsFolder || `{projectRoot}/.${framework}`;
|
|
85
|
-
const targetInputs = getNxTargetInputs(framework);
|
|
86
|
-
const pluginInputs = getNxPluginInputs(framework);
|
|
87
|
-
return [pluginInputs, async (configFiles, options, contextV2) => {
|
|
88
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Initializing the ${title} for the following inputs: ${pluginInputs}`);
|
|
89
|
-
if (!(0, _stryke_env_get_env_paths.getEnvPaths)({
|
|
90
|
-
orgId: "storm-software",
|
|
91
|
-
appId: framework,
|
|
92
|
-
workspaceRoot: contextV2.workspaceRoot
|
|
93
|
-
}).cache) throw new Error("The cache directory could not be determined.");
|
|
94
|
-
const nxJson = (0, nx_src_config_nx_json_js.readNxJson)(contextV2.workspaceRoot);
|
|
95
|
-
return (0, _nx_devkit.createNodesFromFiles)(async (configFile, _, context) => {
|
|
96
|
-
try {
|
|
97
|
-
const projectRoot = (0, _storm_software_workspace_tools_utils_plugin_helpers.getProjectRoot)(configFile, contextV2.workspaceRoot);
|
|
98
|
-
if (!projectRoot) {
|
|
99
|
-
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}`);
|
|
100
|
-
return {};
|
|
101
|
-
}
|
|
102
|
-
const root = (0, _storm_software_workspace_tools_utils_plugin_helpers.getRoot)(projectRoot, context);
|
|
103
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Loading ${framework} user configuration for project in root directory ${projectRoot}.`);
|
|
104
|
-
if (!(0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)(contextV2.workspaceRoot, projectRoot, "package.json"))) {
|
|
105
|
-
if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Cannot find \`package.json\` file in the project's root directory (path: "${(0, _stryke_path_join_paths.joinPaths)(contextV2.workspaceRoot, projectRoot)}"). Skipping project configuration.`);
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
108
|
-
const packageJsonContent = await (0, node_fs_promises.readFile)((0, _stryke_path_join_paths.joinPaths)(contextV2.workspaceRoot, projectRoot, "package.json"), "utf8");
|
|
109
|
-
if (!packageJsonContent) {
|
|
110
|
-
if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No package.json file found for project in root directory ${projectRoot}`);
|
|
111
|
-
return {};
|
|
112
|
-
}
|
|
113
|
-
const packageJson = JSON.parse(packageJsonContent);
|
|
114
|
-
const projectConfig = (0, _storm_software_workspace_tools_utils_plugin_helpers.getProjectConfigFromProjectRoot)(projectRoot, packageJson);
|
|
115
|
-
if (!projectConfig) {
|
|
116
|
-
if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No project configuration found for project in root directory ${projectRoot}`);
|
|
117
|
-
return {};
|
|
118
|
-
}
|
|
119
|
-
const targets = (0, nx_src_utils_package_json_js.readTargetsFromPackageJson)(packageJson, nxJson, projectRoot, context.workspaceRoot);
|
|
120
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Preparing Nx targets for project in root directory ${projectRoot}.`);
|
|
121
|
-
if (options?.clean !== false && !targets[options?.clean?.targetName || "clean"]) targets[options?.clean?.targetName || "clean"] = {
|
|
122
|
-
cache: options?.clean?.cache ?? options?.cache ?? true,
|
|
123
|
-
inputs: Array.isArray(options?.clean?.inputs) ? options.clean.inputs : (0, _storm_software_workspace_tools_utils_nx_json.withNamedInputs)(targetInputs, [options?.clean?.inputs || "typescript"]),
|
|
124
|
-
outputs: options?.clean?.outputs,
|
|
125
|
-
executor: options?.clean?.executor || `@${framework}/nx:${options?.clean?.targetName || "clean"}`,
|
|
126
|
-
dependsOn: options?.clean?.dependsOn ?? [`^${options?.clean?.targetName || "clean"}`],
|
|
127
|
-
defaultConfiguration: options?.clean?.defaultConfiguration || "production",
|
|
128
|
-
options: {
|
|
129
|
-
root: projectRoot,
|
|
130
|
-
configFile,
|
|
131
|
-
projectType: projectConfig.projectType,
|
|
132
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
133
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
134
|
-
},
|
|
135
|
-
configurations: {
|
|
136
|
-
production: { mode: "production" },
|
|
137
|
-
test: { mode: "test" },
|
|
138
|
-
development: {
|
|
139
|
-
mode: "development",
|
|
140
|
-
skipCache: true
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
if (options?.prepare !== false && !targets[options?.prepare?.targetName || "prepare"]) targets[options?.prepare?.targetName || "prepare"] = {
|
|
145
|
-
cache: options?.prepare?.cache ?? options?.cache ?? true,
|
|
146
|
-
inputs: Array.isArray(options?.prepare?.inputs) ? options.prepare.inputs : (0, _storm_software_workspace_tools_utils_nx_json.withNamedInputs)(targetInputs, [options?.prepare?.inputs || "typescript"]),
|
|
147
|
-
outputs: options?.prepare?.outputs ?? [artifactsFolder],
|
|
148
|
-
executor: options?.prepare?.executor || `@${framework}/nx:${options?.prepare?.targetName || "prepare"}`,
|
|
149
|
-
dependsOn: options?.prepare?.dependsOn ?? [`^${options?.prepare?.targetName || "build"}`].filter(Boolean),
|
|
150
|
-
defaultConfiguration: options?.prepare?.defaultConfiguration || "production",
|
|
151
|
-
options: {
|
|
152
|
-
projectType: projectConfig.projectType,
|
|
153
|
-
configFile,
|
|
154
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
155
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
156
|
-
},
|
|
157
|
-
configurations: {
|
|
158
|
-
production: { mode: "production" },
|
|
159
|
-
test: { mode: "test" },
|
|
160
|
-
development: {
|
|
161
|
-
mode: "development",
|
|
162
|
-
skipCache: true
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
if (options?.build !== false && !targets[options?.build?.targetName || "build"]) targets[options?.build?.targetName || "build"] = {
|
|
167
|
-
cache: options?.build?.cache ?? options?.cache ?? true,
|
|
168
|
-
inputs: Array.isArray(options?.build?.inputs) ? options.build.inputs : (0, _storm_software_workspace_tools_utils_nx_json.withNamedInputs)(targetInputs, [options?.build?.inputs || "typescript"]),
|
|
169
|
-
outputs: options?.build?.outputs ?? ["{options.outputPath}"],
|
|
170
|
-
executor: options?.build?.executor || `@${framework}/nx:${options?.build?.targetName || "build"}`,
|
|
171
|
-
dependsOn: options?.build?.dependsOn ?? [`^${options?.build?.targetName || "build"}`, _stryke_env_environment_checks.isDevelopment ? void 0 : (0, _stryke_type_checks_is_set_object.isSetObject)(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"].filter(Boolean),
|
|
172
|
-
defaultConfiguration: options?.build?.defaultConfiguration || "production",
|
|
173
|
-
options: {
|
|
174
|
-
projectType: projectConfig.projectType,
|
|
175
|
-
configFile,
|
|
176
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
177
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
178
|
-
},
|
|
179
|
-
configurations: {
|
|
180
|
-
production: { mode: "production" },
|
|
181
|
-
test: { mode: "test" },
|
|
182
|
-
development: {
|
|
183
|
-
mode: "development",
|
|
184
|
-
skipCache: true
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
if (options?.lint !== false && !targets[options?.lint?.targetName || "lint"]) targets[options?.lint?.targetName || "lint"] = {
|
|
189
|
-
cache: options?.lint?.cache ?? options?.cache ?? true,
|
|
190
|
-
inputs: Array.isArray(options?.lint?.inputs) ? options.lint.inputs : (0, _storm_software_workspace_tools_utils_nx_json.withNamedInputs)([...targetInputs, artifactsFolder], options?.lint?.inputs ? [options.lint.inputs] : ["linting", "typescript"]),
|
|
191
|
-
outputs: options?.lint?.outputs ?? ["{options.outputPath}"],
|
|
192
|
-
executor: options?.lint?.executor || `@${framework}/nx:${options?.lint?.targetName || "lint"}`,
|
|
193
|
-
dependsOn: options?.lint?.dependsOn ?? [`^${options?.lint?.targetName || "lint"}`, _stryke_env_environment_checks.isDevelopment ? void 0 : (0, _stryke_type_checks_is_set_object.isSetObject)(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"].filter(Boolean),
|
|
194
|
-
defaultConfiguration: options?.lint?.defaultConfiguration || "production",
|
|
195
|
-
options: {
|
|
196
|
-
projectType: projectConfig.projectType,
|
|
197
|
-
configFile,
|
|
198
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
199
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
200
|
-
},
|
|
201
|
-
configurations: {
|
|
202
|
-
production: { mode: "production" },
|
|
203
|
-
test: { mode: "test" },
|
|
204
|
-
development: {
|
|
205
|
-
mode: "development",
|
|
206
|
-
skipCache: true
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
if (options?.docs !== false && !targets[options?.docs?.targetName || "docs"]) targets[options?.docs?.targetName || "docs"] = {
|
|
211
|
-
cache: options?.docs?.cache ?? options?.cache ?? true,
|
|
212
|
-
inputs: Array.isArray(options?.docs?.inputs) ? options.docs.inputs : (0, _storm_software_workspace_tools_utils_nx_json.withNamedInputs)([...targetInputs, artifactsFolder], options?.docs?.inputs ? [options.docs.inputs] : ["documentation", "typescript"]),
|
|
213
|
-
outputs: options?.docs?.outputs ?? ["{options.outputPath}"],
|
|
214
|
-
executor: options?.docs?.executor || `@${framework}/nx:${options?.docs?.targetName || "docs"}`,
|
|
215
|
-
dependsOn: options?.docs?.dependsOn ?? [
|
|
216
|
-
`^${options?.docs?.targetName || "docs"}`,
|
|
217
|
-
options?.build !== false && `${options?.build?.targetName || "build"}`,
|
|
218
|
-
_stryke_env_environment_checks.isDevelopment ? void 0 : (0, _stryke_type_checks_is_set_object.isSetObject)(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"
|
|
219
|
-
].filter(Boolean),
|
|
220
|
-
defaultConfiguration: options?.docs?.defaultConfiguration || "production",
|
|
221
|
-
options: {
|
|
222
|
-
projectType: projectConfig.projectType,
|
|
223
|
-
configFile,
|
|
224
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
225
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
226
|
-
},
|
|
227
|
-
configurations: {
|
|
228
|
-
production: { mode: "production" },
|
|
229
|
-
test: { mode: "test" },
|
|
230
|
-
development: {
|
|
231
|
-
mode: "development",
|
|
232
|
-
skipCache: true
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
if (options?.deploy !== false && !targets[options?.deploy?.targetName || "deploy"]) targets[options?.deploy?.targetName || "deploy"] = {
|
|
237
|
-
cache: options?.deploy?.cache ?? false,
|
|
238
|
-
inputs: Array.isArray(options?.deploy?.inputs) ? options.deploy.inputs : (0, _storm_software_workspace_tools_utils_nx_json.withNamedInputs)([...targetInputs, artifactsFolder], options?.deploy?.inputs ? [options.deploy.inputs] : ["documentation", "typescript"]),
|
|
239
|
-
outputs: options?.deploy?.outputs ?? ["{options.outputPath}"],
|
|
240
|
-
executor: options?.deploy?.executor || `@${framework}/nx:${options?.deploy?.targetName || "deploy"}`,
|
|
241
|
-
dependsOn: options?.deploy?.dependsOn ?? [
|
|
242
|
-
`^${options?.deploy?.targetName || "deploy"}`,
|
|
243
|
-
options?.build !== false && `${options?.build?.targetName || "build"}`,
|
|
244
|
-
_stryke_env_environment_checks.isDevelopment ? void 0 : (0, _stryke_type_checks_is_set_object.isSetObject)(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"
|
|
245
|
-
].filter(Boolean),
|
|
246
|
-
defaultConfiguration: options?.deploy?.defaultConfiguration || "production",
|
|
247
|
-
options: {
|
|
248
|
-
projectType: projectConfig.projectType,
|
|
249
|
-
configFile,
|
|
250
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
251
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
252
|
-
},
|
|
253
|
-
configurations: {
|
|
254
|
-
production: { mode: "production" },
|
|
255
|
-
test: { mode: "test" },
|
|
256
|
-
development: {
|
|
257
|
-
mode: "development",
|
|
258
|
-
skipCache: true
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
(0, _storm_software_workspace_tools_utils_project_tags.setDefaultProjectTags)(projectConfig, name);
|
|
263
|
-
(0, _storm_software_workspace_tools_utils_project_tags.addProjectTag)(projectConfig, framework, projectConfig.projectType || "library", { overwrite: true });
|
|
264
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Completed preparing Nx configuration for project in root directory ${projectRoot}.`);
|
|
265
|
-
return { projects: { [root]: (0, defu.default)(projectConfig, {
|
|
266
|
-
projectType: projectConfig.projectType || "library",
|
|
267
|
-
root,
|
|
268
|
-
sourceRoot: (0, _stryke_path_join_paths.joinPaths)(root, "src"),
|
|
269
|
-
targets
|
|
270
|
-
}) } };
|
|
271
|
-
} catch (error) {
|
|
272
|
-
console.error(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Failed to process the project configuration for file "${configFile}" - ${(0, _stryke_type_checks_is_error.isError)(error) ? error.message : (0, _stryke_type_checks_is_set_string.isSetString)(error) ? error : "Unknown fatal error"}`);
|
|
273
|
-
return {};
|
|
274
|
-
}
|
|
275
|
-
}, configFiles, options, contextV2);
|
|
276
|
-
}];
|
|
277
|
-
} catch (error) {
|
|
278
|
-
console.error(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - ${(0, _stryke_type_checks_is_error.isError)(error) ? error.message : (0, _stryke_type_checks_is_set_string.isSetString)(error) ? error : "Unknown fatal error during plugin initialization"}`);
|
|
279
|
-
throw new Error(`Failed to initialize the ${title} - ${(0, _stryke_type_checks_is_error.isError)(error) ? error.message : (0, _stryke_type_checks_is_set_string.isSetString)(error) ? error : "See previous logs for more details"}`, { cause: error instanceof Error ? error : void 0 });
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
//#endregion
|
|
284
|
-
//#region src/plugin/index.ts
|
|
285
|
-
const createNodesV2 = createNxPlugin({ framework: "powerlines" });
|
|
286
|
-
|
|
287
|
-
//#endregion
|
|
288
|
-
exports.createNodesV2 = createNodesV2;
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import { createNodesFromFiles } from "@nx/devkit";
|
|
2
|
-
import { withNamedInputs } from "@storm-software/workspace-tools/utils/nx-json";
|
|
3
|
-
import { getProjectConfigFromProjectRoot, getProjectRoot, getRoot } from "@storm-software/workspace-tools/utils/plugin-helpers";
|
|
4
|
-
import { addProjectTag, setDefaultProjectTags } from "@storm-software/workspace-tools/utils/project-tags";
|
|
5
|
-
import { isDevelopment } from "@stryke/env/environment-checks";
|
|
6
|
-
import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
7
|
-
import { existsSync } from "@stryke/fs/exists";
|
|
8
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
9
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
10
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
11
|
-
import { isError } from "@stryke/type-checks/is-error";
|
|
12
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
13
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
14
|
-
import defu from "defu";
|
|
15
|
-
import { readFile } from "node:fs/promises";
|
|
16
|
-
import { readNxJson as readNxJson$1 } from "nx/src/config/nx-json.js";
|
|
17
|
-
import { readTargetsFromPackageJson } from "nx/src/utils/package-json.js";
|
|
18
|
-
|
|
19
|
-
//#region src/helpers/constants.ts
|
|
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 src/helpers/plugin-utilities.ts
|
|
52
|
-
/**
|
|
53
|
-
* Generates Nx input strings for the Powerlines configuration file, replacing the `{framework}` placeholder with the specified framework name.
|
|
54
|
-
*
|
|
55
|
-
* @param framework - The framework name to use in the input strings
|
|
56
|
-
* @returns An array of Nx input strings for the configuration file
|
|
57
|
-
*/
|
|
58
|
-
function getNxTargetInputs(framework) {
|
|
59
|
-
return CONFIG_INPUTS.map((input) => input.replace("{framework}", framework));
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Generates Nx input strings for the Powerlines configuration file, replacing the `{framework}` placeholder with the specified framework name.
|
|
63
|
-
*
|
|
64
|
-
* @param framework - The framework name to use in the input strings
|
|
65
|
-
* @returns An array of Nx input strings for the configuration file
|
|
66
|
-
*/
|
|
67
|
-
function getNxPluginInputs(framework) {
|
|
68
|
-
return `**/{${getNxTargetInputs(framework).map((input) => input.replace("{projectRoot}/", "")).join(",")}}`;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Creates an Nx plugin that integrates Powerlines into the Nx build process.
|
|
72
|
-
*
|
|
73
|
-
* @param opts - Options for creating the Nx plugin
|
|
74
|
-
* @returns A CreateNodesV2 function that can be used as an Nx plugin
|
|
75
|
-
*/
|
|
76
|
-
function createNxPlugin(opts) {
|
|
77
|
-
const framework = kebabCase(opts?.framework) || "powerlines";
|
|
78
|
-
const title = `${titleCase(framework)} Nx Plugin`;
|
|
79
|
-
try {
|
|
80
|
-
const name = opts?.name || `${framework}/nx/plugin`;
|
|
81
|
-
const artifactsFolder = opts?.artifactsFolder || `{projectRoot}/.${framework}`;
|
|
82
|
-
const targetInputs = getNxTargetInputs(framework);
|
|
83
|
-
const pluginInputs = getNxPluginInputs(framework);
|
|
84
|
-
return [pluginInputs, async (configFiles, options, contextV2) => {
|
|
85
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Initializing the ${title} for the following inputs: ${pluginInputs}`);
|
|
86
|
-
if (!getEnvPaths({
|
|
87
|
-
orgId: "storm-software",
|
|
88
|
-
appId: framework,
|
|
89
|
-
workspaceRoot: contextV2.workspaceRoot
|
|
90
|
-
}).cache) throw new Error("The cache directory could not be determined.");
|
|
91
|
-
const nxJson = readNxJson$1(contextV2.workspaceRoot);
|
|
92
|
-
return createNodesFromFiles(async (configFile, _, context) => {
|
|
93
|
-
try {
|
|
94
|
-
const projectRoot = getProjectRoot(configFile, contextV2.workspaceRoot);
|
|
95
|
-
if (!projectRoot) {
|
|
96
|
-
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}`);
|
|
97
|
-
return {};
|
|
98
|
-
}
|
|
99
|
-
const root = getRoot(projectRoot, context);
|
|
100
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Loading ${framework} user configuration for project in root directory ${projectRoot}.`);
|
|
101
|
-
if (!existsSync(joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"))) {
|
|
102
|
-
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.`);
|
|
103
|
-
return {};
|
|
104
|
-
}
|
|
105
|
-
const packageJsonContent = await readFile(joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"), "utf8");
|
|
106
|
-
if (!packageJsonContent) {
|
|
107
|
-
if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No package.json file found for project in root directory ${projectRoot}`);
|
|
108
|
-
return {};
|
|
109
|
-
}
|
|
110
|
-
const packageJson = JSON.parse(packageJsonContent);
|
|
111
|
-
const projectConfig = getProjectConfigFromProjectRoot(projectRoot, packageJson);
|
|
112
|
-
if (!projectConfig) {
|
|
113
|
-
if (options?.verboseOutput) console.warn(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - No project configuration found for project in root directory ${projectRoot}`);
|
|
114
|
-
return {};
|
|
115
|
-
}
|
|
116
|
-
const targets = readTargetsFromPackageJson(packageJson, nxJson, projectRoot, context.workspaceRoot);
|
|
117
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Preparing Nx targets for project in root directory ${projectRoot}.`);
|
|
118
|
-
if (options?.clean !== false && !targets[options?.clean?.targetName || "clean"]) targets[options?.clean?.targetName || "clean"] = {
|
|
119
|
-
cache: options?.clean?.cache ?? options?.cache ?? true,
|
|
120
|
-
inputs: Array.isArray(options?.clean?.inputs) ? options.clean.inputs : withNamedInputs(targetInputs, [options?.clean?.inputs || "typescript"]),
|
|
121
|
-
outputs: options?.clean?.outputs,
|
|
122
|
-
executor: options?.clean?.executor || `@${framework}/nx:${options?.clean?.targetName || "clean"}`,
|
|
123
|
-
dependsOn: options?.clean?.dependsOn ?? [`^${options?.clean?.targetName || "clean"}`],
|
|
124
|
-
defaultConfiguration: options?.clean?.defaultConfiguration || "production",
|
|
125
|
-
options: {
|
|
126
|
-
root: projectRoot,
|
|
127
|
-
configFile,
|
|
128
|
-
projectType: projectConfig.projectType,
|
|
129
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
130
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
131
|
-
},
|
|
132
|
-
configurations: {
|
|
133
|
-
production: { mode: "production" },
|
|
134
|
-
test: { mode: "test" },
|
|
135
|
-
development: {
|
|
136
|
-
mode: "development",
|
|
137
|
-
skipCache: true
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
if (options?.prepare !== false && !targets[options?.prepare?.targetName || "prepare"]) targets[options?.prepare?.targetName || "prepare"] = {
|
|
142
|
-
cache: options?.prepare?.cache ?? options?.cache ?? true,
|
|
143
|
-
inputs: Array.isArray(options?.prepare?.inputs) ? options.prepare.inputs : withNamedInputs(targetInputs, [options?.prepare?.inputs || "typescript"]),
|
|
144
|
-
outputs: options?.prepare?.outputs ?? [artifactsFolder],
|
|
145
|
-
executor: options?.prepare?.executor || `@${framework}/nx:${options?.prepare?.targetName || "prepare"}`,
|
|
146
|
-
dependsOn: options?.prepare?.dependsOn ?? [`^${options?.prepare?.targetName || "build"}`].filter(Boolean),
|
|
147
|
-
defaultConfiguration: options?.prepare?.defaultConfiguration || "production",
|
|
148
|
-
options: {
|
|
149
|
-
projectType: projectConfig.projectType,
|
|
150
|
-
configFile,
|
|
151
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
152
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
153
|
-
},
|
|
154
|
-
configurations: {
|
|
155
|
-
production: { mode: "production" },
|
|
156
|
-
test: { mode: "test" },
|
|
157
|
-
development: {
|
|
158
|
-
mode: "development",
|
|
159
|
-
skipCache: true
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
if (options?.build !== false && !targets[options?.build?.targetName || "build"]) targets[options?.build?.targetName || "build"] = {
|
|
164
|
-
cache: options?.build?.cache ?? options?.cache ?? true,
|
|
165
|
-
inputs: Array.isArray(options?.build?.inputs) ? options.build.inputs : withNamedInputs(targetInputs, [options?.build?.inputs || "typescript"]),
|
|
166
|
-
outputs: options?.build?.outputs ?? ["{options.outputPath}"],
|
|
167
|
-
executor: options?.build?.executor || `@${framework}/nx:${options?.build?.targetName || "build"}`,
|
|
168
|
-
dependsOn: options?.build?.dependsOn ?? [`^${options?.build?.targetName || "build"}`, isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"].filter(Boolean),
|
|
169
|
-
defaultConfiguration: options?.build?.defaultConfiguration || "production",
|
|
170
|
-
options: {
|
|
171
|
-
projectType: projectConfig.projectType,
|
|
172
|
-
configFile,
|
|
173
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
174
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
175
|
-
},
|
|
176
|
-
configurations: {
|
|
177
|
-
production: { mode: "production" },
|
|
178
|
-
test: { mode: "test" },
|
|
179
|
-
development: {
|
|
180
|
-
mode: "development",
|
|
181
|
-
skipCache: true
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
if (options?.lint !== false && !targets[options?.lint?.targetName || "lint"]) targets[options?.lint?.targetName || "lint"] = {
|
|
186
|
-
cache: options?.lint?.cache ?? options?.cache ?? true,
|
|
187
|
-
inputs: Array.isArray(options?.lint?.inputs) ? options.lint.inputs : withNamedInputs([...targetInputs, artifactsFolder], options?.lint?.inputs ? [options.lint.inputs] : ["linting", "typescript"]),
|
|
188
|
-
outputs: options?.lint?.outputs ?? ["{options.outputPath}"],
|
|
189
|
-
executor: options?.lint?.executor || `@${framework}/nx:${options?.lint?.targetName || "lint"}`,
|
|
190
|
-
dependsOn: options?.lint?.dependsOn ?? [`^${options?.lint?.targetName || "lint"}`, isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"].filter(Boolean),
|
|
191
|
-
defaultConfiguration: options?.lint?.defaultConfiguration || "production",
|
|
192
|
-
options: {
|
|
193
|
-
projectType: projectConfig.projectType,
|
|
194
|
-
configFile,
|
|
195
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
196
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
197
|
-
},
|
|
198
|
-
configurations: {
|
|
199
|
-
production: { mode: "production" },
|
|
200
|
-
test: { mode: "test" },
|
|
201
|
-
development: {
|
|
202
|
-
mode: "development",
|
|
203
|
-
skipCache: true
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
if (options?.docs !== false && !targets[options?.docs?.targetName || "docs"]) targets[options?.docs?.targetName || "docs"] = {
|
|
208
|
-
cache: options?.docs?.cache ?? options?.cache ?? true,
|
|
209
|
-
inputs: Array.isArray(options?.docs?.inputs) ? options.docs.inputs : withNamedInputs([...targetInputs, artifactsFolder], options?.docs?.inputs ? [options.docs.inputs] : ["documentation", "typescript"]),
|
|
210
|
-
outputs: options?.docs?.outputs ?? ["{options.outputPath}"],
|
|
211
|
-
executor: options?.docs?.executor || `@${framework}/nx:${options?.docs?.targetName || "docs"}`,
|
|
212
|
-
dependsOn: options?.docs?.dependsOn ?? [
|
|
213
|
-
`^${options?.docs?.targetName || "docs"}`,
|
|
214
|
-
options?.build !== false && `${options?.build?.targetName || "build"}`,
|
|
215
|
-
isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"
|
|
216
|
-
].filter(Boolean),
|
|
217
|
-
defaultConfiguration: options?.docs?.defaultConfiguration || "production",
|
|
218
|
-
options: {
|
|
219
|
-
projectType: projectConfig.projectType,
|
|
220
|
-
configFile,
|
|
221
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
222
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
223
|
-
},
|
|
224
|
-
configurations: {
|
|
225
|
-
production: { mode: "production" },
|
|
226
|
-
test: { mode: "test" },
|
|
227
|
-
development: {
|
|
228
|
-
mode: "development",
|
|
229
|
-
skipCache: true
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
if (options?.deploy !== false && !targets[options?.deploy?.targetName || "deploy"]) targets[options?.deploy?.targetName || "deploy"] = {
|
|
234
|
-
cache: options?.deploy?.cache ?? false,
|
|
235
|
-
inputs: Array.isArray(options?.deploy?.inputs) ? options.deploy.inputs : withNamedInputs([...targetInputs, artifactsFolder], options?.deploy?.inputs ? [options.deploy.inputs] : ["documentation", "typescript"]),
|
|
236
|
-
outputs: options?.deploy?.outputs ?? ["{options.outputPath}"],
|
|
237
|
-
executor: options?.deploy?.executor || `@${framework}/nx:${options?.deploy?.targetName || "deploy"}`,
|
|
238
|
-
dependsOn: options?.deploy?.dependsOn ?? [
|
|
239
|
-
`^${options?.deploy?.targetName || "deploy"}`,
|
|
240
|
-
options?.build !== false && `${options?.build?.targetName || "build"}`,
|
|
241
|
-
isDevelopment ? void 0 : isSetObject(options?.prepare) && options?.prepare?.targetName ? options?.prepare?.targetName : "prepare"
|
|
242
|
-
].filter(Boolean),
|
|
243
|
-
defaultConfiguration: options?.deploy?.defaultConfiguration || "production",
|
|
244
|
-
options: {
|
|
245
|
-
projectType: projectConfig.projectType,
|
|
246
|
-
configFile,
|
|
247
|
-
outputPath: `{workspaceRoot}/${projectRoot}/dist`,
|
|
248
|
-
copyPath: `{workspaceRoot}/dist/${projectRoot}`
|
|
249
|
-
},
|
|
250
|
-
configurations: {
|
|
251
|
-
production: { mode: "production" },
|
|
252
|
-
test: { mode: "test" },
|
|
253
|
-
development: {
|
|
254
|
-
mode: "development",
|
|
255
|
-
skipCache: true
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
setDefaultProjectTags(projectConfig, name);
|
|
260
|
-
addProjectTag(projectConfig, framework, projectConfig.projectType || "library", { overwrite: true });
|
|
261
|
-
if (options?.verboseOutput) console.debug(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Completed preparing Nx configuration for project in root directory ${projectRoot}.`);
|
|
262
|
-
return { projects: { [root]: defu(projectConfig, {
|
|
263
|
-
projectType: projectConfig.projectType || "library",
|
|
264
|
-
root,
|
|
265
|
-
sourceRoot: joinPaths(root, "src"),
|
|
266
|
-
targets
|
|
267
|
-
}) } };
|
|
268
|
-
} catch (error) {
|
|
269
|
-
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"}`);
|
|
270
|
-
return {};
|
|
271
|
-
}
|
|
272
|
-
}, configFiles, options, contextV2);
|
|
273
|
-
}];
|
|
274
|
-
} catch (error) {
|
|
275
|
-
console.error(`[${title}] - ${(/* @__PURE__ */ new Date()).toISOString()} - ${isError(error) ? error.message : isSetString(error) ? error : "Unknown fatal error during plugin initialization"}`);
|
|
276
|
-
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 });
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region src/plugin/index.ts
|
|
282
|
-
const createNodesV2 = createNxPlugin({ framework: "powerlines" });
|
|
283
|
-
|
|
284
|
-
//#endregion
|
|
285
|
-
export { createNodesV2 };
|
|
286
|
-
//# sourceMappingURL=index.mjs.map
|