Skip to content

Commit c2266ff

Browse files
committed
Add the bundled themes into our dependencies.json
1 parent 85cf56b commit c2266ff

4 files changed

Lines changed: 81 additions & 3 deletions

File tree

lib/scripts/bundle-themes.mjs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { parse as parseJsonc } from 'jsonc-parser';
1616

1717
const __dirname = dirname(fileURLToPath(import.meta.url));
1818
const OUTPUT = resolve(__dirname, '../src/lib/themes/bundled.json');
19+
const OUTPUT_EXTENSIONS = resolve(__dirname, '../src/lib/themes/bundled-extensions.json');
1920

2021
/** Extensions to download from OpenVSX. */
2122
const EXTENSIONS = [
@@ -124,15 +125,26 @@ async function fetchExtensionThemes(namespace, name) {
124125
}
125126

126127
console.log(` Found ${themes.length} theme(s).`);
127-
return themes;
128+
return {
129+
themes,
130+
extension: {
131+
name: meta.displayName ?? `${namespace}/${name}`,
132+
version: meta.version,
133+
license: meta.license ?? null,
134+
author: meta.publishedBy?.loginName ?? null,
135+
homepage: meta.homepage ?? meta.repository ?? null,
136+
},
137+
};
128138
}
129139

130140
async function main() {
131141
const allThemes = [];
142+
const allExtensions = [];
132143

133144
for (const ext of EXTENSIONS) {
134-
const themes = await fetchExtensionThemes(ext.namespace, ext.name);
145+
const { themes, extension } = await fetchExtensionThemes(ext.namespace, ext.name);
135146
allThemes.push(...themes);
147+
allExtensions.push(extension);
136148
}
137149
allThemes.sort((a, b) => {
138150
const aIndex = PREFERRED_THEME_ORDER.indexOf(a.id);
@@ -145,6 +157,9 @@ async function main() {
145157

146158
console.log(`\nWriting ${allThemes.length} themes to ${OUTPUT}`);
147159
writeFileSync(OUTPUT, JSON.stringify(allThemes, null, 2) + '\n');
160+
161+
console.log(`Writing ${allExtensions.length} extensions to ${OUTPUT_EXTENSIONS}`);
162+
writeFileSync(OUTPUT_EXTENSIONS, JSON.stringify(allExtensions, null, 2) + '\n');
148163
console.log('Done.');
149164
}
150165

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"name": "GitHub Theme",
4+
"version": "6.3.5",
5+
"license": "MIT",
6+
"author": "open-vsx",
7+
"homepage": "https://github.com/primer/github-vscode-theme#readme"
8+
},
9+
{
10+
"name": "Solarized & Selenized",
11+
"version": "0.3.18",
12+
"license": null,
13+
"author": "santoso-wijaya",
14+
"homepage": "https://github.com/santoso-wijaya/vscode-helios-selene"
15+
},
16+
{
17+
"name": "Gruvbox Theme",
18+
"version": "1.29.1",
19+
"license": "MIT",
20+
"author": "jdinhify",
21+
"homepage": "https://github.com/jdinhify/vscode-theme-gruvbox"
22+
},
23+
{
24+
"name": "Iceberg Theme",
25+
"version": "2.0.5",
26+
"license": "MIT",
27+
"author": "cocopon",
28+
"homepage": "https://cocopon.github.io/iceberg.vim/"
29+
}
30+
]

website/scripts/generate-deps.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { execSync } from "node:child_process";
2-
import { writeFileSync } from "node:fs";
2+
import { readFileSync, writeFileSync } from "node:fs";
33
import { dirname, resolve } from "node:path";
44
import { fileURLToPath } from "node:url";
55

66
const __dirname = dirname(fileURLToPath(import.meta.url));
77
const repoRoot = resolve(__dirname, "../..");
88
const outPath = resolve(__dirname, "../src/data/dependencies.json");
9+
const themeExtensionsPath = resolve(repoRoot, "lib/src/lib/themes/bundled-extensions.json");
910

1011
const raw = JSON.parse(
1112
execSync("pnpm licenses list --prod --json", { cwd: repoRoot, encoding: "utf-8" })
@@ -24,6 +25,10 @@ for (const [license, packages] of Object.entries(raw)) {
2425
}
2526
}
2627

28+
// Merge in bundled theme extensions from OpenVSX
29+
const themeExtensions = JSON.parse(readFileSync(themeExtensionsPath, "utf-8"));
30+
deps.push(...themeExtensions);
31+
2732
deps.sort((a, b) => a.name.localeCompare(b.name));
2833

2934
writeFileSync(outPath, JSON.stringify(deps, null, 2) + "\n");

website/src/data/dependencies.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@
8383
"author": "Arjun Barrett",
8484
"homepage": "https://101arrowz.github.io/fflate"
8585
},
86+
{
87+
"name": "GitHub Theme",
88+
"version": "6.3.5",
89+
"license": "MIT",
90+
"author": "open-vsx",
91+
"homepage": "https://github.com/primer/github-vscode-theme#readme"
92+
},
93+
{
94+
"name": "Gruvbox Theme",
95+
"version": "1.29.1",
96+
"license": "MIT",
97+
"author": "jdinhify",
98+
"homepage": "https://github.com/jdinhify/vscode-theme-gruvbox"
99+
},
100+
{
101+
"name": "Iceberg Theme",
102+
"version": "2.0.5",
103+
"license": "MIT",
104+
"author": "cocopon",
105+
"homepage": "https://cocopon.github.io/iceberg.vim/"
106+
},
86107
{
87108
"name": "jsonc-parser",
88109
"version": "3.3.1",
@@ -139,6 +160,13 @@
139160
"author": null,
140161
"homepage": "https://react.dev/"
141162
},
163+
{
164+
"name": "Solarized & Selenized",
165+
"version": "0.3.18",
166+
"license": null,
167+
"author": "santoso-wijaya",
168+
"homepage": "https://github.com/santoso-wijaya/vscode-helios-selene"
169+
},
142170
{
143171
"name": "tailwind-merge",
144172
"version": "3.5.0",

0 commit comments

Comments
 (0)