Compare commits

..

3 Commits

Author SHA1 Message Date
Michael Telatynski
c5b053c5d9 Update asar package and switch to canonical name 2022-11-30 16:56:53 +00:00
Michael Telatynski
c2871033c2 Iterate 2022-11-30 16:52:15 +00:00
Michael Telatynski
fa1941278e Switch out needle with node-fetch 2022-11-30 16:25:49 +00:00
4 changed files with 449 additions and 492 deletions

View File

@@ -18,8 +18,9 @@ import path from 'path';
import childProcess from 'child_process';
import fs from 'fs';
import fsProm from 'fs/promises';
import needle from 'needle';
import tar from 'tar';
import fetch from 'node-fetch';
import { pipeline } from "stream";
import HakEnv from '../../scripts/hak/hakEnv';
import { DependencyInfo } from '../../scripts/hak/dep';
@@ -57,11 +58,10 @@ async function getSqlCipher(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise
haveSqlcipherTar = false;
}
if (!haveSqlcipherTar) {
const bob = needle('get', `https://github.com/sqlcipher/sqlcipher/archive/v${version}.tar.gz`, {
follow: 10,
output: sqlCipherTarball,
});
await bob;
const resp = await fetch(`https://github.com/sqlcipher/sqlcipher/archive/v${version}.tar.gz`);
if (!resp.ok) throw new Error(`unexpected response ${resp.statusText}`);
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
await pipeline(resp.body, fs.createWriteStream(sqlCipherTarball));
}
// Extract the tarball to per-target directories, then we avoid cross-contaiminating archs
@@ -118,10 +118,10 @@ async function getOpenSsl(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<v
haveOpenSslTar = false;
}
if (!haveOpenSslTar) {
await needle('get', `https://www.openssl.org/source/openssl-${version}.tar.gz`, {
follow: 10,
output: openSslTarball,
});
const resp = await fetch(`https://www.openssl.org/source/openssl-${version}.tar.gz`);
if (!resp.ok) throw new Error(`unexpected response ${resp.statusText}`);
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
await pipeline(resp.body, fs.createWriteStream(openSslTarball));
}
console.log("extracting " + openSslTarball + " in " + moduleInfo.moduleTargetDotHakDir);

View File

@@ -54,22 +54,21 @@
"@babel/core": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@electron/asar": "^3.2.0",
"@electron/notarize": "^1.2.3",
"@types/auto-launch": "^5.0.1",
"@types/counterpart": "^0.18.1",
"@types/detect-libc": "^1.0.0",
"@types/jest": "^29.0.0",
"@types/jest": "^28",
"@types/minimist": "^1.2.1",
"@types/mkdirp": "^1.0.2",
"@types/node": "^16",
"@types/pacote": "^11.1.1",
"@types/rimraf": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"allchange": "^1.0.6",
"app-builder-lib": "^22.14.10",
"asar": "^2.0.1",
"babel-jest": "^29.0.0",
"babel-jest": "^28.1.3",
"chokidar": "^3.5.2",
"detect-libc": "^1.0.3",
"electron": "^21",
@@ -80,21 +79,20 @@
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-matrix-org": "^0.7.0",
"eslint-plugin-unicorn": "^45.0.0",
"eslint-plugin-unicorn": "^44.0.2",
"expect-playwright": "^0.8.0",
"find-npm-prefix": "^1.0.2",
"fs-extra": "^10.0.0",
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"jest": "^29.0.0",
"jest": "^28",
"matrix-web-i18n": "^1.3.0",
"mkdirp": "^1.0.3",
"needle": "^2.5.0",
"node-pre-gyp": "^0.15.0",
"pacote": "^11.3.5",
"playwright": "^1.25.0",
"rimraf": "^3.0.2",
"tar": "^6.1.2",
"ts-jest": "^29.0.0",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"typescript": "4.5.5"
},
@@ -102,6 +100,9 @@
"matrix-seshat": "^2.3.3",
"keytar": "^7.9.0"
},
"resolutions": {
"@types/node": "16.11.38"
},
"build": {
"appId": "im.riot.app",
"asarUnpack": "**/*.node",

View File

@@ -7,7 +7,8 @@ const fsPromises = require('fs').promises;
const childProcess = require('child_process');
const tar = require('tar');
const asar = require('asar');
const needle = require('needle');
const fetch = require('node-fetch');
const { pipeline } = require("stream");
const riotDesktopPackageJson = require('../package.json');
const { setPackageVersion } = require('./set-version.js');
@@ -21,13 +22,12 @@ async function downloadToFile(url, filename) {
console.log("Downloading " + url + "...");
try {
await needle('get', url, null,
{
follow_max: 5,
output: filename,
},
);
const resp = await fetch(url);
if (!resp.ok) throw new Error(`unexpected response ${resp.statusText}`);
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
await pipeline(resp.body, fs.createWriteStream(filename));
} catch (e) {
console.error(e);
try {
await fsPromises.unlink(filename);
} catch (_) {}
@@ -116,7 +116,7 @@ async function main() {
return 1;
}
await new Promise((resolve) => {
await new Promise(async (resolve) => {
const gpgProc = childProcess.execFile('gpg', ['--import'], (error) => {
if (error) {
console.log("Failed to import key", error);
@@ -125,7 +125,7 @@ async function main() {
}
resolve(!error);
});
needle.get(PUB_KEY_URL).pipe(gpgProc.stdin);
pipeline((await fetch(PUB_KEY_URL)).body, gpgProc.stdin);
});
return 0;
}

884
yarn.lock
View File

File diff suppressed because it is too large Load Diff