Skip to content

Commit

Permalink
fix: update schema filename
Browse files Browse the repository at this point in the history
this is due the recent changes in tauri repo
ref: tauri-apps/tauri#10796
  • Loading branch information
amrbashir committed Aug 28, 2024
1 parent a50b071 commit 3312f3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3312f3b

Please sign in to comment.