Skip to content

Commit 3165b16

Browse files
Refactor workspace pattern discovery and cache workspace info (#125)
* refactor workspace pattern parsing * fix workspace package.json * refactor workspace pattern discovery and caching * ci: apply automated fixes * changeset --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 08c22ce commit 3165b16

7 files changed

Lines changed: 374 additions & 185 deletions

File tree

.changeset/perky-vans-yell.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@tanstack/intent': patch
3+
---
4+
5+
Refactor workspace pattern discovery to use a JSONC parser for Deno configs, support additional workspace config shapes, and cache workspace roots, parsed patterns, and resolved package directories during CLI commands.
6+
7+
This also allows Deno workspace members with `deno.json` or `deno.jsonc` manifests to be resolved as workspace packages.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"tinyglobby": "^0.2.15",
6161
"typescript": "5.9.3",
6262
"vitest": "^4.0.17",
63-
"yaml": "^2.7.0"
63+
"yaml": "2.8.3"
6464
},
6565
"overrides": {},
6666
"dependencies": {

packages/intent/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
],
3333
"dependencies": {
3434
"cac": "^6.7.14",
35-
"yaml": "^2.7.0"
35+
"jsonc-parser": "^3.3.1",
36+
"yaml": "2.8.3"
3637
},
3738
"devDependencies": {
3839
"@verdaccio/node-api": "6.0.0-6-next.76",

packages/intent/src/cli-support.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,29 +149,32 @@ export async function resolveStaleTargets(
149149
}
150150
}
151151

152-
const { findPackagesWithSkills, findWorkspacePackages, findWorkspaceRoot } =
152+
const { findWorkspaceRoot, getWorkspaceInfo } =
153153
await import('./workspace-patterns.js')
154154
const workspaceRoot = findWorkspaceRoot(resolvedRoot)
155-
if (workspaceRoot) {
156-
const packageDirsWithSkills = findPackagesWithSkills(workspaceRoot)
157-
const allPackageDirs = findWorkspacePackages(workspaceRoot)
155+
const workspaceInfo = workspaceRoot ? getWorkspaceInfo(workspaceRoot) : null
156+
if (workspaceInfo) {
158157
const reports = await Promise.all(
159-
packageDirsWithSkills.map((packageDir) =>
160-
checkStaleness(packageDir, readPackageName(packageDir), workspaceRoot),
158+
workspaceInfo.packageDirsWithSkills.map((packageDir) =>
159+
checkStaleness(
160+
packageDir,
161+
readPackageName(packageDir),
162+
workspaceInfo.root,
163+
),
161164
),
162165
)
163166
const { readIntentArtifacts } = await import('./artifact-coverage.js')
164-
const artifacts = existsSync(join(workspaceRoot, '_artifacts'))
165-
? readIntentArtifacts(workspaceRoot)
167+
const artifacts = existsSync(join(workspaceInfo.root, '_artifacts'))
168+
? readIntentArtifacts(workspaceInfo.root)
166169
: null
167170
const coverageSignals = buildWorkspaceCoverageSignals({
168-
artifactRoot: workspaceRoot,
171+
artifactRoot: workspaceInfo.root,
169172
artifacts,
170-
packageDirs: allPackageDirs,
173+
packageDirs: workspaceInfo.packageDirs,
171174
})
172175
if (coverageSignals.length > 0) {
173176
reports.push({
174-
library: relative(process.cwd(), workspaceRoot) || 'workspace',
177+
library: relative(process.cwd(), workspaceInfo.root) || 'workspace',
175178
currentVersion: null,
176179
skillVersion: null,
177180
versionDrift: null,

0 commit comments

Comments
 (0)