Skip to content

Commit 063e7b6

Browse files
committed
add support for optional extension icon
1 parent c4dfb5b commit 063e7b6

4 files changed

Lines changed: 135 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ jobs:
3232
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3333
VSCE_PAT: ${{ secrets.VSCE_PAT }}
3434
OVSX_PAT: ${{ secrets.OVSX_PAT }}
35+
# optional
36+
EXTENSION_ICON: ${{ secrets.EXTENSION_ICON }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"esbuild": "^0.16.16",
117117
"fs-extra": "^10.1.0",
118118
"got": "^12.5.3",
119+
"got-cjs": "npm:got@^11.x",
119120
"type-fest": "^2.13.1",
120121
"typed-jsonfile": "^0.2.1",
121122
"typescript": "^4.9.3",

pnpm-lock.yaml

Lines changed: 115 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-framework.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
//@ts-check
22
const { defineConfig } = require('@zardoy/vscode-utils/build/defineConfig.cjs')
33
const { patchPackageJson } = require('@zardoy/vscode-utils/build/patchPackageJson.cjs')
4+
const { mkdirSync, createWriteStream } = require('fs')
5+
/** @type {any} */
6+
const got = require('got-cjs')
7+
const { promisify } = require('util')
8+
const stream = require('stream')
9+
const pipeline = promisify(stream.pipeline)
410

511
/**
612
* @typedef {Record<keyof import('./src/configurationType').Configuration, any>} Config
@@ -24,6 +30,12 @@ const languageOveridableSettings = [
2430
// settings that just doesn't make sense to make language-overridable
2531
const dontMakeLanguageOverridableSettings = ['jsxPseudoEmmet.tags', 'jsxCompletionsMap', 'workspaceSymbolSearchExcludePatterns']
2632

33+
const ICON_URL = process.env.EXTENSION_ICON
34+
if (ICON_URL) {
35+
mkdirSync('resources', { recursive: true })
36+
pipeline(got.stream(ICON_URL), createWriteStream('resources/icon.png'))
37+
}
38+
2739
patchPackageJson({
2840
patchSettings(/** @type {Config} */ configuration) {
2941
//prettier-ignore
@@ -42,6 +54,11 @@ patchPackageJson({
4254
// }
4355
return configuration
4456
},
57+
rawPatchManifest(manifest) {
58+
if (ICON_URL) {
59+
manifest.icon = 'resources/icon.png'
60+
}
61+
},
4562
})
4663

4764
module.exports = defineConfig({

0 commit comments

Comments
 (0)