Skip to content

Commit 44bdb72

Browse files
committed
ci(upgrade-deps): sync lightningcss with @tsdown/css and ignore the extensions in Renovate
lightningcss is a core dependency consumed by the bundled @tsdown/css, so upgrade-deps now mirrors @tsdown/css's lightningcss range into the catalog when bumping tsdown. Also ignore @tsdown/css, @tsdown/exe and lightningcss in Renovate so they stay in lockstep with tsdown instead of drifting.
1 parent 7e64f75 commit 44bdb72

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

.github/renovate.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"/^oxc-.*/",
2222
"@oxc-node/*",
2323
"@oxc-project/*",
24+
"@tsdown/css",
25+
"@tsdown/exe",
2426
"@vitejs/devtools",
27+
"lightningcss",
2528
"oxfmt",
2629
"oxlint",
2730
"oxlint-tsgolint",

.github/scripts/upgrade-deps.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type UpstreamVersions = {
4242
type PnpmWorkspaceVersions = {
4343
vitest: string;
4444
tsdown: string;
45+
lightningcss: string;
4546
oxcNodeCli: string;
4647
oxcNodeCore: string;
4748
oxfmt: string;
@@ -145,6 +146,25 @@ async function getLatestNpmVersion(packageName: string): Promise<string> {
145146
return data.version;
146147
}
147148

149+
// Read a dependency range from the latest published version of `packageName`,
150+
// e.g. the `lightningcss` range that the bundled `@tsdown/css` depends on.
151+
async function getNpmDependencyRange(packageName: string, dependencyName: string): Promise<string> {
152+
const res = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
153+
if (!res.ok) {
154+
throw new Error(
155+
`Failed to fetch npm metadata for ${packageName}: ${res.status} ${res.statusText}`,
156+
);
157+
}
158+
const data = (await res.json()) as { dependencies?: Record<string, string> };
159+
const range = data.dependencies?.[dependencyName];
160+
if (typeof range !== 'string') {
161+
throw new Error(
162+
`Invalid npm response for ${packageName}: missing dependencies.${dependencyName}`,
163+
);
164+
}
165+
return range;
166+
}
167+
148168
// ============ Update .upstream-versions.json ============
149169
async function updateUpstreamVersions(): Promise<void> {
150170
const filePath = path.join(ROOT, 'packages/tools/.upstream-versions.json');
@@ -227,6 +247,15 @@ async function updatePnpmWorkspace(versions: PnpmWorkspaceVersions): Promise<voi
227247
replacement: `'@tsdown/exe': ^${versions.tsdown}`,
228248
newVersion: versions.tsdown,
229249
},
250+
// `lightningcss` is a core dependency consumed by the bundled `@tsdown/css`.
251+
// Track exactly what `@tsdown/css` requires (already an `^x.y.z` range) so a
252+
// tsdown upgrade that bumps lightningcss is mirrored here.
253+
{
254+
name: 'lightningcss',
255+
pattern: /\n {2}lightningcss: (\^?[\d.]+(?:-[\w.]+)?)\n/,
256+
replacement: `\n lightningcss: ${versions.lightningcss}\n`,
257+
newVersion: versions.lightningcss,
258+
},
230259
{
231260
name: '@oxc-node/cli',
232261
pattern: /'@oxc-node\/cli': \^([\d.]+(?:-[\w.]+)?)/,
@@ -531,6 +560,7 @@ console.log('Fetching latest versions…');
531560
const [
532561
vitestVersion,
533562
tsdownVersion,
563+
lightningcssVersion,
534564
devtoolsVersion,
535565
oxcNodeCliVersion,
536566
oxcNodeCoreVersion,
@@ -545,6 +575,8 @@ const [
545575
] = await Promise.all([
546576
getLatestNpmVersion('vitest'),
547577
getLatestNpmVersion('tsdown'),
578+
// Mirror exactly what the bundled @tsdown/css depends on.
579+
getNpmDependencyRange('@tsdown/css', 'lightningcss'),
548580
getLatestNpmVersion('@vitejs/devtools'),
549581
getLatestNpmVersion('@oxc-node/cli'),
550582
getLatestNpmVersion('@oxc-node/core'),
@@ -560,6 +592,7 @@ const [
560592

561593
console.log(`vitest: ${vitestVersion}`);
562594
console.log(`tsdown: ${tsdownVersion}`);
595+
console.log(`lightningcss (from @tsdown/css): ${lightningcssVersion}`);
563596
console.log(`@vitejs/devtools: ${devtoolsVersion}`);
564597
console.log(`@oxc-node/cli: ${oxcNodeCliVersion}`);
565598
console.log(`@oxc-node/core: ${oxcNodeCoreVersion}`);
@@ -576,6 +609,7 @@ await updateUpstreamVersions();
576609
await updatePnpmWorkspace({
577610
vitest: vitestVersion,
578611
tsdown: tsdownVersion,
612+
lightningcss: lightningcssVersion,
579613
oxcNodeCli: oxcNodeCliVersion,
580614
oxcNodeCore: oxcNodeCoreVersion,
581615
oxfmt: oxfmtVersion,

0 commit comments

Comments
 (0)