forked from withastro/starlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into hd-astro-v5
* main: [ci] release (withastro#2634) ci: update file icons (withastro#2663) i18n(ru): update ru.json (withastro#2642) Improve error message with invalid configuration (withastro#2656) docs: use single listener in icons reference (withastro#2657) fix: use seti ui repo to generate file icons (withastro#2648) Fix favicon support for query and fragment in URLs (withastro#2645)
- Loading branch information
Showing
17 changed files
with
161 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import { writeDefinitionsAndSVGs } from './utils/file'; | ||
import { getIconSvgPaths } from './utils/font'; | ||
import { fetchFont, fetchMapping, parseMapping } from './utils/seti'; | ||
import { deleteRepo, parseMapping, setupRepo } from './utils/seti'; | ||
|
||
/** | ||
* Script generating definitions used by the Starlight `<FileTree>` component and associated SVGs. | ||
* | ||
* To do so, it fetches the Seti UI icon mapping file and font from GitHub, parses the mapping to | ||
* generate the definitions and a list of icons to extract as SVGs, and finally extracts the SVGs | ||
* from the font and writes the definitions and SVGs to the Starlight package in a file ready to be | ||
* consumed by Starlight. | ||
* To do so, it clones the Seti UI repository, installs dependencies, generates icons, parses the | ||
* mapping to generate the definitions and a list of icons to extract as SVGs, and finally extracts | ||
* the SVGs from the font and writes the definitions and SVGs to the Starlight package in a file | ||
* ready to be consumed by Starlight. | ||
* | ||
* @see {@link file://./config.ts} for the configuration used by this script. | ||
* @see {@link file://../starlight/user-components/file-tree-icons.ts} for the generated file. | ||
* @see {@link https://opentype.js.org/glyph-inspector.html} for a font glyph inspector. | ||
*/ | ||
|
||
const mapping = await fetchMapping(); | ||
const { definitions, icons } = parseMapping(mapping); | ||
const repoPath = await setupRepo(); | ||
|
||
const font = await fetchFont(); | ||
const svgPaths = getIconSvgPaths(icons, definitions, font); | ||
try { | ||
const { definitions, icons } = await parseMapping(repoPath); | ||
|
||
await writeDefinitionsAndSVGs(definitions, svgPaths); | ||
const svgPaths = await getIconSvgPaths(repoPath, icons, definitions); | ||
|
||
await writeDefinitionsAndSVGs(definitions, svgPaths); | ||
} finally { | ||
await deleteRepo(repoPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.