Skip to content

Commit 33f30d0

Browse files
committed
Damn you windows.
reverted everything back to the olden times, no more direct windows builds, only linux. reverting back to the vacuum design which works consistently for npm Signed-off-by: quobix <[email protected]>
1 parent 500fa6e commit 33f30d0

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

.goreleaser.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ archives:
1818
{{- if eq .Arch "amd64" }}x86_64
1919
{{- else if eq .Arch "386" }}i386
2020
{{- else }}{{ .Arch }}{{ end }}
21-
format: zip
2221
checksum:
2322
name_template: 'checksums.txt'
2423

npm-install/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const CONFIG = {
22
name: "openapi-changes",
33
path: "./bin",
4-
url: "https://github.com/pb33f/openapi-changes/releases/download/v{{version}}/{{bin_name}}_{{version}}_{{platform}}_{{arch}}.zip",
4+
url: "https://github.com/pb33f/openapi-changes/releases/download/v{{version}}/{{bin_name}}_{{version}}_{{platform}}_{{arch}}.tar.gz",
55
};
66
export const ARCH_MAPPING = {
77
ia32: "i386",

npm-install/postinstall.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
import { createWriteStream } from "fs";
2-
import * as fs from "fs";
3-
4-
2+
import * as fs from "fs/promises";
53
import fetch from "node-fetch";
64
import { pipeline } from "stream/promises";
75
import tar from "tar";
8-
import AdmZip from 'adm-zip'
96
import { execSync } from "child_process";
107

118
import { ARCH_MAPPING, CONFIG, PLATFORM_MAPPING } from "./config.js";
129

1310
async function install() {
1411
if (process.platform === "android") {
15-
console.log("Installing openapi-changes, may take a moment...");
12+
console.log("Installing, may take a moment...");
1613
const cmd =
1714
"pkg upgrade && pkg install golang git -y && git clone https://github.com/pb33f/openapi-changes.git && cd cli/ && go build -o $PREFIX/bin/openapi-changes";
1815
execSync(cmd, { encoding: "utf-8" });
19-
console.log("openapi-changes installation successful!");
16+
console.log("Installation successful!");
2017
return;
2118
}
22-
const packageJson = await fs.promises.readFile("package.json").then(JSON.parse);
19+
const packageJson = await fs.readFile("package.json").then(JSON.parse);
2320
let version = packageJson.version;
2421

2522
if (typeof version !== "string") {
@@ -42,18 +39,12 @@ async function install() {
4239
throw new Error("Failed fetching the binary: " + response.statusText);
4340
}
4441

45-
const zipFile = "downloaded.zip";
46-
await fs.promises.mkdir(binPath, { recursive: true });
47-
await pipeline(response.body, createWriteStream(zipFile));
48-
49-
// unzip binary
50-
const zip = new AdmZip(zipFile);
51-
zip.extractAllTo(binPath, true);
42+
const tarFile = "downloaded.tar.gz";
5243

53-
// make the binary executable.
54-
await fs.chmodSync(`${binPath}/openapi-changes`, 0o755);
55-
await fs.promises.rm(zipFile);
56-
console.log("openapi-changes installation successful!");
44+
await fs.mkdir(binPath, { recursive: true });
45+
await pipeline(response.body, createWriteStream(tarFile));
46+
await tar.x({ file: tarFile, cwd: binPath });
47+
await fs.rm(tarFile);
5748
}
5849

5950
install()

0 commit comments

Comments
 (0)