Skip to content

Commit 6cfbcbd

Browse files
add type deps
1 parent 8bbd2b3 commit 6cfbcbd

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/types.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ jobs:
3333
const fs = require('fs');
3434
const rootPkg = require('./package.json');
3535
36+
// Combine all dependencies from the root package.json
37+
const rootDeps = { ...rootPkg.dependencies, ...rootPkg.devDependencies };
38+
const typeDeps = {};
39+
40+
// List of packages that are type-only but don"t start with @types/
41+
// Add other packages here if needed.
42+
const explicitTypePackages = ["@xterm/xterm", "howler"];
43+
44+
for (const [pkgName, version] of Object.entries(rootDeps)) {
45+
// Add if it"s an @types package OR in our explicit list
46+
if (pkgName.startsWith("@types/") || explicitTypePackages.includes(pkgName)) {
47+
typeDeps[pkgName] = version;
48+
}
49+
}
50+
3651
// Define the package.json for the 'types' branch
3752
// It reuses many fields from the root package.json
3853
const typesPkg = {
@@ -46,7 +61,8 @@ jobs:
4661
license: rootPkg.license,
4762
keywords: rootPkg.keywords,
4863
bugs: rootPkg.bugs,
49-
homepage: rootPkg.homepage
64+
homepage: rootPkg.homepage,
65+
dependencies: typeDeps
5066
};
5167
5268
// Write the new package.json into the 'types' directory

0 commit comments

Comments
 (0)