nx 23.0.0-beta.7 → 23.0.0-beta.9

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/bin/nx.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
+ import '../src/utils/enable-compile-cache';
2
3
  import '../src/utils/perf-logging';
package/dist/bin/nx.js CHANGED
@@ -8,6 +8,8 @@ if (process.env.FORCE_COLOR === '0') {
8
8
  process.env.NO_COLOR = '1';
9
9
  delete process.env.FORCE_COLOR;
10
10
  }
11
+ // Must be the first import — see enable-compile-cache.ts.
12
+ require("../src/utils/enable-compile-cache");
11
13
  const find_workspace_root_1 = require("../src/utils/find-workspace-root");
12
14
  const pc = tslib_1.__importStar(require("picocolors"));
13
15
  const output_1 = require("../src/utils/output");
@@ -125,14 +125,31 @@ function cleanupOldCaches(currentCommitHash) {
125
125
  function getAiConfigRepoPath() {
126
126
  // 1. Get latest commit hash (first 10 chars)
127
127
  const commitHash = getLatestCommitHash();
128
- // 2. Check if cached version exists
128
+ // 2. Reuse cached version if it still has content (macOS may have
129
+ // swept its files but left the directory tree).
129
130
  const cachedPath = (0, path_1.join)(CACHE_DIR, commitHash);
130
- if ((0, fs_1.existsSync)(cachedPath)) {
131
+ if (hasRootFile(cachedPath)) {
131
132
  return cachedPath;
132
133
  }
133
- // 3. Clone fresh
134
+ // 3. Wipe any empty skeleton, then clone fresh
135
+ if ((0, fs_1.existsSync)(cachedPath)) {
136
+ (0, fs_1.rmSync)(cachedPath, { recursive: true, force: true });
137
+ }
134
138
  cloneRepo(cachedPath);
135
139
  // 4. Clean up old cached versions
136
140
  cleanupOldCaches(commitHash);
137
141
  return cachedPath;
138
142
  }
143
+ /**
144
+ * The repo always has at least one regular file at its root (e.g. README).
145
+ * If everything at the root is a directory, the cache was swept by macOS
146
+ * tmp cleanup and we should re-clone.
147
+ */
148
+ function hasRootFile(dir) {
149
+ try {
150
+ return (0, fs_1.readdirSync)(dir, { withFileTypes: true }).some((e) => e.isFile());
151
+ }
152
+ catch {
153
+ return false;
154
+ }
155
+ }
@@ -0,0 +1,2 @@
1
+ /** @deprecated Compat shim for `@nx/js@21`. */
2
+ export declare function shouldUseLegacyVersioning(releaseConfig: any): boolean;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldUseLegacyVersioning = shouldUseLegacyVersioning;
4
+ // TODO(v23): remove — kept only so `@nx/js@21`'s library generator can load via `ensurePackage`.
5
+ /** @deprecated Compat shim for `@nx/js@21`. */
6
+ function shouldUseLegacyVersioning(releaseConfig) {
7
+ return releaseConfig?.version?.useLegacyVersioning ?? false;
8
+ }