Skip to content

Commit b175dad

Browse files
committed
Published using @Stream44 Studio
Signed-off-by: Christoph <christoph@christoph.diy>
1 parent 0b6a511 commit b175dad

3 files changed

Lines changed: 62 additions & 12 deletions

File tree

caps/patterns/semver.org/ProjectPublishing.ts

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
import { join } from 'path'
3-
import { readFile, writeFile } from 'fs/promises'
2+
import { join, dirname } from 'path'
3+
import { readFile, writeFile, access } from 'fs/promises'
44
import glob from 'fast-glob'
55
import chalk from 'chalk'
66

@@ -135,6 +135,31 @@ export async function capsule({
135135
}
136136
}
137137
}
138+
139+
// Clean up tsconfig.json extends paths that don't resolve in the published package
140+
console.log('[t44] Cleaning up tsconfig.json extends paths ...\n')
141+
for (const [repoName, repoSourceDir] of Object.entries(repos)) {
142+
await cleanupTsconfigExtends(join(repoSourceDir as string, 'tsconfig.json'))
143+
144+
// Follow workspaces to find sub-workspace tsconfig.json files
145+
const pkgPath = join(repoSourceDir as string, 'package.json')
146+
try {
147+
const pkgContent = await readFile(pkgPath, 'utf-8')
148+
const pkg = JSON.parse(pkgContent)
149+
const workspaces: string[] = pkg.workspaces || []
150+
if (workspaces.length > 0) {
151+
const tsconfigPatterns = workspaces.map(ws => join(ws, 'tsconfig.json'))
152+
const tsconfigPaths = await glob(tsconfigPatterns, {
153+
cwd: repoSourceDir as string,
154+
absolute: true,
155+
onlyFiles: true,
156+
})
157+
for (const tsconfigPath of tsconfigPaths) {
158+
await cleanupTsconfigExtends(tsconfigPath)
159+
}
160+
}
161+
} catch { }
162+
}
138163
}
139164
}
140165
},
@@ -337,3 +362,29 @@ async function updateWorkspaceDependencies(
337362
}
338363
}
339364
}
365+
366+
async function cleanupTsconfigExtends(tsconfigPath: string): Promise<void> {
367+
try {
368+
const content = await readFile(tsconfigPath, 'utf-8')
369+
const tsconfig = JSON.parse(content)
370+
371+
if (!tsconfig.extends) return
372+
373+
// Resolve the extends path relative to the tsconfig.json directory
374+
const tsconfigDir = dirname(tsconfigPath)
375+
const extendsPath = join(tsconfigDir, tsconfig.extends)
376+
377+
try {
378+
await access(extendsPath)
379+
// Path exists — keep it
380+
} catch {
381+
// Path does not exist — remove the extends field
382+
delete tsconfig.extends
383+
const indent = detectIndent(content)
384+
await writeFile(tsconfigPath, JSON.stringify(tsconfig, null, indent) + '\n', 'utf-8')
385+
console.log(chalk.green(` ✓ Removed invalid extends from ${tsconfigPath}\n`))
386+
}
387+
} catch {
388+
// tsconfig.json doesn't exist or isn't valid JSON — skip
389+
}
390+
}

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "t44",
3-
"version": "0.4.0-rc.21",
3+
"version": "0.4.0-rc.22",
44
"license": "LGPL",
55
"repository": {
66
"type": "git",
@@ -67,18 +67,18 @@
6767
"fast-glob": "^3.3.3",
6868
"inquirer": "^12.4.0",
6969
"axios": "^1.13.4",
70-
"turbo": "^2.7.5",
7170
"@ucanto/principal": "^9.0.3",
7271
"@ucanto/server": "^11.0.3",
7372
"json-schema-ref-resolver": "^3.0.0",
74-
"@stream44.studio/encapsulate": "^0.4.0-rc.21"
73+
"@stream44.studio/encapsulate": "^0.4.0-rc.23",
74+
"turbo": "^2.7.5"
7575
},
7676
"optionalDependencies": {
77-
"@stream44.studio/t44-bunny.net": "^0.1.0-rc.3",
78-
"@stream44.studio/t44-vercel.com": "^0.1.0-rc.3",
79-
"@stream44.studio/t44-github.com": "^0.1.0-rc.3",
80-
"@stream44.studio/t44-dynadot.com": "^0.1.0-rc.3",
81-
"@stream44.studio/t44-npmjs.com": "^0.1.0-rc.3"
77+
"@stream44.studio/t44-bunny.net": "^0.1.0-rc.4",
78+
"@stream44.studio/t44-vercel.com": "^0.1.0-rc.4",
79+
"@stream44.studio/t44-github.com": "^0.1.0-rc.4",
80+
"@stream44.studio/t44-dynadot.com": "^0.1.0-rc.4",
81+
"@stream44.studio/t44-npmjs.com": "^0.1.0-rc.4"
8282
},
8383
"devDependencies": {
8484
"@types/bun": "^1.3.4",

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"extends": "../../../tsconfig.paths.json",
32
"compilerOptions": {
43
"target": "es2021",
54
"module": "esnext",
@@ -31,4 +30,4 @@
3130
"exclude": [
3231
"node_modules"
3332
]
34-
}
33+
}

0 commit comments

Comments
 (0)