@storm-software/workspace-tools 1.30.2 → 1.30.4
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 +14 -0
- package/index.js +100 -86
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/executors/tsup/executor.js +51 -80
- package/src/executors/tsup/get-config.js +3 -2
- package/src/executors/tsup/schema.d.ts +1 -1
- package/src/executors/tsup/schema.json +2 -2
- package/src/executors/tsup-browser/executor.js +51 -80
- package/src/executors/tsup-neutral/executor.js +51 -80
- package/src/executors/tsup-node/executor.js +51 -80
- package/src/utils/index.js +63 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.30.3](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.2...workspace-tools-v1.30.3) (2023-12-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **workspace-tools:** Resolved issue with bad reference to internal packages ([8dec631](https://github.com/storm-software/storm-ops/commit/8dec63115d4f1fd7af8b4c4fb1b7076d1b8c5e8b))
|
|
7
|
+
|
|
8
|
+
## [1.30.2](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.1...workspace-tools-v1.30.2) (2023-12-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **workspace-tools:** Resolved issue where `includeSrc` option was incorrectly set ([a162001](https://github.com/storm-software/storm-ops/commit/a162001761a68900b5dc968f27cb70859bcfcc6a))
|
|
14
|
+
|
|
1
15
|
## [1.30.1](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.0...workspace-tools-v1.30.1) (2023-12-12)
|
|
2
16
|
|
|
3
17
|
|
package/index.js
CHANGED
|
@@ -26484,46 +26484,6 @@ var require_devkit = __commonJS({
|
|
|
26484
26484
|
}
|
|
26485
26485
|
});
|
|
26486
26486
|
|
|
26487
|
-
// node_modules/.pnpm/@nx+esbuild@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.9.0_esbuild@0.19._qd2wqrdgtfa7fy24o2frhwj6em/node_modules/@nx/esbuild/src/executors/esbuild/lib/get-extra-dependencies.js
|
|
26488
|
-
var require_get_extra_dependencies = __commonJS({
|
|
26489
|
-
"node_modules/.pnpm/@nx+esbuild@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.9.0_esbuild@0.19._qd2wqrdgtfa7fy24o2frhwj6em/node_modules/@nx/esbuild/src/executors/esbuild/lib/get-extra-dependencies.js"(exports) {
|
|
26490
|
-
"use strict";
|
|
26491
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26492
|
-
exports.getExtraDependencies = void 0;
|
|
26493
|
-
function getExtraDependencies2(projectName, graph) {
|
|
26494
|
-
const deps = /* @__PURE__ */ new Map();
|
|
26495
|
-
recur(projectName);
|
|
26496
|
-
function recur(currProjectName) {
|
|
26497
|
-
const allDeps = graph.dependencies[currProjectName];
|
|
26498
|
-
const externalDeps = allDeps.reduce((acc, node) => {
|
|
26499
|
-
const found = graph.externalNodes[node.target];
|
|
26500
|
-
if (found)
|
|
26501
|
-
acc.push(found);
|
|
26502
|
-
return acc;
|
|
26503
|
-
}, []);
|
|
26504
|
-
const internalDeps = allDeps.reduce((acc, node) => {
|
|
26505
|
-
const found = graph.nodes[node.target];
|
|
26506
|
-
if (found)
|
|
26507
|
-
acc.push(found);
|
|
26508
|
-
return acc;
|
|
26509
|
-
}, []);
|
|
26510
|
-
for (const externalDep of externalDeps) {
|
|
26511
|
-
deps.set(externalDep.name, {
|
|
26512
|
-
name: externalDep.name,
|
|
26513
|
-
outputs: [],
|
|
26514
|
-
node: externalDep
|
|
26515
|
-
});
|
|
26516
|
-
}
|
|
26517
|
-
for (const internalDep of internalDeps) {
|
|
26518
|
-
recur(internalDep.name);
|
|
26519
|
-
}
|
|
26520
|
-
}
|
|
26521
|
-
return Array.from(deps.values());
|
|
26522
|
-
}
|
|
26523
|
-
exports.getExtraDependencies = getExtraDependencies2;
|
|
26524
|
-
}
|
|
26525
|
-
});
|
|
26526
|
-
|
|
26527
26487
|
// node_modules/.pnpm/@nx+js@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.9.0_nx@17.0.3_typescript@5.2.2_verdaccio@5.27.0/node_modules/@nx/js/package.json
|
|
26528
26488
|
var require_package2 = __commonJS({
|
|
26529
26489
|
"node_modules/.pnpm/@nx+js@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.9.0_nx@17.0.3_typescript@5.2.2_verdaccio@5.27.0/node_modules/@nx/js/package.json"(exports, module2) {
|
|
@@ -106597,7 +106557,11 @@ __export(workspace_tools_exports, {
|
|
|
106597
106557
|
eslintVersion: () => eslintVersion,
|
|
106598
106558
|
findCacheDirectory: () => findCacheDirectory,
|
|
106599
106559
|
findFileName: () => findFileName,
|
|
106560
|
+
getExternalDependencies: () => getExternalDependencies,
|
|
106561
|
+
getExtraDependencies: () => getExtraDependencies,
|
|
106600
106562
|
getFileBanner: () => getFileBanner,
|
|
106563
|
+
getInternalDependencies: () => getInternalDependencies,
|
|
106564
|
+
getProjectConfiguration: () => getProjectConfiguration,
|
|
106601
106565
|
getProjectConfigurations: () => getProjectConfigurations,
|
|
106602
106566
|
getWorkspaceRoot: () => getWorkspaceRoot2,
|
|
106603
106567
|
lintStagedVersion: () => lintStagedVersion,
|
|
@@ -110928,7 +110892,6 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
110928
110892
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
110929
110893
|
var import_esbuild_decorators = __toESM(require_src());
|
|
110930
110894
|
var import_devkit2 = __toESM(require_devkit());
|
|
110931
|
-
var import_get_extra_dependencies = __toESM(require_get_extra_dependencies());
|
|
110932
110895
|
var import_js = __toESM(require_src2());
|
|
110933
110896
|
var import_normalize_options = __toESM(require_normalize_options());
|
|
110934
110897
|
var import_tsc = __toESM(require_tsc_impl());
|
|
@@ -117172,6 +117135,67 @@ function findFileName(filePath) {
|
|
|
117172
117135
|
)?.pop() ?? "";
|
|
117173
117136
|
}
|
|
117174
117137
|
|
|
117138
|
+
// packages/workspace-tools/src/utils/get-project-configurations.ts
|
|
117139
|
+
var import_retrieve_workspace_files = require("nx/src/project-graph/utils/retrieve-workspace-files");
|
|
117140
|
+
var getProjectConfigurations = () => (0, import_retrieve_workspace_files.retrieveProjectConfigurationsWithoutPluginInference)(
|
|
117141
|
+
getWorkspaceRoot2()
|
|
117142
|
+
);
|
|
117143
|
+
var getProjectConfiguration = (projectName) => getProjectConfigurations()?.[projectName];
|
|
117144
|
+
|
|
117145
|
+
// packages/workspace-tools/src/utils/get-project-deps.ts
|
|
117146
|
+
function getExtraDependencies(projectName, graph) {
|
|
117147
|
+
const deps = /* @__PURE__ */ new Map();
|
|
117148
|
+
recur(projectName);
|
|
117149
|
+
function recur(currProjectName) {
|
|
117150
|
+
const allDeps = graph.dependencies[currProjectName];
|
|
117151
|
+
const externalDeps = allDeps.reduce((acc, node) => {
|
|
117152
|
+
const found = graph.externalNodes[node.target];
|
|
117153
|
+
if (found)
|
|
117154
|
+
acc.push(found);
|
|
117155
|
+
return acc;
|
|
117156
|
+
}, []);
|
|
117157
|
+
const internalDeps = allDeps.reduce((acc, node) => {
|
|
117158
|
+
const found = graph.nodes[node.target];
|
|
117159
|
+
if (found)
|
|
117160
|
+
acc.push(found);
|
|
117161
|
+
return acc;
|
|
117162
|
+
}, []);
|
|
117163
|
+
for (const externalDep of externalDeps) {
|
|
117164
|
+
deps.set(externalDep.name, {
|
|
117165
|
+
name: externalDep.name,
|
|
117166
|
+
outputs: [],
|
|
117167
|
+
node: externalDep
|
|
117168
|
+
});
|
|
117169
|
+
}
|
|
117170
|
+
for (const internalDep of internalDeps) {
|
|
117171
|
+
recur(internalDep.name);
|
|
117172
|
+
}
|
|
117173
|
+
}
|
|
117174
|
+
return Array.from(deps.values());
|
|
117175
|
+
}
|
|
117176
|
+
function getInternalDependencies(projectName, graph) {
|
|
117177
|
+
const allDeps = graph.dependencies[projectName];
|
|
117178
|
+
return Array.from(
|
|
117179
|
+
allDeps.reduce((acc, node) => {
|
|
117180
|
+
const found = graph.nodes[node.target];
|
|
117181
|
+
if (found)
|
|
117182
|
+
acc.push(found);
|
|
117183
|
+
return acc;
|
|
117184
|
+
}, [])
|
|
117185
|
+
);
|
|
117186
|
+
}
|
|
117187
|
+
function getExternalDependencies(projectName, graph) {
|
|
117188
|
+
const allDeps = graph.dependencies[projectName];
|
|
117189
|
+
return Array.from(
|
|
117190
|
+
allDeps.reduce((acc, node) => {
|
|
117191
|
+
const found = graph.externalNodes[node.target];
|
|
117192
|
+
if (found)
|
|
117193
|
+
acc.push(found);
|
|
117194
|
+
return acc;
|
|
117195
|
+
}, [])
|
|
117196
|
+
);
|
|
117197
|
+
}
|
|
117198
|
+
|
|
117175
117199
|
// packages/workspace-tools/src/executors/tsup/get-config.ts
|
|
117176
117200
|
var import_devkit = __toESM(require_devkit());
|
|
117177
117201
|
var import_tsup = __toESM(require_dist6());
|
|
@@ -117407,13 +117431,14 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
|
|
|
117407
117431
|
tsConfig,
|
|
117408
117432
|
additionalEntryPoints,
|
|
117409
117433
|
platform,
|
|
117434
|
+
emitOnAll = true,
|
|
117410
117435
|
...rest
|
|
117411
117436
|
}) {
|
|
117412
117437
|
const entryPoints = [];
|
|
117413
117438
|
if (rest.entry) {
|
|
117414
117439
|
entryPoints.push(rest.entry);
|
|
117415
117440
|
}
|
|
117416
|
-
if (
|
|
117441
|
+
if (emitOnAll !== false) {
|
|
117417
117442
|
entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
|
|
117418
117443
|
}
|
|
117419
117444
|
if (additionalEntryPoints) {
|
|
@@ -117425,7 +117450,7 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
|
|
|
117425
117450
|
let propertyKey = (0, import_devkit.joinPathFragments)(
|
|
117426
117451
|
filePath.path,
|
|
117427
117452
|
removeExtension(filePath.name)
|
|
117428
|
-
).replaceAll("\\", "/").replaceAll(workspaceRoot.substring(
|
|
117453
|
+
).replaceAll("\\", "/").replaceAll(workspaceRoot.substring(2).replaceAll("\\", "/"), "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
117429
117454
|
if (propertyKey) {
|
|
117430
117455
|
while (propertyKey.startsWith("/")) {
|
|
117431
117456
|
propertyKey = propertyKey.substring(1);
|
|
@@ -117547,28 +117572,6 @@ ${Object.keys(options).map(
|
|
|
117547
117572
|
options.external
|
|
117548
117573
|
);
|
|
117549
117574
|
}
|
|
117550
|
-
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
117551
|
-
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
117552
|
-
options.external = implicitDependencies.reduce(
|
|
117553
|
-
(ret, key) => {
|
|
117554
|
-
if (Object.keys(context.projectsConfigurations.projects[key]?.targets).length > 0) {
|
|
117555
|
-
const buildTargetName = Object.keys(
|
|
117556
|
-
context.projectsConfigurations.projects[key].targets
|
|
117557
|
-
).find((name) => name.toLowerCase() === "build");
|
|
117558
|
-
if (buildTargetName && context.projectsConfigurations.projects[key].targets[buildTargetName]?.options?.project) {
|
|
117559
|
-
const packageJson = (0, import_devkit2.readJsonFile)(
|
|
117560
|
-
context.projectsConfigurations.projects[key].targets[buildTargetName].options.project
|
|
117561
|
-
);
|
|
117562
|
-
if (packageJson?.name && !options.external.includes(packageJson.name)) {
|
|
117563
|
-
ret.push(packageJson.name);
|
|
117564
|
-
}
|
|
117565
|
-
}
|
|
117566
|
-
}
|
|
117567
|
-
return ret;
|
|
117568
|
-
},
|
|
117569
|
-
options.external
|
|
117570
|
-
);
|
|
117571
|
-
}
|
|
117572
117575
|
let externalDependencies = options.external.reduce((acc, name) => {
|
|
117573
117576
|
const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
|
|
117574
117577
|
if (externalNode) {
|
|
@@ -117580,19 +117583,28 @@ ${Object.keys(options).map(
|
|
|
117580
117583
|
}
|
|
117581
117584
|
return acc;
|
|
117582
117585
|
}, []);
|
|
117583
|
-
|
|
117584
|
-
|
|
117585
|
-
|
|
117586
|
-
|
|
117587
|
-
|
|
117588
|
-
|
|
117589
|
-
|
|
117590
|
-
|
|
117591
|
-
|
|
117592
|
-
|
|
117593
|
-
|
|
117586
|
+
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
117587
|
+
const internalDependencies = [];
|
|
117588
|
+
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
117589
|
+
options.external = implicitDependencies.reduce(
|
|
117590
|
+
(ret, key) => {
|
|
117591
|
+
const projectConfig = getProjectConfiguration(key);
|
|
117592
|
+
if (projectConfig.targets?.build) {
|
|
117593
|
+
const packageJson = (0, import_devkit2.readJsonFile)(
|
|
117594
|
+
projectConfig.targets?.build.options.project
|
|
117595
|
+
);
|
|
117596
|
+
if (packageJson?.name && !options.external.includes(packageJson.name)) {
|
|
117597
|
+
ret.push(packageJson.name);
|
|
117598
|
+
internalDependencies.push(packageJson.name);
|
|
117599
|
+
}
|
|
117600
|
+
}
|
|
117601
|
+
return ret;
|
|
117602
|
+
},
|
|
117603
|
+
options.external
|
|
117604
|
+
);
|
|
117605
|
+
}
|
|
117594
117606
|
if (options.bundle === false) {
|
|
117595
|
-
for (const thirdPartyDependency of (
|
|
117607
|
+
for (const thirdPartyDependency of getExternalDependencies(
|
|
117596
117608
|
context.projectName,
|
|
117597
117609
|
context.projectGraph
|
|
117598
117610
|
)) {
|
|
@@ -117604,7 +117616,7 @@ ${Object.keys(options).map(
|
|
|
117604
117616
|
}
|
|
117605
117617
|
}
|
|
117606
117618
|
console.log(`Building with the following dependencies marked as external:
|
|
117607
|
-
|
|
117619
|
+
${externalDependencies.map((dep) => {
|
|
117608
117620
|
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
117609
117621
|
}).join("\n")}`);
|
|
117610
117622
|
const prettierOptions = {
|
|
@@ -117628,7 +117640,7 @@ ${Object.keys(options).map(
|
|
|
117628
117640
|
delete packageJson.dependencies;
|
|
117629
117641
|
externalDependencies.forEach((entry) => {
|
|
117630
117642
|
const packageConfig = entry.node.data;
|
|
117631
|
-
if (packageConfig?.packageName &&
|
|
117643
|
+
if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry.node.name]?.type === "npm")) {
|
|
117632
117644
|
const { packageName, version } = packageConfig;
|
|
117633
117645
|
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117634
117646
|
return;
|
|
@@ -117637,6 +117649,10 @@ ${Object.keys(options).map(
|
|
|
117637
117649
|
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117638
117650
|
}
|
|
117639
117651
|
});
|
|
117652
|
+
internalDependencies.forEach((packageName) => {
|
|
117653
|
+
packageJson.dependencies ??= {};
|
|
117654
|
+
packageJson.dependencies[packageName] = "latest";
|
|
117655
|
+
});
|
|
117640
117656
|
packageJson.type = "module";
|
|
117641
117657
|
packageJson.exports ??= {
|
|
117642
117658
|
".": {
|
|
@@ -117888,7 +117904,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117888
117904
|
options.apiReport ??= true;
|
|
117889
117905
|
options.docModel ??= true;
|
|
117890
117906
|
options.tsdocMetadata ??= true;
|
|
117891
|
-
options.
|
|
117907
|
+
options.emitOnAll ??= true;
|
|
117892
117908
|
options.define ??= {};
|
|
117893
117909
|
options.env ??= {};
|
|
117894
117910
|
options.verbose ??= !!process.env.CI;
|
|
@@ -119005,12 +119021,6 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
119005
119021
|
return combined;
|
|
119006
119022
|
};
|
|
119007
119023
|
|
|
119008
|
-
// packages/workspace-tools/src/utils/get-project-configurations.ts
|
|
119009
|
-
var import_retrieve_workspace_files = require("nx/src/project-graph/utils/retrieve-workspace-files");
|
|
119010
|
-
var getProjectConfigurations = () => (0, import_retrieve_workspace_files.retrieveProjectConfigurationsWithoutPluginInference)(
|
|
119011
|
-
getWorkspaceRoot2()
|
|
119012
|
-
);
|
|
119013
|
-
|
|
119014
119024
|
// packages/workspace-tools/src/generators/config-schema/generator.ts
|
|
119015
119025
|
async function configSchemaGeneratorFn(tree, options) {
|
|
119016
119026
|
const projectConfigurations = getProjectConfigurations();
|
|
@@ -119857,7 +119867,11 @@ var WorkspaceStorage = class {
|
|
|
119857
119867
|
eslintVersion,
|
|
119858
119868
|
findCacheDirectory,
|
|
119859
119869
|
findFileName,
|
|
119870
|
+
getExternalDependencies,
|
|
119871
|
+
getExtraDependencies,
|
|
119860
119872
|
getFileBanner,
|
|
119873
|
+
getInternalDependencies,
|
|
119874
|
+
getProjectConfiguration,
|
|
119861
119875
|
getProjectConfigurations,
|
|
119862
119876
|
getWorkspaceRoot,
|
|
119863
119877
|
lintStagedVersion,
|