Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uprefactor: switch to @electron/get #59
Conversation
|
/cc @joaomoreno @bpasero |
| function download(opts, cb) { | ||
| var repo = opts.repo || 'atom/electron'; | ||
| var github = new GitHub({ repo: repo, token: opts.token }); |
This comment has been minimized.
This comment has been minimized.
deepak1556
Apr 22, 2020
Collaborator
We still need to support this configuration for the internal builds.
This comment has been minimized.
This comment has been minimized.
deepak1556
Apr 22, 2020
Collaborator
Ah I see that we can specify a mirror, that should do the trick
This comment has been minimized.
This comment has been minimized.
|
Thanks for working on this @codebytere |
|
Cool! |
|
@deepak1556 Would you like to drive this PR's adoption in VS Code? I've invited you as a collaborator. |
|
Thanks @joaomoreno , would be happy to do it. |
|
Another idea @bpasero and I just discussed about: how about just dropping this? Do we still need this module at all? |
|
I was referring to https://github.com/electron-userland/electron-forge in the standup today. |
|
What do you all envision the alternate path looking like, should we choose to take it? I'm happy to switch up my approach or try to PR something into vscode itself |
c2bcdf1
to
44ca6ab
44ca6ab
to
444e748
|
@codebytere No, no, this was more of a comment for us, VS Code team. |
|
|
|
@codebytere last week was testing in vscode during which the master branch will be frozen, I plan to move this forward tomorrow. |
27972f5
to
cc5b4e9
|
Thanks @codebytere for the fast turnaround, the following changes are also needed diff --git a/src/download.js b/src/download.js
index f408555..5363fdd 100644
--- a/src/download.js
+++ b/src/download.js
@@ -1,7 +1,8 @@
'use strict';
var path = require('path');
-const { downloadArtifact, getDownloadUrl } = require('@electron/get');
+const { downloadArtifact } = require('@electron/get');
+const { getDownloadUrl } = require('./util')
var semver = require('semver');
var rename = require('gulp-rename');
var es = require('event-stream');
@@ -31,15 +32,20 @@ function download(opts, cb) {
version: opts.version,
platform: opts.platform,
arch,
- token
+ token: opts.token
};
if (opts.repo) {
getDownloadUrl(opts.repo, downloadOptions)
- .then(({err, downloadUrl}) => {
+ .then(({err, downloadUrl, assetName}) => {
if (err) return cb(err)
- downloadOptions['mirrorOptions'] = { mirror: downloadUrl }
+ downloadOptions['mirrorOptions'] = {
+ mirror: downloadUrl,
+ customFilename: assetName
+ };
+ downloadOptions['artifactName'] = assetName;
+ downloadOptions['unsafelyDisableChecksums'] = true;
downloadArtifact(downloadOptions).then(zipFilePath => {
return cb(null, zipFilePath)
diff --git a/src/util.js b/src/util.js
index 54499fa..2ace0fb 100644
--- a/src/util.js
+++ b/src/util.js
@@ -7,8 +7,8 @@ function startsWith (haystack, needle) {
return haystack.substr(0, needle.length) === needle;
};
-async function getDownloadUrl(repo, { version, platform, arch, token }) {
- const [owner, repo] = repo.split('/');
+async function getDownloadUrl(repo_url, { version, platform, arch, token }) {
+ const [owner, repo] = repo_url.split('/');
const octokit = new Octokit({ auth: token });
const { data: release } = await octokit.repos.getReleaseByTag({
@@ -46,7 +46,7 @@ async function getDownloadUrl(repo, { version, platform, arch, token }) {
});
const { url, headers } = requestOptions;
- headers.authorization = `token ${token}`;
+ headers.authorization = `token ${token}`;
const response = await got(url, {
followRedirect: false,
@@ -54,7 +54,7 @@ async function getDownloadUrl(repo, { version, platform, arch, token }) {
headers
});
- return { error: null, location: response.headers.location };
+ return { error: null, location: response.headers.location, assetName: asset.name };
}
module.exports = { |
cc5b4e9
to
e942403
|
features from the previous version are preserved now,
There are two issues that still needs addressing
|
e942403
to
97bfded
99a2415
to
d9a070a
|
LGTM with minor style changes. |
9708956
to
e582f5e
e582f5e
to
f3f50e7
15302b2
to
1f3bee0
|
Thanks for working through my review Good to go now. @joaomoreno if you can make a new release, will adopt this in VSCode. Thanks! |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

codebytere commentedApr 22, 2020
•
edited
This PR updates
gulp-atom-electronto use Electron's recommended@electron/getfor simpler downloading and automatic caching. Some other benefits include the ability to download nightly releases as well as specify custom mirrors.Tested locally with Electron versions
v7.2.1andv7.2.3to confirm efficacy of change when runningyarn electronin vscode itself.cc @deepak1556