diff --git a/.gitignore b/.gitignore index 1dbe527cb8a..3d97a65e027 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ node_modules/ .build/ .vscode/extensions/**/out/ extensions/**/dist/ +src/vs/base/browser/ui/codicons/codicon/codicon.ttf /out*/ /extensions/**/out/ build/node_modules diff --git a/build/gulpfile.editor.ts b/build/gulpfile.editor.ts index 5096f8caa1e..338c678b7de 100644 --- a/build/gulpfile.editor.ts +++ b/build/gulpfile.editor.ts @@ -36,6 +36,14 @@ const BUNDLED_FILE_HEADER = [ ].join('\n'); const extractEditorSrcTask = task.define('extract-editor-src', () => { + // Ensure codicon.ttf is copied from node_modules (needed when node_modules is cached and postinstall doesn't run) + const codiconSource = path.join(root, 'node_modules', '@vscode', 'codicons', 'dist', 'codicon.ttf'); + const codiconDest = path.join(root, 'src', 'vs', 'base', 'browser', 'ui', 'codicons', 'codicon', 'codicon.ttf'); + if (fs.existsSync(codiconSource)) { + fs.mkdirSync(path.dirname(codiconDest), { recursive: true }); + fs.copyFileSync(codiconSource, codiconDest); + } + const apiusages = monacoapi.execute().usageContent; const extrausages = fs.readFileSync(path.join(root, 'build', 'monaco', 'monaco.usage.recipe')).toString(); standalone.extractEditor({ diff --git a/build/npm/postinstall.ts b/build/npm/postinstall.ts index c4bbbf52960..e94aaaf54c0 100644 --- a/build/npm/postinstall.ts +++ b/build/npm/postinstall.ts @@ -184,3 +184,21 @@ for (const dir of dirs) { child_process.execSync('git config pull.rebase merges'); child_process.execSync('git config blame.ignoreRevsFile .git-blame-ignore-revs'); + +// Copy codicon.ttf from @vscode/codicons package +const codiconSource = path.join(root, 'node_modules', '@vscode', 'codicons', 'dist', 'codicon.ttf'); +const codiconDest = path.join(root, 'src', 'vs', 'base', 'browser', 'ui', 'codicons', 'codicon', 'codicon.ttf'); + +if (!fs.existsSync(codiconSource)) { + console.error(`ERR codicon.ttf not found at ${codiconSource}`); + process.exit(1); +} + +try { + fs.mkdirSync(path.dirname(codiconDest), { recursive: true }); + fs.copyFileSync(codiconSource, codiconDest); + log('.', `Copied codicon.ttf to ${codiconDest}`); +} catch (error) { + console.error(`ERR Failed to copy codicon.ttf from ${codiconSource} to ${codiconDest}:`, error); + process.exit(1); +} diff --git a/package-lock.json b/package-lock.json index de332a2663a..d4c9c47d5a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@microsoft/1ds-post-js": "^3.2.13", "@parcel/watcher": "^2.5.4", "@types/semver": "^7.5.8", + "@vscode/codicons": "^0.0.44", "@vscode/deviceid": "^0.1.1", "@vscode/iconv-lite-umd": "0.7.1", "@vscode/native-watchdog": "^1.4.6", @@ -2946,6 +2947,12 @@ "win32" ] }, + "node_modules/@vscode/codicons": { + "version": "0.0.44", + "resolved": "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.44.tgz", + "integrity": "sha512-F7qPRumUK3EHjNdopfICLGRf3iNPoZQt+McTHAn4AlOWPB3W2kL4H0S7uqEqbyZ6rCxaeDjpAn3MCUnwTu/VJQ==", + "license": "CC-BY-4.0" + }, "node_modules/@vscode/deviceid": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/@vscode/deviceid/-/deviceid-0.1.4.tgz", diff --git a/package.json b/package.json index 16786159878..3fc2a6c88cb 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "@microsoft/1ds-post-js": "^3.2.13", "@parcel/watcher": "^2.5.4", "@types/semver": "^7.5.8", + "@vscode/codicons": "^0.0.44", "@vscode/deviceid": "^0.1.1", "@vscode/iconv-lite-umd": "0.7.1", "@vscode/native-watchdog": "^1.4.6", diff --git a/remote/web/package-lock.json b/remote/web/package-lock.json index 78bef5ccc5d..83542d2fc50 100644 --- a/remote/web/package-lock.json +++ b/remote/web/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@microsoft/1ds-core-js": "^3.2.13", "@microsoft/1ds-post-js": "^3.2.13", + "@vscode/codicons": "^0.0.44", "@vscode/iconv-lite-umd": "0.7.1", "@vscode/tree-sitter-wasm": "^0.3.0", "@vscode/vscode-languagedetection": "1.0.21", @@ -71,6 +72,12 @@ "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.9.tgz", "integrity": "sha512-n1VPsljTSkthsAFYdiWfC+DKzK2WwcRp83Y1YAqdX552BstvsDjft9YXppjUzp11BPsapDoO1LDgrDB0XVsfNQ==" }, + "node_modules/@vscode/codicons": { + "version": "0.0.44", + "resolved": "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.44.tgz", + "integrity": "sha512-F7qPRumUK3EHjNdopfICLGRf3iNPoZQt+McTHAn4AlOWPB3W2kL4H0S7uqEqbyZ6rCxaeDjpAn3MCUnwTu/VJQ==", + "license": "CC-BY-4.0" + }, "node_modules/@vscode/iconv-lite-umd": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.1.tgz", diff --git a/remote/web/package.json b/remote/web/package.json index e91442d01d7..13438c634de 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -5,6 +5,7 @@ "dependencies": { "@microsoft/1ds-core-js": "^3.2.13", "@microsoft/1ds-post-js": "^3.2.13", + "@vscode/codicons": "^0.0.44", "@vscode/iconv-lite-umd": "0.7.1", "@vscode/tree-sitter-wasm": "^0.3.0", "@vscode/vscode-languagedetection": "1.0.21", diff --git a/src/vs/base/browser/ui/codicons/codicon/README.md b/src/vs/base/browser/ui/codicons/codicon/README.md new file mode 100644 index 00000000000..8c0ffcb3b87 --- /dev/null +++ b/src/vs/base/browser/ui/codicons/codicon/README.md @@ -0,0 +1,5 @@ +# Codicons + +## Where does the codicon.ttf come from? + +It is added via the `@vscode/codicons` npm package, then copied to this directory during the postinstall script. diff --git a/src/vs/base/browser/ui/codicons/codicon/codicon.ttf b/src/vs/base/browser/ui/codicons/codicon/codicon.ttf deleted file mode 100644 index 0c9d65f81c2..00000000000 Binary files a/src/vs/base/browser/ui/codicons/codicon/codicon.ttf and /dev/null differ