Skip to content

Commit

Permalink
Bump dependencies, prepare 1.15.6 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhao271 authored Oct 11, 2023
1 parent a548c57 commit b5afe98
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 42 deletions.
6 changes: 3 additions & 3 deletions build/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ extends:
buildPlatforms:
- name: Linux
nodeVersions:
- 16.x
- 18.x
- name: MacOS
nodeVersions:
- 16.x
- 18.x
- name: Windows
nodeVersions:
- 16.x
- 18.x

buildSteps:
- script: npm i
Expand Down
33 changes: 30 additions & 3 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const isWindows = os.platform() === 'win32';

const REPO = 'microsoft/ripgrep-prebuilt';

/**
* @param {string} _url
*/
function isGithubUrl(_url) {
return url.parse(_url).hostname === 'api.github.com';
}
Expand Down Expand Up @@ -69,14 +72,19 @@ function downloadWin(url, dest, opts) {
});
}

/**
* @param {string} _url
* @param {fs.PathLike} dest
* @param {any} opts
*/
function download(_url, dest, opts) {

const proxy = proxy_from_env.getProxyForUrl(url.parse(_url));
if (proxy !== '') {
var HttpsProxyAgent = require('https-proxy-agent');
opts = {
...opts,
"agent": new HttpsProxyAgent(proxy),
"agent": new HttpsProxyAgent.HttpsProxyAgent(proxy),
proxy
};
}
Expand Down Expand Up @@ -120,6 +128,10 @@ function download(_url, dest, opts) {
});
}

/**
* @param {string} _url
* @param {any} opts
*/
function get(_url, opts) {
console.log(`GET ${_url}`);

Expand All @@ -128,7 +140,7 @@ function get(_url, opts) {
var HttpsProxyAgent = require('https-proxy-agent');
opts = {
...opts,
"agent": new HttpsProxyAgent(proxy)
"agent": new HttpsProxyAgent.HttpsProxyAgent(proxy)
};
}

Expand Down Expand Up @@ -158,6 +170,10 @@ function get(_url, opts) {
});
}

/**
* @param {string} repo
* @param {string} tag
*/
function getApiUrl(repo, tag) {
return `https://api.github.com/repos/${repo}/releases/tags/${tag}`;
}
Expand Down Expand Up @@ -211,6 +227,10 @@ async function getAssetFromGithubApi(opts, assetName, downloadFolder) {
await download(asset.url, assetDownloadPath, downloadOpts);
}

/**
* @param {string} zipPath
* @param {string} destinationDir
*/
function unzipWindows(zipPath, destinationDir) {
return new Promise((resolve, reject) => {
zipPath = sanitizePathForPowershell(zipPath);
Expand All @@ -234,7 +254,10 @@ function unzipWindows(zipPath, destinationDir) {
});
}

// Handle whitespace in filepath as powershell split's path with whitespaces
/**
* Handle whitespace in filepath as powershell splits path with whitespaces
* @param {string} path
*/
function sanitizePathForPowershell(path) {
path = path.replace(/ /g, '` '); // replace whitespace with "` " as solution provided here https://stackoverflow.com/a/18537344/7374562
return path;
Expand All @@ -258,6 +281,10 @@ function untar(zipPath, destinationDir) {
});
}

/**
* @param {string} zipPath
* @param {string} destinationDir
*/
async function unzipRipgrep(zipPath, destinationDir) {
if (isWindows) {
await unzipWindows(zipPath, destinationDir);
Expand Down
78 changes: 48 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/ripgrep",
"version": "1.15.5",
"version": "1.15.6",
"description": "A module for using ripgrep in a Node project",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand All @@ -14,13 +14,10 @@
"author": "Rob Lourens",
"license": "MIT",
"dependencies": {
"https-proxy-agent": "^5.0.1",
"https-proxy-agent": "^7.0.2",
"proxy-from-env": "^1.1.0"
},
"overrides": {
"agent-base": "^6.0.2"
},
"devDependencies": {
"@types/node": "^10.12.0"
"@types/node": "^20.8.4"
}
}

0 comments on commit b5afe98

Please sign in to comment.