-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use postman-request instead of node-fetch.
- Loading branch information
1 parent
9c0c2b9
commit 2ca89c3
Showing
5 changed files
with
62 additions
and
93 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as fsExtra from 'fs-extra'; | ||
import * as r from 'postman-request'; | ||
import type { Response } from 'request'; | ||
import type * as requestType from 'request'; | ||
const request = r as typeof requestType; | ||
|
||
(async () => { | ||
const json = JSON.parse( | ||
(await httpGet('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/xml/syntaxes/xml.tmLanguage.json')).body | ||
); | ||
json.scopeName = 'scenegraph.xml'; | ||
json.name = 'scenegraph'; | ||
json.fileTypes = ['xml']; | ||
delete json.information_for_contributors; | ||
delete json.version; | ||
//find the CDATA pattern | ||
const pattern = json.patterns.find(x => x.name === 'string.unquoted.cdata.xml'); | ||
pattern.name = 'source.brighterscript.embedded.scenegraph'; | ||
pattern.patterns = [{ | ||
include: 'source.brs' | ||
}]; | ||
fsExtra.outputFileSync(`${__dirname}/../syntaxes/scenegraph.tmLanguage.json`, JSON.stringify(json, null, 4)); | ||
})().catch(e => console.error(e)); | ||
|
||
|
||
/** | ||
* Do an http GET request | ||
*/ | ||
function httpGet(url: string) { | ||
return new Promise<Response>((resolve, reject) => { | ||
request.get(url, (err, response) => { | ||
return err ? reject(err) : resolve(response); | ||
}); | ||
}); | ||
} |
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