@vzn/vx-migrate 0.0.651 → 0.0.653
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/README.md +61 -52
- package/package.json +2 -2
- package/src/migrate-scripts.ts +13 -7
- package/src/migrate-turbo.ts +8 -1
- package/src/migrate.ts +102 -18
- package/src/nx/index.ts +61 -11
- package/src/nx/nx-inputs.ts +48 -24
- package/src/nx/nx-map.ts +204 -20
- package/src/nx/nx-outputs.ts +6 -1
- package/src/nx/nx-upstream.ts +11 -11
- package/src/nx-cache/index.ts +42 -28
- package/src/packages.ts +51 -1
- package/src/remote-refusal.ts +49 -4
- package/src/shared-outputs.ts +86 -25
- package/src/tracked-outputs.ts +59 -20
- package/src/turbo/index.ts +2 -1
- package/src/turbo/turbo-map.ts +165 -29
- package/src/turbo-cache/index.ts +71 -40
- package/src/turbo-cache/oidc.ts +15 -7
- package/src/vite-task/vite-task-map.ts +3 -2
- package/src/workspace-notes.ts +19 -8
- package/src/workspace-plugins.ts +11 -3
package/src/workspace-notes.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// What the written configs leave to .vx/workspace.ts, said once by both
|
|
2
2
|
// migrators: the adoption plugin `vx init` declared still reads the old
|
|
3
3
|
// tool's file every run, and the old tool keyed each package on its own
|
|
4
|
-
// lockfile entries where core keys
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// lockfile entries where core keys no lockfile (#3562): without a
|
|
5
|
+
// lockfile plugin a dependency bump re-runs nothing, and a cached task
|
|
6
|
+
// replays output built on the old versions.
|
|
7
7
|
|
|
8
8
|
import { existsSync } from 'node:fs'
|
|
9
9
|
import path from 'node:path'
|
|
10
|
+
import type { PackageManager } from './adopt.js'
|
|
10
11
|
|
|
11
12
|
/** Each lockfile and the `@vzn/vx-lockfile` plugin that claims it. */
|
|
12
13
|
const LOCKFILES: ReadonlyArray<readonly [file: string, plugin: string]> = [
|
|
@@ -18,9 +19,18 @@ const LOCKFILES: ReadonlyArray<readonly [file: string, plugin: string]> = [
|
|
|
18
19
|
['yarn.lock', 'yarn'],
|
|
19
20
|
]
|
|
20
21
|
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The lockfile at `root` and the `@vzn/vx-lockfile` factory that claims it.
|
|
24
|
+
* With none there, `installer`'s: the manager this run installs with
|
|
25
|
+
* writes it, and the lock that follows needs its plugin for `^` edges.
|
|
26
|
+
*/
|
|
27
|
+
export function lockfilePlugin(
|
|
28
|
+
root: string,
|
|
29
|
+
installer?: PackageManager,
|
|
30
|
+
): { file: string; factory: string } | undefined {
|
|
31
|
+
const lock =
|
|
32
|
+
LOCKFILES.find(([file]) => existsSync(path.join(root, file))) ??
|
|
33
|
+
LOCKFILES.find(([, factory]) => factory === installer)
|
|
24
34
|
return lock === undefined ? undefined : { file: lock[0], factory: lock[1] }
|
|
25
35
|
}
|
|
26
36
|
|
|
@@ -58,8 +68,9 @@ export async function adoptedToolNotes(root: string, tool: AdoptedTool): Promise
|
|
|
58
68
|
const lock = lockfilePlugin(root)
|
|
59
69
|
if (lock !== undefined && !new RegExp(`\\b${lock.factory}\\s*\\(`).test(declared))
|
|
60
70
|
notes.push(
|
|
61
|
-
`${tool.keys(lock.file)}; vx keys
|
|
62
|
-
|
|
71
|
+
`${tool.keys(lock.file)}; vx keys no lockfile by itself, so a dependency bump re-runs ` +
|
|
72
|
+
'nothing and a cached task replays output built on the old versions. ' +
|
|
73
|
+
`Declare ${lock.factory}() from @vzn/vx-lockfile ` +
|
|
63
74
|
"in .vx/workspace.ts to key each task on its package's dependency closure",
|
|
64
75
|
)
|
|
65
76
|
return notes
|
package/src/workspace-plugins.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { existsSync } from 'node:fs'
|
|
8
8
|
import path from 'node:path'
|
|
9
|
+
import type { PackageManager } from './adopt.js'
|
|
9
10
|
import { REMOTE_CACHE, remoteCacheSignal } from './remote-cache.js'
|
|
10
11
|
import { lockfilePlugin } from './workspace-notes.js'
|
|
11
12
|
|
|
@@ -16,12 +17,19 @@ export interface WorkspacePlugin {
|
|
|
16
17
|
readonly factory: string
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* `runner`: the Turbo or Nx repo's own remote cache, where the repo shows
|
|
22
|
+
* one. `installer`: the manager this run installs with (`lockfilePlugin`).
|
|
23
|
+
*/
|
|
24
|
+
export function workspacePlugins(
|
|
25
|
+
root: string,
|
|
26
|
+
runner?: 'turbo' | 'nx',
|
|
27
|
+
installer?: PackageManager,
|
|
28
|
+
): WorkspacePlugin[] {
|
|
21
29
|
const out: WorkspacePlugin[] = []
|
|
22
30
|
if (runner !== undefined && remoteCacheSignal(root, runner) !== undefined)
|
|
23
31
|
out.push({ pkg: '@vzn/vx-migrate', factory: REMOTE_CACHE[runner] })
|
|
24
|
-
const lock = lockfilePlugin(root)
|
|
32
|
+
const lock = lockfilePlugin(root, installer)
|
|
25
33
|
if (lock !== undefined) out.push({ pkg: '@vzn/vx-lockfile', factory: lock.factory })
|
|
26
34
|
out.push({ pkg: '@vzn/vx-history', factory: 'vxHistory' })
|
|
27
35
|
if (existsSync(path.join(root, '.github', 'workflows')))
|