Skip to content

Commit

Permalink
chore: update sources
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 21, 2024
1 parent c8b81aa commit 5e2e508
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/tm-themes/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ SOFTWARE.

=========================================================================================================
Files: dracula.json, dracula-soft.json
License: https://raw.githubusercontent.com/dracula/visual-studio-code/master/LICENSE
License: https://raw.githubusercontent.com/dracula/visual-studio-code/main/LICENSE
SPDX: MIT
---------------------------------------------------------------------------------------------------------
The MIT License (MIT)
Expand Down
4 changes: 2 additions & 2 deletions packages/tm-themes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import { themes } from 'tm-themes'
| Catppuccin Macchiato | `catppuccin-macchiato` | [catppuccin/vscode](https://github.com/catppuccin/vscode/blob/94e2135389b52eff1b372473d0676537393fbf9a/packages/catppuccin-vsc/package.json) | [MIT](https://raw.githubusercontent.com/catppuccin/vscode/main/LICENSE) | 44.37 kB |
| Catppuccin Mocha | `catppuccin-mocha` | [catppuccin/vscode](https://github.com/catppuccin/vscode/blob/94e2135389b52eff1b372473d0676537393fbf9a/packages/catppuccin-vsc/package.json) | [MIT](https://raw.githubusercontent.com/catppuccin/vscode/main/LICENSE) | 44.36 kB |
| Dark Plus | `dark-plus` | [microsoft/vscode](https://github.com/microsoft/vscode/blob/cc4775f55aff152db2417dfaaddc643ee90b31f9/extensions/theme-defaults/themes/dark_plus.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | 8.64 kB |
| Dracula | `dracula` | [dracula/visual-studio-code](https://github.com/dracula/visual-studio-code/blob/61743d6ea21cde34d9ad1009ec784ffe6f5e457c/src/dracula.yml) | [MIT](https://raw.githubusercontent.com/dracula/visual-studio-code/master/LICENSE) | 20.51 kB |
| Dracula Soft | `dracula-soft` | [dracula/visual-studio-code](https://github.com/dracula/visual-studio-code/blob/61743d6ea21cde34d9ad1009ec784ffe6f5e457c/src/dracula.yml) | [MIT](https://raw.githubusercontent.com/dracula/visual-studio-code/master/LICENSE) | 20.52 kB |
| Dracula Theme | `dracula` | [dracula/visual-studio-code](https://github.com/dracula/visual-studio-code/blob/61743d6ea21cde34d9ad1009ec784ffe6f5e457c/src/dracula.yml) | [MIT](https://raw.githubusercontent.com/dracula/visual-studio-code/main/LICENSE) | 20.51 kB |
| Dracula Theme Soft | `dracula-soft` | [dracula/visual-studio-code](https://github.com/dracula/visual-studio-code/blob/61743d6ea21cde34d9ad1009ec784ffe6f5e457c/src/dracula.yml) | [MIT](https://raw.githubusercontent.com/dracula/visual-studio-code/main/LICENSE) | 20.52 kB |
| GitHub Dark | `github-dark` | [primer/github-vscode-theme](https://github.com/primer/github-vscode-theme/blob/f47b83f1acebb7fba4a3ec0bdb9385f85e6e8aa1/src/theme.js) | [MIT](https://raw.githubusercontent.com/primer/github-vscode-theme/main/LICENSE) | 11.08 kB |
| GitHub Dark Default | `github-dark-default` | [primer/github-vscode-theme](https://github.com/primer/github-vscode-theme/blob/f47b83f1acebb7fba4a3ec0bdb9385f85e6e8aa1/src/theme.js) | [MIT](https://raw.githubusercontent.com/primer/github-vscode-theme/main/LICENSE) | 14.00 kB |
| GitHub Dark Dimmed | `github-dark-dimmed` | [primer/github-vscode-theme](https://github.com/primer/github-vscode-theme/blob/f47b83f1acebb7fba4a3ec0bdb9385f85e6e8aa1/src/theme.js) | [MIT](https://raw.githubusercontent.com/primer/github-vscode-theme/main/LICENSE) | 14.00 kB |
Expand Down
12 changes: 6 additions & 6 deletions packages/tm-themes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,22 @@ export const themes = [
type: 'dark',
},
{
byteSize: 21000,
displayName: 'Dracula',
byteSize: 21006,
displayName: 'Dracula Theme',
lastUpdate: '2023-07-15T21:35:24Z',
license: 'MIT',
licenseUrl: 'https://raw.githubusercontent.com/dracula/visual-studio-code/master/LICENSE',
licenseUrl: 'https://raw.githubusercontent.com/dracula/visual-studio-code/main/LICENSE',
name: 'dracula',
sha: '61743d6ea21cde34d9ad1009ec784ffe6f5e457c',
source: 'https://github.com/dracula/visual-studio-code/blob/61743d6ea21cde34d9ad1009ec784ffe6f5e457c/src/dracula.yml',
type: 'dark',
},
{
byteSize: 21010,
displayName: 'Dracula Soft',
byteSize: 21016,
displayName: 'Dracula Theme Soft',
lastUpdate: '2023-07-15T21:35:24Z',
license: 'MIT',
licenseUrl: 'https://raw.githubusercontent.com/dracula/visual-studio-code/master/LICENSE',
licenseUrl: 'https://raw.githubusercontent.com/dracula/visual-studio-code/main/LICENSE',
name: 'dracula-soft',
sha: '61743d6ea21cde34d9ad1009ec784ffe6f5e457c',
source: 'https://github.com/dracula/visual-studio-code/blob/61743d6ea21cde34d9ad1009ec784ffe6f5e457c/src/dracula.yml',
Expand Down
2 changes: 1 addition & 1 deletion packages/tm-themes/themes/dracula-soft.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"titleBar.inactiveForeground": "#7b7f8b",
"walkThrough.embeddedEditorBackground": "#262626"
},
"displayName": "Dracula Soft",
"displayName": "Dracula Theme Soft",
"name": "dracula-soft",
"semanticHighlighting": true,
"tokenColors": [
Expand Down
2 changes: 1 addition & 1 deletion packages/tm-themes/themes/dracula.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"titleBar.inactiveForeground": "#6272A4",
"walkThrough.embeddedEditorBackground": "#21222C"
},
"displayName": "Dracula",
"displayName": "Dracula Theme",
"name": "dracula",
"semanticHighlighting": true,
"tokenColors": [
Expand Down
4 changes: 2 additions & 2 deletions scripts/shared/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const _cacheGetCommit = new Map<string, Promise<CommitInfo>>()

function _getLicenseUrl(repo: string) {
return octokit.request('GET /repos/{owner}/{repo}/license', { owner: repo.split('/')[0], repo: repo.split('/')[1] })
.then((r) => {
.then((r: any) => {
return r.data
})
}
Expand All @@ -24,7 +24,7 @@ function _getCommit(repo: string, branch: string, path: string): Promise<CommitI
owner: repo.split('/')[0],
repo: repo.split('/')[1],
})
.then((r) => {
.then((r: any) => {
if (!r.data.length) {
console.error(r, path)
throw new Error(`Failed to resolve sha for ${JSON.stringify({ repo, branch, path })}}`)
Expand Down
34 changes: 23 additions & 11 deletions sources-themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ export const sourcesMarketplace: ThemeSource[] = [
'dracula-theme.theme-dracula',
'https://github.com/dracula/visual-studio-code/blob/main/src/dracula.yml',
[
'Dracula',
'Dracula Soft',
['Dracula Theme', 'dracula'],
['Dracula Theme Soft', 'dracula-soft'],
],
),
...generateMarketplaceSource(
Expand Down Expand Up @@ -204,14 +204,26 @@ export const sources = [
...sourcesMarketplace,
]

function generateMarketplaceSource(name: string, source: string, themes: string[]): ThemeSource[] {
return themes.map(theme => ({
name: theme.toLowerCase().normalize('NFD').replace(/[\u0300-\u036F]/g, '').trim().replace(/\s+/g, '-'),
displayName: theme,
source,
marketplace: {
function generateMarketplaceSource(
pkg: string,
source: string,
themes: (string | [string, string])[],
): ThemeSource[] {
return themes.map((theme): ThemeSource => {
const name = Array.isArray(theme)
? theme[1]
: theme.toLowerCase().normalize('NFD').replace(/[\u0300-\u036F]/g, '').trim().replace(/\s+/g, '-')
const themeName = Array.isArray(theme)
? theme[0]
: theme
return {
name,
theme,
},
}))
displayName: themeName,
source,
marketplace: {
name: pkg,
theme: themeName,
},
}
})
}

0 comments on commit 5e2e508

Please sign in to comment.