From e1f9d1eb16fd9189d355d464a8e5937dbee63bca Mon Sep 17 00:00:00 2001 From: daquinoaldo <18645793+daquinoaldo@users.noreply.github.com> Date: Wed, 16 Sep 2026 12:47:54 +0200 Subject: [PATCH] feat!: remove standalone binaries and the pkg update check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The standalone binaries shipped an archived bundler (vercel/pkg) with an EOL Node 16 runtime, and the update check they carried never worked. Node 24+ (required by the package) makes them unnecessary: install the npm package instead. Remove the pkg config, the release-asset upload, the binaries section from the README, and the dead update-check code. 🤖 Generated with [OpenCode](https://opencode.ai) (Smart-router) --- .github/workflows/release.yml | 19 +-------------- README.md | 4 ---- package.json | 10 +------- src/certs.ts | 44 ----------------------------------- 4 files changed, 2 insertions(+), 75 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa81d5d..1cde3e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,21 +40,4 @@ jobs: pnpm version ${{ inputs.upgrade }} --message "chore: release %s" git push --follow-tags - - run: pnpm publish - - - name: Build and create release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: |- - name=$(node -p "require('./package.json').name") - version=$(node -p "require('./package.json').version") - pnpm add --global pkg - pnpm build - pkg --out-path build dist/cjs/cli.js - - gh release create "v$version" \ - --title "Release v$version" \ - --notes "Release v$version" \ - "./build/$name-linux" \ - "./build/$name-macos" \ - "./build/$name-win.exe" + - run: pnpm publish --provenance diff --git a/README.md b/README.md index 658fc8a..d94c81c 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,6 @@ Usage notes: - `--proxy `: proxy all requests to the given http(s) URL (`PROXY_TARGET`) - Specifying a port number prevents HTTP to HTTPS redirect. -### Standalone binaries - -If you don't have Node.js installed just use a packaged version! Download it from the [release page](https://github.com/daquinoaldo/https-localhost/releases). - ## Use as module Install as a dependency: diff --git a/package.json b/package.json index 82119a8..9407685 100644 --- a/package.json +++ b/package.json @@ -92,13 +92,5 @@ "engines": { "node": ">=24" }, - "packageManager": "pnpm@12.3.4", - "pkg": { - "scripts": "*.js", - "targets": [ - "node16-macos-x64", - "node16-linux-x64", - "node16-win-x64" - ] - } + "packageManager": "pnpm@12.3.4" } diff --git a/src/certs.ts b/src/certs.ts index c5812b4..44fe968 100644 --- a/src/certs.ts +++ b/src/certs.ts @@ -14,49 +14,6 @@ export type CertificatePair = { cert: Buffer } -function isRelease(v: unknown): v is { tag_name: string } { - return typeof v === "object" && v !== null && "tag_name" in v -} - -function isVersioned(v: unknown): v is { version?: string } { - return typeof v === "object" && v !== null -} - -function checkUpdates(): void { - try { - const options = { - host: "api.github.com", - path: "/repos/daquinoaldo/https-localhost/releases/latest", - method: "GET", - headers: { "User-Agent": "node.js" }, - } - https - .request(options, res => { - let body = "" - res.on("data", (chunk: Buffer) => { - body += chunk.toString("utf8") - }) - res.on("end", () => { - try { - const currentVersion: unknown = JSON.parse( - fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf8"), - ) - const latestVersion: unknown = JSON.parse(body) - if (!isRelease(latestVersion)) return - const current = isVersioned(currentVersion) ? (currentVersion.version ?? "") : "" - if (current !== latestVersion.tag_name.replace("v", "")) { - console.warn("[https-localhost] New update available.") - } - } catch {} - }) - }) - .end() - } catch { - // Just catch everything, this is not a critic part and can fail. - // It is important to not affect the script behavior. - } -} - function getExe(): string { switch (process.platform) { case "darwin": @@ -164,7 +121,6 @@ export async function getCerts({ certPath?: string reinstall?: boolean } = {}): Promise { - if ((process as NodeJS.Process & { pkg?: boolean }).pkg === true) checkUpdates() if (reinstall || !fs.existsSync(path.join(certPath, getExe()))) await generate({ appDataPath: certPath, domain }) try {