nx 22.5.3 → 22.5.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/.eslintrc.json +3 -1
- package/migrations.json +6 -0
- package/package.json +12 -12
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -1
- package/src/ai/set-up-ai-agents/set-up-ai-agents.js +2 -0
- package/src/command-line/import/command-object.d.ts.map +1 -1
- package/src/command-line/import/command-object.js +1 -1
- package/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts +10 -0
- package/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts.map +1 -0
- package/src/command-line/release/utils/remote-release-clients/extract-repo-slug.js +61 -0
- package/src/command-line/release/utils/remote-release-clients/github.d.ts.map +1 -1
- package/src/command-line/release/utils/remote-release-clients/github.js +8 -13
- package/src/command-line/release/utils/remote-release-clients/gitlab.d.ts.map +1 -1
- package/src/command-line/release/utils/remote-release-clients/gitlab.js +4 -9
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts.map +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +13 -5
- package/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts +3 -0
- package/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts.map +1 -0
- package/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +14 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/nx-deps-cache.d.ts +10 -0
- package/src/project-graph/nx-deps-cache.d.ts.map +1 -1
- package/src/project-graph/nx-deps-cache.js +36 -0
- package/src/project-graph/project-graph.d.ts.map +1 -1
- package/src/project-graph/project-graph.js +23 -4
- package/src/project-graph/utils/project-configuration-utils.js +1 -1
- package/src/utils/ignore.d.ts +5 -0
- package/src/utils/ignore.d.ts.map +1 -1
- package/src/utils/ignore.js +16 -0
- package/src/utils/package-manager.d.ts.map +1 -1
- package/src/utils/package-manager.js +22 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-graph-incremental-recomputation.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"project-graph-incremental-recomputation.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,YAAY,EAKb,MAAM,mCAAmC,CAAC;AAe3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAEL,uBAAuB,EACxB,MAAM,uDAAuD,CAAC;AAS/D,UAAU,sBAAsB;IAC9B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,mBAAmB,EAAE,YAAY,GAAG,IAAI,CAAC;IACzC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,iBAAiB,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACrC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC3C,cAAc,EAAE,yBAAyB,GAAG,IAAI,CAAC;CAClD;AAGD,eAAO,IAAI,gBAAgB,EACvB;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IAC9B,cAAc,EAAE,yBAAyB,CAAC;CAC3C,GACD,SAAS,CAAC;AACd,eAAO,IAAI,0BAA0B,EAAE,YAAY,GAAG,SAAS,CAAC;AAChE,eAAO,IAAI,mBAAmB,EAAE,YAAY,GAAG,SAAS,CAAC;AAoBzD,wBAAsB,sCAAsC,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAyF9F;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,MAAM,EAAE,EACtB,YAAY,EAAE,MAAM,EAAE,QAiDvB;AAED,wBAAgB,yCAAyC,CACvD,QAAQ,EAAE,CACR,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,uBAAuB,EACnC,KAAK,EAAE,KAAK,GAAG,IAAI,KAChB,IAAI,QAGV"}
|
|
@@ -45,6 +45,7 @@ async function getCachedSerializedProjectGraphPromise() {
|
|
|
45
45
|
waitPeriod = 100;
|
|
46
46
|
await resetInternalStateIfNxDepsMissing();
|
|
47
47
|
const plugins = await (0, get_plugins_1.getPlugins)();
|
|
48
|
+
const previousPromise = cachedSerializedProjectGraphPromise;
|
|
48
49
|
if (collectedUpdatedFiles.size == 0 && collectedDeletedFiles.size == 0) {
|
|
49
50
|
if (!cachedSerializedProjectGraphPromise) {
|
|
50
51
|
cachedSerializedProjectGraphPromise =
|
|
@@ -60,6 +61,7 @@ async function getCachedSerializedProjectGraphPromise() {
|
|
|
60
61
|
cachedSerializedProjectGraphPromise =
|
|
61
62
|
processFilesAndCreateAndSerializeProjectGraph(plugins);
|
|
62
63
|
}
|
|
64
|
+
const graphWasRecomputed = cachedSerializedProjectGraphPromise !== previousPromise;
|
|
63
65
|
const result = await cachedSerializedProjectGraphPromise;
|
|
64
66
|
if (wasScheduled) {
|
|
65
67
|
notifyProjectGraphRecomputationListeners(result.projectGraph, result.sourceMaps, result.error);
|
|
@@ -69,14 +71,20 @@ async function getCachedSerializedProjectGraphPromise() {
|
|
|
69
71
|
? result.error.errors
|
|
70
72
|
: [result.error]
|
|
71
73
|
: [];
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
74
|
+
// Write the daemon's current graph to disk to ensure disk cache stays
|
|
75
|
+
// in sync with the daemon's in-memory cache. This prevents issues where
|
|
76
|
+
// a non-daemon process writes a stale/errored cache that never gets
|
|
77
|
+
// overwritten by the daemon's valid graph.
|
|
78
|
+
//
|
|
79
|
+
// When the graph was just recomputed, always write so the new graph is
|
|
80
|
+
// persisted. When serving the same graph from memory, use
|
|
81
|
+
// writeCacheIfStale to skip the write unless an external process has
|
|
82
|
+
// modified the file since this process last wrote it.
|
|
76
83
|
if (result.projectGraph &&
|
|
77
84
|
result.projectFileMapCache &&
|
|
78
85
|
result.sourceMaps) {
|
|
79
|
-
|
|
86
|
+
const writeFn = graphWasRecomputed ? nx_deps_cache_1.writeCache : nx_deps_cache_1.writeCacheIfStale;
|
|
87
|
+
writeFn(result.projectFileMapCache, result.projectGraph, result.sourceMaps, errors);
|
|
80
88
|
}
|
|
81
89
|
return result;
|
|
82
90
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-polygraph-to-git-ignore.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,IAAI,EAAE,IAAI,QASzD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = addPolygraphToGitIgnore;
|
|
4
|
+
const ignore_1 = require("../../utils/ignore");
|
|
5
|
+
function addPolygraphToGitIgnore(tree) {
|
|
6
|
+
if (!tree.exists('.gitignore')) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
// Lerna users that don't use nx.json may not expect .nx directory changes
|
|
10
|
+
if (tree.exists('lerna.json') && !tree.exists('nx.json')) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
(0, ignore_1.addEntryToGitIgnore)(tree, '.gitignore', '.nx/polygraph');
|
|
14
|
+
}
|
|
Binary file
|
|
@@ -27,6 +27,16 @@ export declare function createProjectFileMapCache(nxJson: NxJsonConfiguration<'*
|
|
|
27
27
|
};
|
|
28
28
|
}, externalNodesHash: string): FileMapCache;
|
|
29
29
|
export declare function writeCache(cache: FileMapCache, projectGraph: ProjectGraph, sourceMaps: ConfigurationSourceMaps, errors: ProjectGraphErrorTypes[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Writes the cache only if the on-disk cache file has been modified since
|
|
32
|
+
* this process last wrote it (i.e. an external process overwrote it), or
|
|
33
|
+
* if this process has never written the cache.
|
|
34
|
+
*
|
|
35
|
+
* Use this instead of writeCache() on hot paths where the same graph may
|
|
36
|
+
* be served multiple times without changing (e.g. the daemon responding
|
|
37
|
+
* to repeated client requests).
|
|
38
|
+
*/
|
|
39
|
+
export declare function writeCacheIfStale(cache: FileMapCache, projectGraph: ProjectGraph, sourceMaps: ConfigurationSourceMaps, errors: ProjectGraphErrorTypes[]): void;
|
|
30
40
|
export declare function shouldRecomputeWholeGraph(cache: FileMapCache, packageJsonDeps: Record<string, string>, projects: Record<string, ProjectConfiguration>, nxJson: NxJsonConfiguration, tsConfig: {
|
|
31
41
|
compilerOptions: {
|
|
32
42
|
paths: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-deps-cache.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/project-graph/nx-deps-cache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EACV,QAAQ,EACR,OAAO,EAEP,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAS7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAEL,sBAAsB,EAEvB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.createProjectFileMapCache = createProjectFileMapCache;
|
|
9
9
|
exports.writeCache = writeCache;
|
|
10
|
+
exports.writeCacheIfStale = writeCacheIfStale;
|
|
10
11
|
exports.shouldRecomputeWholeGraph = shouldRecomputeWholeGraph;
|
|
11
12
|
exports.extractCachedFileData = extractCachedFileData;
|
|
12
13
|
const node_fs_1 = require("node:fs");
|
|
@@ -132,6 +133,12 @@ function createProjectFileMapCache(nxJson, packageJsonDeps, fileMap, tsConfig, e
|
|
|
132
133
|
};
|
|
133
134
|
return newValue;
|
|
134
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Tracks the mtime of the project graph cache file after the last successful
|
|
138
|
+
* writeCache() call. Used by writeCacheIfStale() to skip redundant writes
|
|
139
|
+
* when no external process has modified the cache file since the last write.
|
|
140
|
+
*/
|
|
141
|
+
let lastWrittenCacheMtimeMs;
|
|
135
142
|
function writeCache(cache, projectGraph, sourceMaps, errors) {
|
|
136
143
|
perf_hooks_1.performance.mark('write cache:start');
|
|
137
144
|
let retry = 1;
|
|
@@ -165,6 +172,12 @@ function writeCache(cache, projectGraph, sourceMaps, errors) {
|
|
|
165
172
|
if ((0, is_on_daemon_1.isOnDaemon)()) {
|
|
166
173
|
logger_1.serverLogger.log(`Wrote project graph cache to ${exports.nxProjectGraph}${errors.length > 0 ? ' with errors' : ''}`);
|
|
167
174
|
}
|
|
175
|
+
try {
|
|
176
|
+
lastWrittenCacheMtimeMs = (0, node_fs_1.statSync)(exports.nxProjectGraph).mtimeMs;
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
lastWrittenCacheMtimeMs = undefined;
|
|
180
|
+
}
|
|
168
181
|
done = true;
|
|
169
182
|
}
|
|
170
183
|
catch (err) {
|
|
@@ -183,6 +196,29 @@ function writeCache(cache, projectGraph, sourceMaps, errors) {
|
|
|
183
196
|
perf_hooks_1.performance.mark('write cache:end');
|
|
184
197
|
perf_hooks_1.performance.measure('write cache', 'write cache:start', 'write cache:end');
|
|
185
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Writes the cache only if the on-disk cache file has been modified since
|
|
201
|
+
* this process last wrote it (i.e. an external process overwrote it), or
|
|
202
|
+
* if this process has never written the cache.
|
|
203
|
+
*
|
|
204
|
+
* Use this instead of writeCache() on hot paths where the same graph may
|
|
205
|
+
* be served multiple times without changing (e.g. the daemon responding
|
|
206
|
+
* to repeated client requests).
|
|
207
|
+
*/
|
|
208
|
+
function writeCacheIfStale(cache, projectGraph, sourceMaps, errors) {
|
|
209
|
+
if (lastWrittenCacheMtimeMs !== undefined) {
|
|
210
|
+
try {
|
|
211
|
+
const currentMtimeMs = (0, node_fs_1.statSync)(exports.nxProjectGraph).mtimeMs;
|
|
212
|
+
if (currentMtimeMs === lastWrittenCacheMtimeMs) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// File doesn't exist or can't be stat'd — proceed with write
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
writeCache(cache, projectGraph, sourceMaps, errors);
|
|
221
|
+
}
|
|
186
222
|
function shouldRecomputeWholeGraph(cache, packageJsonDeps, projects, nxJson, tsConfig, externalNodesHash) {
|
|
187
223
|
if (cache.version !== '6.0') {
|
|
188
224
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-graph.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/project-graph/project-graph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAqC/C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,CAAC,EAAE,MAAM,GACzB,YAAY,CAuBd;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,MAAM,GAClB,oBAAoB,CAQtB;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CACvD,YAAY,EAAE,YAAY,GACzB,sBAAsB,CAUxB;AAED,wBAAsB,2CAA2C;;;GAiFhE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,KAAA,QA8BxE;AAgBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,GAAE;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAGxD,GACA,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED,wBAAsB,oCAAoC,CACxD,IAAI,GAAE;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAGxD;;;GAmIF;AAED,wBAAgB,mCAAmC,
|
|
1
|
+
{"version":3,"file":"project-graph.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/project-graph/project-graph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAqC/C;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,CAAC,EAAE,MAAM,GACzB,YAAY,CAuBd;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,MAAM,GAClB,oBAAoB,CAQtB;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CACvD,YAAY,EAAE,YAAY,GACzB,sBAAsB,CAUxB;AAED,wBAAsB,2CAA2C;;;GAiFhE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,KAAA,QA8BxE;AAgBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,GAAE;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAGxD,GACA,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED,wBAAsB,oCAAoC,CACxD,IAAI,GAAE;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAGxD;;;GAmIF;AAED,wBAAgB,mCAAmC,SAoDlD"}
|
|
@@ -329,10 +329,29 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
function preventRecursionInGraphConstruction() {
|
|
332
|
-
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
const
|
|
332
|
+
const allFrames = (0, call_sites_1.getCallSites)();
|
|
333
|
+
// Find the first occurrence of buildProjectGraphAndSourceMapsWithoutDaemon in the call stack.
|
|
334
|
+
// This represents the current invocation and should be skipped for the recursion check.
|
|
335
|
+
const firstOccurrenceIndex = allFrames.findIndex((f) => f.getFunctionName() === buildProjectGraphAndSourceMapsWithoutDaemon.name);
|
|
336
|
+
let stackframes;
|
|
337
|
+
if (firstOccurrenceIndex !== -1) {
|
|
338
|
+
// Skip the current invocation frame and any consecutive frames with the same function name.
|
|
339
|
+
// Some runtimes (e.g. Bun) include extra async frames for the same call, which would
|
|
340
|
+
// otherwise cause a false positive loop detection.
|
|
341
|
+
let startIndex = firstOccurrenceIndex + 1;
|
|
342
|
+
while (startIndex < allFrames.length &&
|
|
343
|
+
allFrames[startIndex].getFunctionName() ===
|
|
344
|
+
buildProjectGraphAndSourceMapsWithoutDaemon.name) {
|
|
345
|
+
startIndex++;
|
|
346
|
+
}
|
|
347
|
+
stackframes = allFrames.slice(startIndex);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
// If buildProjectGraphAndSourceMapsWithoutDaemon is not in the stack (e.g., when called
|
|
351
|
+
// from daemon client), fall back to the original slice(2) behavior.
|
|
352
|
+
// preventRecursionInGraphConstruction -> callee -> ...
|
|
353
|
+
stackframes = allFrames.slice(2);
|
|
354
|
+
}
|
|
336
355
|
if (stackframes.some((f) => {
|
|
337
356
|
const functionName = f.getFunctionName();
|
|
338
357
|
const fileName = f.getFileName() || '';
|
|
@@ -614,7 +614,7 @@ function targetDefaultShouldBeApplied(key, sourceMap) {
|
|
|
614
614
|
return !plugin?.startsWith('nx/');
|
|
615
615
|
}
|
|
616
616
|
function deepClone(obj) {
|
|
617
|
-
return
|
|
617
|
+
return structuredClone(obj);
|
|
618
618
|
}
|
|
619
619
|
function mergeTargetDefaultWithTargetDefinition(targetName, project, targetDefault, sourceMap) {
|
|
620
620
|
const targetDefinition = project.targets[targetName] ?? {};
|
package/src/utils/ignore.d.ts
CHANGED
|
@@ -2,4 +2,9 @@ import ignore = require('ignore');
|
|
|
2
2
|
import { Tree } from '../generators/tree';
|
|
3
3
|
export declare function getIgnoreObject(root?: string): ReturnType<typeof ignore>;
|
|
4
4
|
export declare function getIgnoreObjectForTree(tree: Tree): ignore.Ignore;
|
|
5
|
+
/**
|
|
6
|
+
* Adds an entry to a .gitignore file if it's not already covered by existing patterns.
|
|
7
|
+
* Creates the file if it doesn't exist.
|
|
8
|
+
*/
|
|
9
|
+
export declare function addEntryToGitIgnore(tree: Tree, gitignorePath: string, entry: string): void;
|
|
5
10
|
//# sourceMappingURL=ignore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/ignore.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,GAAG,QAAQ,QAAQ,CAAC,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,wBAAgB,eAAe,CAC7B,IAAI,GAAE,MAAsB,GAC3B,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,iBAahD"}
|
|
1
|
+
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/ignore.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,GAAG,QAAQ,QAAQ,CAAC,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,wBAAgB,eAAe,CAC7B,IAAI,GAAE,MAAsB,GAC3B,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,iBAahD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,QAWd"}
|
package/src/utils/ignore.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIgnoreObject = getIgnoreObject;
|
|
4
4
|
exports.getIgnoreObjectForTree = getIgnoreObjectForTree;
|
|
5
|
+
exports.addEntryToGitIgnore = addEntryToGitIgnore;
|
|
5
6
|
const ignore = require("ignore");
|
|
6
7
|
const fileutils_1 = require("./fileutils");
|
|
7
8
|
const workspace_root_1 = require("./workspace-root");
|
|
@@ -24,3 +25,18 @@ function getIgnoreObjectForTree(tree) {
|
|
|
24
25
|
}
|
|
25
26
|
return ig;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Adds an entry to a .gitignore file if it's not already covered by existing patterns.
|
|
30
|
+
* Creates the file if it doesn't exist.
|
|
31
|
+
*/
|
|
32
|
+
function addEntryToGitIgnore(tree, gitignorePath, entry) {
|
|
33
|
+
const gitignore = tree.exists(gitignorePath)
|
|
34
|
+
? tree.read(gitignorePath, 'utf-8')
|
|
35
|
+
: '';
|
|
36
|
+
const ig = ignore();
|
|
37
|
+
ig.add(gitignore);
|
|
38
|
+
if (!ig.ignores(entry)) {
|
|
39
|
+
const updatedLines = gitignore.length ? [gitignore, entry] : [entry];
|
|
40
|
+
tree.write(gitignorePath, updatedLines.join('\n'));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,MAAM,KACR,MAAM,CAAC;IAEZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAW,GAAG,cAAc,CAYrE;
|
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,E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.yaml'))
|
|
46
46
|
? 'pnpm'
|
|
47
|
-
:
|
|
47
|
+
: detectInvokedPackageManager()));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Detects which package manager was used to invoke the current command
|
|
51
|
+
* based on the npm_config_user_agent environment variable.
|
|
52
|
+
*
|
|
53
|
+
* Falls back to 'npm' if detection fails.
|
|
54
|
+
*/
|
|
55
|
+
function detectInvokedPackageManager() {
|
|
56
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
57
|
+
if (userAgent) {
|
|
58
|
+
if (userAgent.startsWith('pnpm/')) {
|
|
59
|
+
return 'pnpm';
|
|
60
|
+
}
|
|
61
|
+
if (userAgent.startsWith('yarn/')) {
|
|
62
|
+
return 'yarn';
|
|
63
|
+
}
|
|
64
|
+
if (userAgent.startsWith('bun/')) {
|
|
65
|
+
return 'bun';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return 'npm';
|
|
48
69
|
}
|
|
49
70
|
/**
|
|
50
71
|
* Returns true if the workspace is using npm workspaces, yarn workspaces, or pnpm workspaces.
|