Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adopt new location of vscode-dts files #9

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ else if (argv._[0]) {
handleDefaultDownload(argv._[0], argv['f']);
}
function handleDev(gitTagOrBranch) {
var url = gitTagOrBranch
? "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vs/vscode.proposed.d.ts"
: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vs/vscode.proposed.d.ts';
if (gitTagOrBranch === void 0) { gitTagOrBranch = 'main'; }
var url = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vscode-dts/vscode.proposed.d.ts";
var legacyUrl = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vs/vscode.proposed.d.ts";
var outPath = path_1["default"].resolve(process.cwd(), './vscode.proposed.d.ts');
console.log("Downloading vscode.proposed.d.ts\nTo: " + outPath + "\nFrom: " + url);
download(url, outPath).then(function () {
download(url, outPath)["catch"](function () { return download(legacyUrl, outPath); }).then(function () {
if (!isProposedApiEnabled()) {
console.log("Please set " + toRedString("\"enableProposedApi\": true") + " in package.json.");
}
Expand All @@ -49,10 +49,11 @@ function handleDefaultDownload(gitTagOrBranch, force) {
if (gitTagOrBranch === 'master') {
gitTagOrBranch = 'main';
}
var url = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vs/vscode.d.ts";
var url = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vscode-dts/vscode.d.ts";
var legacyUrl = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vs/vscode.d.ts";
var outPath = path_1["default"].resolve(process.cwd(), './vscode.d.ts');
console.log("Downloading vscode.d.ts\nTo: " + outPath + "\nFrom: " + url);
download(url, outPath).then(function () {
download(url, outPath)["catch"](function () { return download(legacyUrl, outPath); }).then(function () {
if (force) {
forceRemoveNodeModulesTypes();
}
Expand All @@ -72,7 +73,7 @@ function getHelpMessage() {
' - npx vscode-dts <git-tag | git-branch> -f Download vscode.d.ts and remove conflicting types in node_modules/@types/vscode',
' - npx vscode-dts Print Help',
' - npx vscode-dts -h Print Help',
' - npx vscode-dts --help Print Help',
' - npx vscode-dts --help Print Help'
].join(os_1["default"].EOL);
}
function download(url, outPath) {
Expand Down
15 changes: 8 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ if (argv._.length === 0 || argv['h'] || argv['help']) {
handleDefaultDownload(argv._[0], argv['f'])
}

function handleDev(gitTagOrBranch?: string) {
const url = gitTagOrBranch
? `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vs/vscode.proposed.d.ts`
: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vs/vscode.proposed.d.ts'
function handleDev(gitTagOrBranch: string = 'main') {

const url = `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vscode-dts/vscode.proposed.d.ts`
const legacyUrl = `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vs/vscode.proposed.d.ts`
const outPath = path.resolve(process.cwd(), './vscode.proposed.d.ts')
console.log(`Downloading vscode.proposed.d.ts\nTo: ${outPath}\nFrom: ${url}`)

download(url, outPath).then(() => {
download(url, outPath).catch(() => download(legacyUrl, outPath)).then(() => {
if (!isProposedApiEnabled()) {
console.log(`Please set ${toRedString(`"enableProposedApi": true`)} in package.json.`)
}
Expand All @@ -49,11 +49,12 @@ function handleDefaultDownload(gitTagOrBranch: string, force?: boolean) {
gitTagOrBranch = 'main'
}

const url = `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vs/vscode.d.ts`
const url = `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vscode-dts/vscode.d.ts`
const legacyUrl = `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vs/vscode.d.ts`
const outPath = path.resolve(process.cwd(), './vscode.d.ts')
console.log(`Downloading vscode.d.ts\nTo: ${outPath}\nFrom: ${url}`)

download(url, outPath).then(() => {
download(url, outPath).catch(() => download(legacyUrl, outPath)).then(() => {
if (force) {
forceRemoveNodeModulesTypes()
} else {
Expand Down