Comparing version 0.3.1 to 0.3.2
{ | ||
"printWidth": 120, | ||
"semi": false, | ||
"singleQuote": true | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"arrowParens": "avoid" | ||
} |
53
index.js
@@ -25,17 +25,37 @@ #!/usr/bin/env node | ||
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/master/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 () { | ||
console.log("Please set " + toRedString("\"enableProposedApi\": true") + " in package.json."); | ||
console.log('Read more about proposed API at: https://code.visualstudio.com/api/advanced-topics/using-proposed-api'); | ||
}); | ||
if (gitTagOrBranch === void 0) { gitTagOrBranch = 'main'; } | ||
var proposalNames = getEnabledApiProposals(); | ||
if (proposalNames.length === 0) { | ||
console.error("No proposals in the \"enabledApiProposals\"-property of package.json found."); | ||
return; | ||
} | ||
for (var _i = 0, proposalNames_1 = proposalNames; _i < proposalNames_1.length; _i++) { | ||
var name_1 = proposalNames_1[_i]; | ||
var url = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vscode-dts/vscode.proposed." + name_1 + ".d.ts"; | ||
var outPath = path_1["default"].resolve(process.cwd(), "./vscode.proposed." + name_1 + ".d.ts"); | ||
console.log("Downloading vscode.proposed." + toGreenString(name_1) + ".d.ts\nTo: " + outPath + "\nFrom: " + url); | ||
download(url, outPath)["catch"](function (err) { return console.error(err); }); | ||
} | ||
console.log('Read more about proposed API at: https://code.visualstudio.com/api/advanced-topics/using-proposed-api'); | ||
} | ||
function getEnabledApiProposals() { | ||
try { | ||
var packageJsonPath = path_1["default"].resolve(process.cwd(), './package.json'); | ||
var packageJson = JSON.parse(fs_1["default"].readFileSync(packageJsonPath, 'utf-8')); | ||
return Array.isArray(packageJson.enabledApiProposals) ? packageJson.enabledApiProposals : []; | ||
} | ||
catch (_a) { | ||
return []; | ||
} | ||
} | ||
function handleDefaultDownload(gitTagOrBranch, force) { | ||
var url = "https://raw.githubusercontent.com/microsoft/vscode/" + gitTagOrBranch + "/src/vs/vscode.d.ts"; | ||
// handle master->main rename for old consumers | ||
if (gitTagOrBranch === 'master') { | ||
gitTagOrBranch = 'main'; | ||
} | ||
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) { | ||
@@ -51,9 +71,9 @@ forceRemoveNodeModulesTypes(); | ||
return [ | ||
'vscode-dts: CLI utility for downloading vscode.d.ts and vscode.proposed.d.ts', | ||
'vscode-dts: CLI utility for downloading vscode.d.ts and vscode.proposed.<proposal>.d.ts', | ||
'', | ||
'Usage:', | ||
' - npx vscode-dts dev Download vscode.proposed.d.ts', | ||
' - npx vscode-dts dev <git-tag | git-branch> Download vscode.proposed.d.ts from git tag/branch of microsoft/vscode', | ||
' - npx vscode-dts dev Download vscode.proposaled.<proposal>.d.ts files', | ||
' - npx vscode-dts dev <git-tag | git-branch> Download vscode.proposaled.<proposal>.d.ts files from git tag/branch of microsoft/vscode', | ||
' - npx vscode-dts <git-tag | git-branch> Download vscode.d.ts from git tag/branch of microsoft/vscode', | ||
' - npx vscode-dts <git-tag | git-branch> -f Download vscode.d.ts and remove comflicing types in node_modules/@types/vscode', | ||
' - 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', | ||
@@ -132,1 +152,4 @@ ' - npx vscode-dts -h Print Help', | ||
} | ||
function toGreenString(s) { | ||
return "\u001B[32m" + s + "\u001B[0m"; | ||
} |
{ | ||
"name": "vscode-dts", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "CLI utility for downloading vscode.d.ts and vscode.proposed.d.ts", | ||
@@ -8,2 +8,6 @@ "author": { | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microsoft/vscode-dts.git" | ||
}, | ||
"bin": "index.js", | ||
@@ -10,0 +14,0 @@ "scripts": { |
@@ -9,9 +9,9 @@ # vscode-dts | ||
~ > npx vscode-dts | ||
vscode-dts: CLI utility for downloading vscode.d.ts and vscode.proposed.d.ts | ||
vscode-dts: CLI utility for downloading vscode.d.ts and vscode.proposed.<proposal>.d.ts | ||
Usage: | ||
- npx vscode-dts dev Download vscode.proposed.d.ts | ||
- npx vscode-dts dev <git-tag | git-branch> Download vscode.proposed.d.ts from git tag/branch of microsoft/vscode | ||
- npx vscode-dts dev Download vscode.proposaled.<proposal>.d.ts files | ||
- npx vscode-dts dev <git-tag | git-branch> Download vscode.proposaled.<proposal>.d.ts files from git tag/branch of microsoft/vscode | ||
- npx vscode-dts <git-tag | git-branch> Download vscode.d.ts from git tag/branch of microsoft/vscode | ||
- npx vscode-dts <git-tag | git-branch> -f Download vscode.d.ts and remove comflicing types in node_modules/@types/vscode | ||
- 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 | ||
@@ -38,2 +38,2 @@ - npx vscode-dts -h Print Help | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
10924
163
38
1
2