mirror of https://github.com/aminya/setup-cpp
Revert "fix: use is-url-online to validate the download links"
This reverts commit 232af3c141
.
This commit is contained in:
parent
232af3c141
commit
edc37d25c6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -60,7 +60,6 @@
|
||||||
"exec-powershell": "workspace:*",
|
"exec-powershell": "workspace:*",
|
||||||
"execa": "^5.1.1",
|
"execa": "^5.1.1",
|
||||||
"extension-tools": "workspace:*",
|
"extension-tools": "workspace:*",
|
||||||
"is-url-online": "^1.4.0",
|
|
||||||
"mri": "^1.2.0",
|
"mri": "^1.2.0",
|
||||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
|
|
|
@ -34,7 +34,6 @@ importers:
|
||||||
execa: ^5.1.1
|
execa: ^5.1.1
|
||||||
extension-tools: workspace:*
|
extension-tools: workspace:*
|
||||||
gen-readme: ^1.6.0
|
gen-readme: ^1.6.0
|
||||||
is-url-online: ^1.4.0
|
|
||||||
jest: ^28.1.3
|
jest: ^28.1.3
|
||||||
loose-ts-check: ^1.2.0
|
loose-ts-check: ^1.2.0
|
||||||
mri: ^1.2.0
|
mri: ^1.2.0
|
||||||
|
@ -69,7 +68,6 @@ importers:
|
||||||
exec-powershell: link:packages/exec-powershell
|
exec-powershell: link:packages/exec-powershell
|
||||||
execa: 5.1.1
|
execa: 5.1.1
|
||||||
extension-tools: link:packages/extension-tools
|
extension-tools: link:packages/extension-tools
|
||||||
is-url-online: 1.4.0
|
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
||||||
numerous: 1.0.3
|
numerous: 1.0.3
|
||||||
|
@ -3901,10 +3899,6 @@ packages:
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/destr/1.1.1:
|
|
||||||
resolution: {integrity: sha512-QqkneF8LrYmwATMdnuD2MLI3GHQIcBnG6qFC2q9bSH430VTCDAVjcspPmUaKhPGtAtPAftIUFqY1obQYQuwmbg==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/detect-indent/6.1.0:
|
/detect-indent/6.1.0:
|
||||||
resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==}
|
resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5754,12 +5748,6 @@ packages:
|
||||||
resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==}
|
resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/is-url-online/1.4.0:
|
|
||||||
resolution: {integrity: sha512-p61eygpIlCshn3f4yOYwng4EkuQ+EAi5/B27p8Qp1BKkqfQMohnpMEx6LX8MG7QKHRppDQt5drwlqMOrRt5eBA==}
|
|
||||||
dependencies:
|
|
||||||
ohmyfetch: 0.4.18
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/is-url/1.2.4:
|
/is-url/1.2.4:
|
||||||
resolution: {integrity: sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==}
|
resolution: {integrity: sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -7072,10 +7060,6 @@ packages:
|
||||||
resolution: {integrity: sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==}
|
resolution: {integrity: sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/node-fetch-native/0.1.4:
|
|
||||||
resolution: {integrity: sha512-10EKpOCQPXwZVFh3U1ptOMWBgKTbsN7Vvo6WVKt5pw4hp8zbv6ZVBZPlXw+5M6Tyi1oc1iD4/sNPd71KYA16tQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/node-fetch/2.6.7:
|
/node-fetch/2.6.7:
|
||||||
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
||||||
engines: {node: 4.x || >=6.0.0}
|
engines: {node: 4.x || >=6.0.0}
|
||||||
|
@ -7370,15 +7354,6 @@ packages:
|
||||||
es-abstract: 1.20.1
|
es-abstract: 1.20.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ohmyfetch/0.4.18:
|
|
||||||
resolution: {integrity: sha512-MslzNrQzBLtZHmiZBI8QMOcMpdNFlK61OJ34nFNFynZ4v+4BonfCQ7VIN4EGXvGGq5zhDzgdJoY3o9S1l2T7KQ==}
|
|
||||||
dependencies:
|
|
||||||
destr: 1.1.1
|
|
||||||
node-fetch-native: 0.1.4
|
|
||||||
ufo: 0.8.5
|
|
||||||
undici: 5.8.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/once/1.4.0:
|
/once/1.4.0:
|
||||||
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -8941,10 +8916,6 @@ packages:
|
||||||
resolution: {integrity: sha512-/IZMqVoMJ0Wl+vRJBlsIhbkpFlXnO9GdOk6zAiy0s4CyDJqpB/qp5T/ah4eoH1OL7ctNJN65nITtRIcbPCoU/w==}
|
resolution: {integrity: sha512-/IZMqVoMJ0Wl+vRJBlsIhbkpFlXnO9GdOk6zAiy0s4CyDJqpB/qp5T/ah4eoH1OL7ctNJN65nITtRIcbPCoU/w==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ufo/0.8.5:
|
|
||||||
resolution: {integrity: sha512-e4+UtA5IRO+ha6hYklwj6r7BjiGMxS0O+UaSg9HbaTefg4kMkzj4tXzEBajRR+wkxf+golgAWKzLbytCUDMJAA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/uglify-js/3.16.3:
|
/uglify-js/3.16.3:
|
||||||
resolution: {integrity: sha512-uVbFqx9vvLhQg0iBaau9Z75AxWJ8tqM9AV890dIZCLApF4rTcyHwmAvLeEdYRs+BzYWu8Iw81F79ah0EfTXbaw==}
|
resolution: {integrity: sha512-uVbFqx9vvLhQg0iBaau9Z75AxWJ8tqM9AV890dIZCLApF4rTcyHwmAvLeEdYRs+BzYWu8Iw81F79ah0EfTXbaw==}
|
||||||
engines: {node: '>=0.8.0'}
|
engines: {node: '>=0.8.0'}
|
||||||
|
@ -8962,11 +8933,6 @@ packages:
|
||||||
which-boxed-primitive: 1.0.2
|
which-boxed-primitive: 1.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/undici/5.8.1:
|
|
||||||
resolution: {integrity: sha512-iDRmWX4Zar/4A/t+1LrKQRm102zw2l9Wgat3LtTlTn8ykvMZmAmpq9tjyHEigx18FsY7IfATvyN3xSw9BDz0eA==}
|
|
||||||
engines: {node: '>=12.18'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/unique-filename/1.1.1:
|
/unique-filename/1.1.1:
|
||||||
resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==}
|
resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { setupLLVM, VERSIONS, getUrl, setupClangTools, getLinuxUrl } from "../llvm"
|
import { setupLLVM, VERSIONS, getUrl, setupClangTools, getLinuxUrl } from "../llvm"
|
||||||
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isValidUrl } from "../../utils/http/validate_url"
|
||||||
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
|
@ -14,7 +14,7 @@ jest.setTimeout(400000)
|
||||||
async function testUrl(version: string) {
|
async function testUrl(version: string) {
|
||||||
const [specificVersion, url] = await getSpecificVersionAndUrl(VERSIONS, process.platform, version, getUrl)
|
const [specificVersion, url] = await getSpecificVersionAndUrl(VERSIONS, process.platform, version, getUrl)
|
||||||
|
|
||||||
if (!(await isUrlOnline(url))) {
|
if (!(await isValidUrl(url))) {
|
||||||
throw new Error(`Failed to install Version: ${version} => ${specificVersion} \n URL: ${url}`)
|
throw new Error(`Failed to install Version: ${version} => ${specificVersion} \n URL: ${url}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as path from "path"
|
import * as path from "path"
|
||||||
import semverLte from "semver/functions/lte"
|
import semverLte from "semver/functions/lte"
|
||||||
import semverMajor from "semver/functions/major"
|
import semverMajor from "semver/functions/major"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isValidUrl } from "../utils/http/validate_url"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { extractExe, extractTarByExe } from "../utils/setup/extract"
|
import { extractExe, extractTarByExe } from "../utils/setup/extract"
|
||||||
import {
|
import {
|
||||||
|
@ -231,7 +231,7 @@ async function getWin32Url(version: string): Promise<string | null> {
|
||||||
let fallback = false
|
let fallback = false
|
||||||
if (olderThan9_1) {
|
if (olderThan9_1) {
|
||||||
url = getReleaseUrl(version, prefix, suffix)
|
url = getReleaseUrl(version, prefix, suffix)
|
||||||
if (!(await isUrlOnline(url))) {
|
if (!(await isValidUrl(url))) {
|
||||||
fallback = true // fallback to github
|
fallback = true // fallback to github
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import * as https from "https"
|
||||||
|
|
||||||
|
export function isValidUrl(url: string) {
|
||||||
|
return new Promise<boolean>((resolve) => {
|
||||||
|
https.get(url, (res) => {
|
||||||
|
if (res.statusCode !== undefined && res.statusCode >= 200 && res.statusCode <= 399) {
|
||||||
|
resolve(true)
|
||||||
|
} else {
|
||||||
|
resolve(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isValidUrl } from "../http/validate_url"
|
||||||
import semverCompare from "semver/functions/compare"
|
import semverCompare from "semver/functions/compare"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
import semverValid from "semver/functions/valid"
|
import semverValid from "semver/functions/valid"
|
||||||
|
@ -42,7 +42,7 @@ export async function getSpecificVersionAndUrl(
|
||||||
if (platform === "linux" && version.includes("ubuntu")) {
|
if (platform === "linux" && version.includes("ubuntu")) {
|
||||||
const url = await getUrl(platform, version)
|
const url = await getUrl(platform, version)
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
if (url !== null && (await isUrlOnline(url))) {
|
if (url !== null && (await isValidUrl(url))) {
|
||||||
return [version, url]
|
return [version, url]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export async function getSpecificVersionAndUrl(
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const url = await getUrl(platform, specificVersion)
|
const url = await getUrl(platform, specificVersion)
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
if (url !== null && (await isUrlOnline(url))) {
|
if (url !== null && (await isValidUrl(url))) {
|
||||||
return [specificVersion, url]
|
return [specificVersion, url]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue