Skip to content

Commit 95fc076

Browse files
authored
Merge branch 'main' into aiday/makeBackgroundLighterOnHoverAndFocus
2 parents bbdaa33 + 382cdec commit 95fc076

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+962
-887
lines changed

build/checksums/nodejs.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
dfb37570ef34ac04f34c26d0ec558df60a9665df5961c01c1657c0ca495f2f01 node-v16.17.1-aix-ppc64.tar.gz
2+
f9f02f7872e2e8ee54320fce13deb9d56904f32bb0615b6e21aa3371d8899150 node-v16.17.1-darwin-arm64.tar.gz
3+
09a45f60bfb9dfbea4f69044dc733ef983945acd92ca89ccccac267f3d71bd44 node-v16.17.1-darwin-arm64.tar.xz
4+
3db26761ad8493b894d42260d7e65094b7af9bc473588739e61bc1c32d6ff955 node-v16.17.1-darwin-x64.tar.gz
5+
8e7089956fa01cf7d0045945c0863d282dc6818fb0476237c1396497e29a4254 node-v16.17.1-darwin-x64.tar.xz
6+
35ccb95caf02cda3bd680da4350a8ae5d666a7a9eae3afe5c2a1b3ef29aef108 node-v16.17.1-headers.tar.gz
7+
554c8d1b4b16e0f4c073b9df7c49c893716a3a533f25ac646f23619f5ccee7df node-v16.17.1-headers.tar.xz
8+
adc7032888d4e672a4aac886baede8c04fccdd1a2e7ab4bcf325e3f336f44a3d node-v16.17.1-linux-arm64.tar.gz
9+
3dfb8fd8f6b97df69cdc56524abc906c50ef1d0bf091188616802e6c7c731389 node-v16.17.1-linux-arm64.tar.xz
10+
aeab05e35f1d2824ecfb88ca321f1408b44d292b2775f2890972c828e00216d0 node-v16.17.1-linux-armv7l.tar.gz
11+
a035ceefb5e16f5fce98c8ddfdf721b96eec20542c72fb8781bcbb6ef20c5550 node-v16.17.1-linux-armv7l.tar.xz
12+
1f48de7bed99e973c4c50f1b7fc99fc9af5144d093fd6d2b50a1e43b5818bf05 node-v16.17.1-linux-ppc64le.tar.gz
13+
70305934661f89fca64053b85317a75f233d5e3fdb2caa6546a19262a519cf20 node-v16.17.1-linux-ppc64le.tar.xz
14+
029dad48018bda07b481213816549b632059fc673c30fdc7a353e04619128344 node-v16.17.1-linux-s390x.tar.gz
15+
1a47f604944c6aff37cb7483503155671cdb34bda9bfb8962007bc440fa04d77 node-v16.17.1-linux-s390x.tar.xz
16+
da5658693243b3ecf6a4cba6751a71df1eb9e9703ca93b42a9404aed85f58ad0 node-v16.17.1-linux-x64.tar.gz
17+
06ba2eb34aa385967f5f58c87a44753f83212f6cccea892b33f80a2e7fda8384 node-v16.17.1-linux-x64.tar.xz
18+
12d10476ea7483298364c810c037b9316d1a73dc8c81cfeff7d794aecadde498 node-v16.17.1.pkg
19+
e423985f6019b2026f9a191adb56a96ae83ecd56cdf839cf94aa980168b7a90f node-v16.17.1.tar.gz
20+
6721feb4152d56d2c6b358ce397abd5a7f1daf09ee2e25c5021b9b4d3f86a330 node-v16.17.1.tar.xz
21+
9777e8c4b2864c5b54a0e4e9400f14887db68560a09b94b4113b560a64d1e680 node-v16.17.1-win-x64.7z
22+
ed290151efb417262b9808a70738d4ab79e9d53653a6a9f4b8dd97912e279dce node-v16.17.1-win-x64.zip
23+
0f8101648d5c9e49e89fee541da9e574f899716c32b7c51a732b1766b9fc4526 node-v16.17.1-win-x86.7z
24+
189b5e8b23226403e7b07a46614de19b444d369e694901e3668e2f549799cbcd node-v16.17.1-win-x86.zip
25+
1bdff65fb7642425c0d6826084d63c4be43520316f0ea0b46e6a51999a0ed7fc node-v16.17.1-x64.msi
26+
b737eb23a2c67c253b9364b5284123faf5220d567615bebd4ec4b81070e4d177 node-v16.17.1-x86.msi
27+
f518a70dcab7c3fac5b2e1ef100b4f628edfb160f4fafa9a94ef222da8a6e9ab win-x64/node.exe
28+
2f459a64647db493da63c790ce368ad54f59f086d9f22f59c5018680420197b3 win-x64/node.lib
29+
23215ce7d1e9de9777c3407239e7cf18d29d60f757b772219421ab361ac67c74 win-x64/node_pdb.7z
30+
8e32ec12028fd3e3147435be79a858ed9c870aaafa1fcb291362307ef3c47547 win-x64/node_pdb.zip
31+
2393aff88be19dbe0205cbde4ff0c1d89911b15de5c99c80f6e5e29604eecd12 win-x86/node.exe
32+
5018c3d42f3fbacbd06cb943b3f2696c8e67ca9bdf6864d0e263d6d6911dffd2 win-x86/node.lib
33+
05a4db56444a60ee70b0d2642d7f2d82a33339894d2d73bd07b1a41d6c869e04 win-x86/node_pdb.7z
34+
8f86eacb7f13a1bf6738cb0819d7854a2abca40fc2e9e1f91421e44ba52cad7e win-x86/node_pdb.zip

build/gulpfile.reh.js

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const rename = require('gulp-rename');
1717
const replace = require('gulp-replace');
1818
const filter = require('gulp-filter');
1919
const { getProductionDependencies } = require('./lib/dependencies');
20-
const { assetFromGithub } = require('./lib/github');
2120
const vfs = require('vinyl-fs');
2221
const packageJson = require('../package.json');
2322
const flatmap = require('gulp-flatmap');
@@ -43,7 +42,6 @@ const BUILD_TARGETS = [
4342
{ platform: 'win32', arch: 'x64' },
4443
{ platform: 'darwin', arch: 'x64' },
4544
{ platform: 'darwin', arch: 'arm64' },
46-
{ platform: 'linux', arch: 'ia32' },
4745
{ platform: 'linux', arch: 'x64' },
4846
{ platform: 'linux', arch: 'armhf' },
4947
{ platform: 'linux', arch: 'arm64' },
@@ -131,6 +129,33 @@ function getNodeVersion() {
131129
return target;
132130
}
133131

132+
function getNodeChecksum(nodeVersion, platform, arch) {
133+
let expectedName;
134+
switch (platform) {
135+
case 'win32':
136+
expectedName = `win-${arch}/node.exe`;
137+
break;
138+
139+
case 'darwin':
140+
case 'linux':
141+
expectedName = `node-v${nodeVersion}-${platform}-${arch}.tar.gz`;
142+
break;
143+
144+
case 'alpine':
145+
expectedName = `${platform}-${arch}/node`;
146+
break;
147+
}
148+
149+
const nodeJsChecksums = fs.readFileSync(path.join(REPO_ROOT, 'build', 'checksums', 'nodejs.txt'), 'utf8');
150+
for (const line of nodeJsChecksums.split('\n')) {
151+
const [checksum, name] = line.split(/\s+/);
152+
if (name === expectedName) {
153+
return checksum;
154+
}
155+
}
156+
return undefined;
157+
}
158+
134159
const nodeVersion = getNodeVersion();
135160

136161
BUILD_TARGETS.forEach(({ platform, arch }) => {
@@ -155,40 +180,57 @@ if (defaultNodeTask) {
155180
}
156181

157182
function nodejs(platform, arch) {
158-
const { remote } = require('./lib/gulpRemoteSource');
183+
const { fetchUrls, fetchGithub } = require('./lib/fetch');
159184
const untar = require('gulp-untar');
185+
const crypto = require('crypto');
160186

161187
if (arch === 'ia32') {
162188
arch = 'x86';
189+
} else if (arch === 'armhf') {
190+
arch = 'armv7l';
191+
} else if (arch === 'alpine') {
192+
platform = 'alpine';
193+
arch = 'x64';
163194
}
164195

165-
if (platform === 'win32') {
166-
if (product.nodejsRepository) {
167-
log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from ${product.nodejsRepository}...`);
168-
return assetFromGithub(product.nodejsRepository, nodeVersion, name => name === `win-${arch}-node-patched.exe`)
169-
.pipe(rename('node.exe'));
170-
}
171-
log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from https://nodejs.org`);
172-
return remote(`/dist/v${nodeVersion}/win-${arch}/node.exe`, { base: 'https://nodejs.org', verbose: true })
173-
.pipe(rename('node.exe'));
174-
}
196+
log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from ${product.nodejs.repository}...`);
175197

176-
if (arch === 'alpine' || platform === 'alpine') {
177-
const imageName = arch === 'arm64' ? 'arm64v8/node' : 'node';
178-
log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from docker image ${imageName}`);
179-
const contents = cp.execSync(`docker run --rm ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 100 * 1024 * 1024, encoding: 'buffer' });
180-
return es.readArray([new File({ path: 'node', contents, stat: { mode: parseInt('755', 8) } })]);
198+
const checksumSha256 = getNodeChecksum(nodeVersion, platform, arch);
199+
200+
if (checksumSha256) {
201+
log(`Using SHA256 checksum for checking integrity: ${checksumSha256}`);
202+
} else {
203+
log.warn(`Unable to verify integrity of downloaded node.js binary because no SHA256 checksum was found!`);
181204
}
182205

183-
if (arch === 'armhf') {
184-
arch = 'armv7l';
206+
switch (platform) {
207+
case 'win32':
208+
return (product.nodejs.repository !== 'https://nodejs.org' ?
209+
fetchGithub(product.nodejs.repository, { version: product.nodejs.version, name: `win-${arch}-node.exe`, checksumSha256 }) :
210+
fetchUrls(`/dist/v${nodeVersion}/win-${arch}/node.exe`, { base: 'https://nodejs.org', checksumSha256 }))
211+
.pipe(rename('node.exe'));
212+
case 'darwin':
213+
case 'linux':
214+
return (product.nodejs.repository !== 'https://nodejs.org' ?
215+
fetchGithub(product.nodejs.repository, { version: product.nodejs.version, name: `node-v${nodeVersion}-${platform}-${arch}.tar.gz`, checksumSha256 }) :
216+
fetchUrls(`/dist/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}.tar.gz`, { base: 'https://nodejs.org', checksumSha256 })
217+
).pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar())))
218+
.pipe(filter('**/node'))
219+
.pipe(util.setExecutableBit('**'))
220+
.pipe(rename('node'));
221+
case 'alpine': {
222+
const imageName = arch === 'arm64' ? 'arm64v8/node' : 'node';
223+
log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from docker image ${imageName}`);
224+
const contents = cp.execSync(`docker run --rm ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 100 * 1024 * 1024, encoding: 'buffer' });
225+
if (checksumSha256) {
226+
const actualSHA256Checksum = crypto.createHash('sha256').update(contents).digest('hex');
227+
if (actualSHA256Checksum !== checksumSha256) {
228+
throw new Error(`Checksum mismatch for node.js from docker image (expected ${options.checksumSha256}, actual ${actualSHA256Checksum}))`);
229+
}
230+
}
231+
return es.readArray([new File({ path: 'node', contents, stat: { mode: parseInt('755', 8) } })]);
232+
}
185233
}
186-
log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from https://nodejs.org`);
187-
return remote(`/dist/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}.tar.gz`, { base: 'https://nodejs.org', verbose: true })
188-
.pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar())))
189-
.pipe(filter('**/node'))
190-
.pipe(util.setExecutableBit('**'))
191-
.pipe(rename('node'));
192234
}
193235

194236
function packageTask(type, platform, arch, sourceFolderName, destinationFolderName) {

0 commit comments

Comments
 (0)