@nx/js 18.0.0-beta.2 → 18.0.0-beta.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "18.0.0-beta.
|
|
3
|
+
"version": "18.0.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "^7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "18.0.0-beta.
|
|
61
|
-
"@nx/workspace": "18.0.0-beta.
|
|
62
|
-
"@nrwl/js": "18.0.0-beta.
|
|
60
|
+
"@nx/devkit": "18.0.0-beta.3",
|
|
61
|
+
"@nx/workspace": "18.0.0-beta.3",
|
|
62
|
+
"@nrwl/js": "18.0.0-beta.3"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ProjectFileMap, type ProjectGraph, type ProjectGraphProjectNode } from '@nx/devkit';
|
|
2
2
|
/**
|
|
3
3
|
* Finds all npm dependencies and their expected versions for a given project.
|
|
4
4
|
*/
|
|
5
5
|
export declare function findNpmDependencies(workspaceRoot: string, sourceProject: ProjectGraphProjectNode, projectGraph: ProjectGraph, projectFileMap: ProjectFileMap, buildTarget: string, options?: {
|
|
6
6
|
includeTransitiveDependencies?: boolean;
|
|
7
7
|
ignoredFiles?: string[];
|
|
8
|
+
useLocalPathsForWorkspaceDependencies?: boolean;
|
|
8
9
|
}): Record<string, string>;
|
|
@@ -21,7 +21,7 @@ function findNpmDependencies(workspaceRoot, sourceProject, projectGraph, project
|
|
|
21
21
|
if (seen?.has(currentProject.name))
|
|
22
22
|
return;
|
|
23
23
|
seen?.add(currentProject.name);
|
|
24
|
-
collectDependenciesFromFileMap(workspaceRoot, currentProject, projectGraph, projectFileMap, buildTarget, options.ignoredFiles, collectedDeps);
|
|
24
|
+
collectDependenciesFromFileMap(workspaceRoot, currentProject, projectGraph, projectFileMap, buildTarget, options.ignoredFiles, options.useLocalPathsForWorkspaceDependencies, collectedDeps);
|
|
25
25
|
collectHelperDependencies(workspaceRoot, currentProject, projectGraph, buildTarget, collectedDeps);
|
|
26
26
|
if (options.includeTransitiveDependencies) {
|
|
27
27
|
const projectDeps = projectGraph.dependencies[currentProject.name];
|
|
@@ -38,7 +38,7 @@ function findNpmDependencies(workspaceRoot, sourceProject, projectGraph, project
|
|
|
38
38
|
exports.findNpmDependencies = findNpmDependencies;
|
|
39
39
|
// Keep track of workspace libs we already read package.json for so we don't read from disk again.
|
|
40
40
|
const seenWorkspaceDeps = {};
|
|
41
|
-
function collectDependenciesFromFileMap(workspaceRoot, sourceProject, projectGraph, projectFileMap, buildTarget, ignoredFiles, npmDeps) {
|
|
41
|
+
function collectDependenciesFromFileMap(workspaceRoot, sourceProject, projectGraph, projectFileMap, buildTarget, ignoredFiles, useLocalPathsForWorkspaceDependencies, npmDeps) {
|
|
42
42
|
const rawFiles = projectFileMap[sourceProject.name];
|
|
43
43
|
if (!rawFiles)
|
|
44
44
|
return;
|
|
@@ -82,12 +82,27 @@ function collectDependenciesFromFileMap(workspaceRoot, sourceProject, projectGra
|
|
|
82
82
|
workspaceDep.data.targets[buildTarget] &&
|
|
83
83
|
// Make sure package.json exists and has a valid name.
|
|
84
84
|
packageJson?.name) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
let version;
|
|
86
|
+
if (useLocalPathsForWorkspaceDependencies) {
|
|
87
|
+
// Find the relative `file:...` path and use that as the version value.
|
|
88
|
+
// This is useful for monorepos like Nx where the release will handle setting the correct version in dist.
|
|
89
|
+
const depRoot = (0, path_1.join)(workspaceRoot, workspaceDep.data.root);
|
|
90
|
+
const ownRoot = (0, path_1.join)(workspaceRoot, sourceProject.data.root);
|
|
91
|
+
const relativePath = (0, path_1.relative)(ownRoot, depRoot);
|
|
92
|
+
const filePath = (0, devkit_1.normalizePath)(relativePath); // normalize slashes for windows
|
|
93
|
+
version = `file:${filePath}`;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Otherwise, read the version from the dependencies `package.json` file.
|
|
97
|
+
// This is useful for monorepos that commit release versions.
|
|
98
|
+
// Users can also set version as "*" in source `package.json` files, which will be the value set here.
|
|
99
|
+
// This is useful if they use custom scripts to update them in dist.
|
|
100
|
+
version = packageJson.version ?? '*'; // fallback in case version is missing
|
|
101
|
+
}
|
|
102
|
+
npmDeps[packageJson.name] = version;
|
|
88
103
|
seenWorkspaceDeps[workspaceDep.name] = {
|
|
89
104
|
name: packageJson.name,
|
|
90
|
-
version
|
|
105
|
+
version,
|
|
91
106
|
};
|
|
92
107
|
}
|
|
93
108
|
}
|