@storm-software/workspace-tools 1.227.1 → 1.227.3
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/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/index.js +158653 -125171
- package/meta.json +4069 -1586
- package/package.json +1 -1
- package/src/plugins/typescript/tsdown.d.ts +5 -0
- package/src/plugins/typescript/tsdown.js +259 -0
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@storm-software/workspace-tools","version":"1.227.
|
|
1
|
+
{"name":"@storm-software/workspace-tools","version":"1.227.3","type":"commonjs","description":"Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.","repository":{"type":"github","url":"https://github.com/storm-software/storm-ops","directory":"packages/workspace-tools"},"homepage":"https://stormsoftware.com","bugs":"https://github.com/storm-software/storm-ops/issues","author":{"name":"Storm Software","email":"contact@stormsoftware.com","url":"https://stormsoftware.com"},"license":"Apache-2.0","private":false,"main":"./index.js","exports":{".":"./index.js","./package.json":"./package.json","./config/nx-default.json":"./config/nx-default.json","./config/nx-cloud.json":"./config/nx-cloud.json","./assets/cjs_shims":"./assets/cjs_shims.js","./assets/esm_shims":"./assets/esm_shims.js","./migrations.json":"./migrations.json","./generators.json":"./generators.json","./generators/*/schema.json":"./src/generators/*/schema.json","./executors.json":"./executors.json","./executors/*/schema.json":"./src/executors/*/schema.json","./plugins/rust":"./src/plugins/rust/index.js","./plugins/typescript":"./src/plugins/typescript/index.js","./plugins/typescript/tsup":"./src/plugins/typescript/tsup.js","./plugins/typescript/tsdown":"./src/plugins/typescript/tsdown.js","./preset":"./src/generators/preset/preset.js","./base":"./src/base/index.js","./base/*":"./src/base/*.js","./utils":"./src/utils/index.js","./utils/*":"./src/utils/*.js"},"typings":"./declarations.d.ts","keywords":["monorepo","open-system","storm","storm-ops","storm-stack","stormstack","sullivanpj"],"peerDependencies":{"@microsoft/api-extractor":"^7.48.1","@nx/devkit":"^20.3.1","@samchon/openapi":"^2.3.0","nx":"^20.3.1","tsdown":"0.5.3","typescript":"^5.7.2"},"peerDependenciesMeta":{"@microsoft/api-extractor":{"optional":true},"@nx/devkit":{"optional":false},"@samchon/openapi":{"optional":true},"nx":{"optional":false},"tsdown":{"optional":true},"typescript":{"optional":false}},"dependencies":{"@ltd/j-toml":"1.38.0","@nx/devkit":"^20.3.1","@size-limit/esbuild":"11.1.4","@size-limit/esbuild-why":"11.1.4","@size-limit/file":"11.1.4","deep-clone":"4.0.0","defu":"6.1.4","fs-extra":"11.2.0","glob":"10.4.2","micromatch":"4.0.7","pkg-types":"^1.1.1","prettier":"^3.3.3","prettier-plugin-packagejson":"2.5.0","read-yaml-file":"2.1.0","semver":"7.6.2","size-limit":"11.1.4","tsdown":"0.5.3","tsup":"8.0.0","typia":"^7.5.0","zod":"^3.24.0","zod-to-json-schema":"3.23.1"},"devDependencies":{"@microsoft/api-extractor":"^7.48.1","@nx/esbuild":"^20.3.1","@types/micromatch":"4.0.9","@types/node":"^22.10.2","@types/semver":"7.5.8","nx":"^20.3.1","typescript":"^5.7.2"},"publishConfig":{"access":"public"},"executors":"./executors.json","generators":"./generators.json"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name2 in all)
|
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/workspace-tools/src/plugins/typescript/tsdown.ts
|
|
20
|
+
var tsdown_exports = {};
|
|
21
|
+
__export(tsdown_exports, {
|
|
22
|
+
createNodesV2: () => createNodesV2,
|
|
23
|
+
name: () => name
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(tsdown_exports);
|
|
26
|
+
var import_devkit = require("@nx/devkit");
|
|
27
|
+
var import_node_fs = require("node:fs");
|
|
28
|
+
var import_node_path = require("node:path");
|
|
29
|
+
var import_nx_json = require("nx/src/config/nx-json.js");
|
|
30
|
+
var import_package_json = require("nx/src/utils/package-json");
|
|
31
|
+
|
|
32
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
33
|
+
var ProjectTagConstants = {
|
|
34
|
+
Language: {
|
|
35
|
+
TAG_ID: "language",
|
|
36
|
+
TYPESCRIPT: "typescript",
|
|
37
|
+
RUST: "rust"
|
|
38
|
+
},
|
|
39
|
+
ProjectType: {
|
|
40
|
+
TAG_ID: "type",
|
|
41
|
+
LIBRARY: "library",
|
|
42
|
+
APPLICATION: "application"
|
|
43
|
+
},
|
|
44
|
+
DistStyle: {
|
|
45
|
+
TAG_ID: "dist-style",
|
|
46
|
+
NORMAL: "normal",
|
|
47
|
+
CLEAN: "clean"
|
|
48
|
+
},
|
|
49
|
+
Provider: {
|
|
50
|
+
TAG_ID: "provider"
|
|
51
|
+
},
|
|
52
|
+
Platform: {
|
|
53
|
+
TAG_ID: "platform",
|
|
54
|
+
NODE: "node",
|
|
55
|
+
BROWSER: "browser",
|
|
56
|
+
NEUTRAL: "neutral",
|
|
57
|
+
WORKER: "worker"
|
|
58
|
+
},
|
|
59
|
+
Registry: {
|
|
60
|
+
TAG_ID: "registry",
|
|
61
|
+
CARGO: "cargo",
|
|
62
|
+
NPM: "npm",
|
|
63
|
+
CONTAINER: "container",
|
|
64
|
+
CYCLONE: "cyclone"
|
|
65
|
+
},
|
|
66
|
+
Plugin: {
|
|
67
|
+
TAG_ID: "plugin"
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var formatProjectTag = (variant, value) => {
|
|
71
|
+
return `${variant}:${value}`;
|
|
72
|
+
};
|
|
73
|
+
var hasProjectTag = (project, variant) => {
|
|
74
|
+
project.tags = project.tags ?? [];
|
|
75
|
+
const prefix = formatProjectTag(variant, "");
|
|
76
|
+
return project.tags.some(
|
|
77
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
var addProjectTag = (project, variant, value, options = {
|
|
81
|
+
overwrite: false
|
|
82
|
+
}) => {
|
|
83
|
+
project.tags = project.tags ?? [];
|
|
84
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
85
|
+
project.tags = project.tags.filter(
|
|
86
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
87
|
+
);
|
|
88
|
+
project.tags.push(formatProjectTag(variant, value));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var addPluginProjectTag = (project, plugin) => {
|
|
92
|
+
project.tags = project.tags ?? [];
|
|
93
|
+
project.tags.push(
|
|
94
|
+
formatProjectTag(ProjectTagConstants.Plugin.TAG_ID, plugin)
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
var setDefaultProjectTags = (project, plugin) => {
|
|
98
|
+
project.tags = project.tags ?? [];
|
|
99
|
+
addProjectTag(
|
|
100
|
+
project,
|
|
101
|
+
ProjectTagConstants.ProjectType.TAG_ID,
|
|
102
|
+
project.projectType === "application" ? ProjectTagConstants.ProjectType.APPLICATION : ProjectTagConstants.ProjectType.LIBRARY,
|
|
103
|
+
{ overwrite: true }
|
|
104
|
+
);
|
|
105
|
+
addProjectTag(
|
|
106
|
+
project,
|
|
107
|
+
ProjectTagConstants.DistStyle.TAG_ID,
|
|
108
|
+
project.targets && Object.keys(project.targets).includes("clean-package") ? ProjectTagConstants.DistStyle.CLEAN : ProjectTagConstants.DistStyle.NORMAL,
|
|
109
|
+
{ overwrite: true }
|
|
110
|
+
);
|
|
111
|
+
addProjectTag(
|
|
112
|
+
project,
|
|
113
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
114
|
+
project.targets?.build?.options.platform === "node" ? ProjectTagConstants.Platform.NODE : project.targets?.build?.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : project.targets?.build?.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
115
|
+
{ overwrite: false }
|
|
116
|
+
);
|
|
117
|
+
if (plugin) {
|
|
118
|
+
addPluginProjectTag(project, plugin);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// packages/workspace-tools/src/plugins/typescript/tsdown.ts
|
|
123
|
+
var name = "storm-software/typescript/tsdown";
|
|
124
|
+
var createNodesV2 = [
|
|
125
|
+
"**/tsdown.config.ts",
|
|
126
|
+
async (configFiles, options, context) => {
|
|
127
|
+
return await (0, import_devkit.createNodesFromFiles)(
|
|
128
|
+
(configFile, options2, context2) => {
|
|
129
|
+
try {
|
|
130
|
+
console.log(`Processing tsdown.config.ts file: ${configFile}`);
|
|
131
|
+
const projectRoot = createProjectRoot(
|
|
132
|
+
configFile,
|
|
133
|
+
context2.workspaceRoot
|
|
134
|
+
);
|
|
135
|
+
if (!projectRoot) {
|
|
136
|
+
console.error(
|
|
137
|
+
`tsdown.config.ts file must be location in the project root directory: ${configFile}`
|
|
138
|
+
);
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
141
|
+
const packageJson = (0, import_devkit.readJsonFile)((0, import_node_path.join)(projectRoot, "package.json"));
|
|
142
|
+
if (!packageJson) {
|
|
143
|
+
console.error(
|
|
144
|
+
`No package.json found in project root: ${projectRoot}`
|
|
145
|
+
);
|
|
146
|
+
return {};
|
|
147
|
+
}
|
|
148
|
+
if (!packageJson.devDependencies?.tsdown && !packageJson.dependencies?.tsdown) {
|
|
149
|
+
console.warn(
|
|
150
|
+
`No "tsdown" dependency or devDependency found in package.json: ${configFile}
|
|
151
|
+
Please add it to your dependencies by running "pnpm add tsdown -D --filter="${packageJson.name}"`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const project = createProjectFromPackageJsonNextToProjectJson(
|
|
155
|
+
(0, import_node_path.join)(projectRoot, "project.json"),
|
|
156
|
+
packageJson
|
|
157
|
+
);
|
|
158
|
+
const nxJson = (0, import_nx_json.readNxJson)(context2.workspaceRoot);
|
|
159
|
+
const targets = (0, import_package_json.readTargetsFromPackageJson)(packageJson, nxJson);
|
|
160
|
+
let relativeRoot = projectRoot.replaceAll("\\", "/").replace(context2.workspaceRoot.replaceAll("\\", "/"), "");
|
|
161
|
+
if (relativeRoot.startsWith("/")) {
|
|
162
|
+
relativeRoot = relativeRoot.slice(1);
|
|
163
|
+
}
|
|
164
|
+
targets["build-base"] ??= {
|
|
165
|
+
cache: true,
|
|
166
|
+
inputs: [
|
|
167
|
+
`{workspaceRoot}/${configFile}`,
|
|
168
|
+
"typescript",
|
|
169
|
+
"^production"
|
|
170
|
+
],
|
|
171
|
+
executor: "nx:run-commands",
|
|
172
|
+
dependsOn: ["clean", "^build"],
|
|
173
|
+
options: {
|
|
174
|
+
command: `tsdown --config="${configFile}"`,
|
|
175
|
+
cwd: relativeRoot
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
targets.build ??= {
|
|
179
|
+
cache: true,
|
|
180
|
+
inputs: ["typescript", "^production"],
|
|
181
|
+
executor: "nx:run-commands",
|
|
182
|
+
dependsOn: ["build-base"],
|
|
183
|
+
options: {
|
|
184
|
+
commands: [
|
|
185
|
+
`pnpm copyfiles LICENSE dist/${relativeRoot}`,
|
|
186
|
+
`pnpm copyfiles --up=2 ./${relativeRoot}/README.md ./${relativeRoot}/package.json dist/${relativeRoot}`,
|
|
187
|
+
`pnpm copyfiles --up=3 ./${relativeRoot}/dist/* dist/${relativeRoot}/dist`
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
targets.clean = {
|
|
192
|
+
executor: "nx:run-commands",
|
|
193
|
+
inputs: [
|
|
194
|
+
`{workspaceRoot}/${configFile}`,
|
|
195
|
+
"typescript",
|
|
196
|
+
"^production"
|
|
197
|
+
],
|
|
198
|
+
options: {
|
|
199
|
+
commands: [
|
|
200
|
+
`pnpm exec rimraf dist/${relativeRoot}`,
|
|
201
|
+
`pnpm exec rimraf ${relativeRoot}/dist`
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
setDefaultProjectTags(project, name);
|
|
206
|
+
const result = project?.name ? {
|
|
207
|
+
projects: {
|
|
208
|
+
[project.name]: {
|
|
209
|
+
...project,
|
|
210
|
+
root: relativeRoot,
|
|
211
|
+
targets
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
} : {};
|
|
215
|
+
console.log(`Writing Results for ${project?.name ?? "missing name"}`);
|
|
216
|
+
console.log(result);
|
|
217
|
+
return result;
|
|
218
|
+
} catch (e) {
|
|
219
|
+
console.error(e);
|
|
220
|
+
return {};
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
configFiles,
|
|
224
|
+
options,
|
|
225
|
+
context
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
];
|
|
229
|
+
function createProjectFromPackageJsonNextToProjectJson(projectJsonPath, packageJson) {
|
|
230
|
+
const { nx, name: name2 } = packageJson;
|
|
231
|
+
const root = (0, import_node_path.dirname)(projectJsonPath);
|
|
232
|
+
const projectJson = (0, import_devkit.readJsonFile)(projectJsonPath);
|
|
233
|
+
return {
|
|
234
|
+
targets: {},
|
|
235
|
+
tags: [],
|
|
236
|
+
name: name2,
|
|
237
|
+
...nx,
|
|
238
|
+
...projectJson,
|
|
239
|
+
root
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function createProjectRoot(configPath, workspaceRoot) {
|
|
243
|
+
try {
|
|
244
|
+
const root = (0, import_node_path.dirname)(configPath);
|
|
245
|
+
const projectRoot = (0, import_node_path.join)(workspaceRoot, root);
|
|
246
|
+
if (!(0, import_node_fs.existsSync)((0, import_node_path.join)(projectRoot, "package.json")) && !(0, import_node_fs.existsSync)((0, import_node_path.join)(projectRoot, "project.json"))) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
return projectRoot;
|
|
250
|
+
} catch (e) {
|
|
251
|
+
console.error(e);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
256
|
+
0 && (module.exports = {
|
|
257
|
+
createNodesV2,
|
|
258
|
+
name
|
|
259
|
+
});
|