fix: update schema filename

this is due the recent changes in tauri repo
ref: https://github.com/tauri-apps/tauri/pull/10796
This commit is contained in:
amrbashir
2024-08-28 19:43:54 +03:00
parent a50b0710b1
commit 3312f3bc06

View File

@@ -67,14 +67,19 @@ function registerSchemasHandler(context: vscode.ExtensionContext) {
// get schema form local file in node_modules
const schemaFile = (
await vscode.workspace.findFiles(
'**/node_modules/@tauri-apps/cli/schema.json'
'**/node_modules/@tauri-apps/cli/{schema.json,config.schema.json}'
)
)[0]
if (schemaFile) return readFileSync(schemaFile.fsPath, 'utf-8')
async function getSchemaFromRelease(version: string) {
const filename = version.startsWith('1')
? 'schema.json'
: 'config.schema.json'
const res = await axios.get(
`https://github.com/tauri-apps/tauri/releases/download/tauri-build-v${version}/schema.json`
`https://github.com/tauri-apps/tauri/releases/download/tauri-build-v${version}/${filename}`
)
return res.status == 200 ? JSON.stringify(res.data) : null
}