mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Temporarily keep the mcdoc dependencies
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import type { ExternalFileSystem } from '@spyglassmc/core'
|
||||
import * as zip from '@zip.js/zip.js'
|
||||
import type { Identifier, NbtTag, Random } from 'deepslate'
|
||||
import { Matrix3, Matrix4, NbtByte, NbtCompound, NbtDouble, NbtInt, NbtList, NbtString, Vector } from 'deepslate'
|
||||
@@ -636,12 +635,3 @@ export function safeJsonParse(text: string): any {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export async function clearFolder(fs: ExternalFileSystem, uri: string) {
|
||||
const entries = await fs.readdir(uri)
|
||||
return Promise.all(entries.map(async e => {
|
||||
if (e.name !== uri) {
|
||||
return await fs.unlink(e.name)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import { useSpyglass, watchSpyglassUri } from '../../contexts/Spyglass.jsx'
|
||||
import { AsyncCancel, useActiveTimeout, useAsync, useLocalStorage, useSearchParam } from '../../hooks/index.js'
|
||||
import type { VersionId } from '../../services/index.js'
|
||||
import { checkVersion, fetchDependencyMcdoc, fetchPreset, fetchRegistries, getSnippet, shareSnippet } from '../../services/index.js'
|
||||
import { DEPENDENCY_URI, SpyglassClient } from '../../services/Spyglass.js'
|
||||
import { DEPENDENCY_URI } from '../../services/Spyglass.js'
|
||||
import { Store } from '../../Store.js'
|
||||
import { cleanUrl, clearFolder, genPath } from '../../Utils.js'
|
||||
import { cleanUrl, genPath } from '../../Utils.js'
|
||||
import { Ad, Btn, BtnMenu, ErrorPanel, FileCreation, FileView, Footer, HasPreview, Octicon, PreviewPanel, ProjectPanel, SearchList, SourcePanel, TextInput, VersionSwitcher } from '../index.js'
|
||||
import { getRootDefault } from './McdocHelpers.js'
|
||||
|
||||
@@ -94,7 +94,8 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
|
||||
if (!service || !uri) {
|
||||
return AsyncCancel
|
||||
}
|
||||
await clearFolder(SpyglassClient.FS, DEPENDENCY_URI)
|
||||
// TODO: clear the dependencies that are not used
|
||||
// Right now if you do this, the mcdoc breaks when switching back to the dependency later
|
||||
if (gen.dependency) {
|
||||
const dependency = await fetchDependencyMcdoc(gen.dependency)
|
||||
const dependencyUri = `${DEPENDENCY_URI}${gen.dependency}.mcdoc`
|
||||
|
||||
Reference in New Issue
Block a user