mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 15:38:06 -05:00
fix: get github releases by tag name for ts-lib build (#710)
* fix: get github releases by tag name for ts-lib build * fix: use github release download url directly
This commit is contained in:
62
pnpm-lock.yaml
generated
62
pnpm-lock.yaml
generated
@@ -469,16 +469,13 @@ importers:
|
||||
version: 6.13.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
jest:
|
||||
specifier: ^29.7.0
|
||||
version: 29.7.0(@types/node@22.7.5)(ts-node@10.9.2(@types/node@22.7.5)(typescript@5.4.5))
|
||||
version: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2(@types/node@20.12.7)(typescript@5.4.5))
|
||||
jest-it-up:
|
||||
specifier: ^3.1.0
|
||||
version: 3.2.0
|
||||
node-fetch:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
ts-jest:
|
||||
specifier: ^29.1.5
|
||||
version: 29.2.5(@babel/core@7.25.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.7))(jest@29.7.0(@types/node@22.7.5)(ts-node@10.9.2(@types/node@22.7.5)(typescript@5.4.5)))(typescript@5.4.5)
|
||||
version: 29.2.5(@babel/core@7.25.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.7))(jest@29.7.0(@types/node@20.12.7)(ts-node@10.9.2(@types/node@20.12.7)(typescript@5.4.5)))(typescript@5.4.5)
|
||||
unzipper:
|
||||
specifier: ^0.12.1
|
||||
version: 0.12.3
|
||||
@@ -4586,10 +4583,6 @@ packages:
|
||||
resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
data-uri-to-buffer@4.0.1:
|
||||
resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}
|
||||
engines: {node: '>= 12'}
|
||||
|
||||
data-view-buffer@1.0.1:
|
||||
resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -5372,10 +5365,6 @@ packages:
|
||||
fecha@4.2.3:
|
||||
resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==}
|
||||
|
||||
fetch-blob@3.2.0:
|
||||
resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}
|
||||
engines: {node: ^12.20 || >= 14.13}
|
||||
|
||||
file-entry-cache@6.0.1:
|
||||
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
|
||||
engines: {node: ^10.12.0 || >=12.0.0}
|
||||
@@ -5490,10 +5479,6 @@ packages:
|
||||
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
formdata-polyfill@4.0.10:
|
||||
resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}
|
||||
engines: {node: '>=12.20.0'}
|
||||
|
||||
forwarded@0.2.0:
|
||||
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -7163,10 +7148,6 @@ packages:
|
||||
resolution: {integrity: sha512-tmPX422rYgofd4epzrNoOXiE8XFZYOcCq1vD7MAXCDO+O+zndlA2ztdKKMa+EeuBG5tHETpr4ml4RGgpqDCCAg==}
|
||||
engines: {node: '>= 0.10.5'}
|
||||
|
||||
node-domexception@1.0.0:
|
||||
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
|
||||
engines: {node: '>=10.5.0'}
|
||||
|
||||
node-emoji@1.11.0:
|
||||
resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==}
|
||||
|
||||
@@ -7182,10 +7163,6 @@ packages:
|
||||
encoding:
|
||||
optional: true
|
||||
|
||||
node-fetch@3.3.2:
|
||||
resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
|
||||
node-forge@1.3.1:
|
||||
resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==}
|
||||
engines: {node: '>= 6.13.0'}
|
||||
@@ -9395,10 +9372,6 @@ packages:
|
||||
wcwidth@1.0.1:
|
||||
resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}
|
||||
|
||||
web-streams-polyfill@3.3.3:
|
||||
resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
web3-bzz@1.10.4:
|
||||
resolution: {integrity: sha512-ZZ/X4sJ0Uh2teU9lAGNS8EjveEppoHNQiKlOXAjedsrdWuaMErBPdLQjXfcrYvN6WM6Su9PMsAxf3FXXZ+HwQw==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
@@ -9860,7 +9833,7 @@ snapshots:
|
||||
'@babel/traverse': 7.25.7
|
||||
'@babel/types': 7.25.7
|
||||
convert-source-map: 2.0.0
|
||||
debug: 4.3.7(supports-color@8.1.1)
|
||||
debug: 4.3.7
|
||||
gensync: 1.0.0-beta.2
|
||||
json5: 2.2.3
|
||||
semver: 6.3.1
|
||||
@@ -10754,7 +10727,7 @@ snapshots:
|
||||
'@babel/parser': 7.25.7
|
||||
'@babel/template': 7.25.7
|
||||
'@babel/types': 7.25.7
|
||||
debug: 4.3.7(supports-color@8.1.1)
|
||||
debug: 4.3.7
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -15630,8 +15603,6 @@ snapshots:
|
||||
dependencies:
|
||||
assert-plus: 1.0.0
|
||||
|
||||
data-uri-to-buffer@4.0.1: {}
|
||||
|
||||
data-view-buffer@1.0.1:
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
@@ -15672,6 +15643,10 @@ snapshots:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
debug@4.3.7:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
debug@4.3.7(supports-color@8.1.1):
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
@@ -16794,11 +16769,6 @@ snapshots:
|
||||
|
||||
fecha@4.2.3: {}
|
||||
|
||||
fetch-blob@3.2.0:
|
||||
dependencies:
|
||||
node-domexception: 1.0.0
|
||||
web-streams-polyfill: 3.3.3
|
||||
|
||||
file-entry-cache@6.0.1:
|
||||
dependencies:
|
||||
flat-cache: 3.2.0
|
||||
@@ -16924,10 +16894,6 @@ snapshots:
|
||||
combined-stream: 1.0.8
|
||||
mime-types: 2.1.35
|
||||
|
||||
formdata-polyfill@4.0.10:
|
||||
dependencies:
|
||||
fetch-blob: 3.2.0
|
||||
|
||||
forwarded@0.2.0: {}
|
||||
|
||||
fp-ts@1.19.3: {}
|
||||
@@ -17838,7 +17804,7 @@ snapshots:
|
||||
|
||||
istanbul-lib-source-maps@4.0.1:
|
||||
dependencies:
|
||||
debug: 4.3.7(supports-color@8.1.1)
|
||||
debug: 4.3.7
|
||||
istanbul-lib-coverage: 3.2.2
|
||||
source-map: 0.6.1
|
||||
transitivePeerDependencies:
|
||||
@@ -19126,8 +19092,6 @@ snapshots:
|
||||
dependencies:
|
||||
minimatch: 3.1.2
|
||||
|
||||
node-domexception@1.0.0: {}
|
||||
|
||||
node-emoji@1.11.0:
|
||||
dependencies:
|
||||
lodash: 4.17.21
|
||||
@@ -19140,12 +19104,6 @@ snapshots:
|
||||
optionalDependencies:
|
||||
encoding: 0.1.13
|
||||
|
||||
node-fetch@3.3.2:
|
||||
dependencies:
|
||||
data-uri-to-buffer: 4.0.1
|
||||
fetch-blob: 3.2.0
|
||||
formdata-polyfill: 4.0.10
|
||||
|
||||
node-forge@1.3.1: {}
|
||||
|
||||
node-gyp-build@4.8.2: {}
|
||||
@@ -21605,8 +21563,6 @@ snapshots:
|
||||
dependencies:
|
||||
defaults: 1.0.4
|
||||
|
||||
web-streams-polyfill@3.3.3: {}
|
||||
|
||||
web3-bzz@1.10.4(bufferutil@4.0.8)(utf-8-validate@5.0.10):
|
||||
dependencies:
|
||||
'@types/node': 12.20.55
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
"ethers": "^6.13.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-it-up": "^3.1.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"ts-jest": "^29.1.5",
|
||||
"unzipper": "^0.12.1"
|
||||
},
|
||||
|
||||
@@ -1,46 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import fetch from "node-fetch";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { Open } from "unzipper";
|
||||
import { exec } from "child_process";
|
||||
import { getBuildConfig } from "./config";
|
||||
|
||||
async function downloadAndParseJson(url: string, headers: Record<string, string> = {}): Promise<any> {
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
...headers,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to load JSON from ${url}. HTTP error code: ${response.status}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
async function getReleaseAssetUrl(nativeLibReleaseTag: string): Promise<string> {
|
||||
const urlStr = "https://api.github.com/repos/Consensys/linea-monorepo/releases";
|
||||
|
||||
const json = await downloadAndParseJson(urlStr);
|
||||
const release = json.find((release: any) => release.tag_name === nativeLibReleaseTag);
|
||||
|
||||
if (!release) {
|
||||
const releases = json.map((release: any) => release.tag_name);
|
||||
throw new Error(`Release ${nativeLibReleaseTag} not found! releases: ${releases}`);
|
||||
}
|
||||
|
||||
if (release.assets.length === 0) {
|
||||
throw new Error(`Release ${nativeLibReleaseTag} has no assets!`);
|
||||
}
|
||||
|
||||
const asset = release.assets.find((asset: any) => asset.name.includes(nativeLibReleaseTag));
|
||||
return `https://api.github.com/repos/Consensys/linea-monorepo/releases/assets/${asset.id}`;
|
||||
}
|
||||
|
||||
async function downloadFileUsingCurl(url: string, outputFilePath: string): Promise<string> {
|
||||
const outputDirectory = path.dirname(outputFilePath);
|
||||
|
||||
@@ -49,6 +12,7 @@ async function downloadFileUsingCurl(url: string, outputFilePath: string): Promi
|
||||
const command = `curl -L -H 'Accept:application/octet-stream' -o ${outputFilePath} ${url}`;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
exec(command, (error: any, _: any, stderr: any) => {
|
||||
if (error) {
|
||||
reject(new Error(`Failed to download file using curl: ${stderr}`));
|
||||
@@ -68,7 +32,7 @@ const architectureResourceDirMapping: Record<string, string> = {
|
||||
};
|
||||
|
||||
async function downloadReleaseAsset(nativeLibReleaseTag: string): Promise<string> {
|
||||
const assetReleaseUrl = await getReleaseAssetUrl(nativeLibReleaseTag);
|
||||
const assetReleaseUrl = `https://github.com/Consensys/linea-monorepo/releases/download/${nativeLibReleaseTag}/linea-${nativeLibReleaseTag}.zip`;
|
||||
const fileName = `${nativeLibReleaseTag}.zip`;
|
||||
const destPath = path.resolve("build", fileName);
|
||||
console.log(`Downloading ${fileName} from ${assetReleaseUrl} to ${destPath}`);
|
||||
|
||||
Reference in New Issue
Block a user