super-release 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ f56ba8935a455d102d6857ee1877153af2a0d6ec7cc80b8d32ae819cb0389b19 super-release-darwin-aarch64.tar.gz
@@ -0,0 +1 @@
1
+ 0991f78976d7bb59868e5705c16b79267c0132cacd38711cd7981d2c8155e6a2 super-release-darwin-x86_64.tar.gz
@@ -0,0 +1 @@
1
+ 8fccbed26a5d756f20f2ca3667150b98166ec109ad412ccb3aa7af010979915e super-release-linux-aarch64.tar.gz
@@ -0,0 +1 @@
1
+ 0ba7f6997f392f6544ba4c867164a7c357cb599ed2a12cb992a73d38a12650d5 super-release-linux-x86_64-musl.tar.gz
@@ -0,0 +1 @@
1
+ 8d6acf0612494cbad0f5100fced69c620ee534d50377d6125da81c3d4359a4fb super-release-linux-x86_64.tar.gz
@@ -0,0 +1 @@
1
+ BA00724ABC4F0BC0E03F6B8E9CC08D7ECBEC7E2F262DA1FA19C7CA951A9794E2
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import { arch, platform } from "node:os";
6
+ import { fileURLToPath } from "node:url";
7
+ import pkg from "../package.json" with { type: "json" };
8
+
9
+ function isMusl() {
10
+ try {
11
+ const result = execFileSync("ldd", ["--version"], {
12
+ stdio: ["pipe", "pipe", "pipe"],
13
+ });
14
+ return result.toString().includes("musl");
15
+ } catch (err) {
16
+ if (err.stderr && err.stderr.toString().includes("musl")) {
17
+ return true;
18
+ }
19
+ return (
20
+ existsSync("/lib/ld-musl-x86_64.so.1") ||
21
+ existsSync("/lib/ld-musl-aarch64.so.1")
22
+ );
23
+ }
24
+ }
25
+
26
+ function getBinaryPath() {
27
+ const os = platform() === "win32" ? "windows" : platform();
28
+ const cpu = arch();
29
+ const pkg = `super-release-${os}-${cpu}`;
30
+
31
+ try {
32
+ if (os === "linux" && isMusl()) {
33
+ return fileURLToPath(import.meta.resolve(`${pkg}/musl`));
34
+ }
35
+ return fileURLToPath(import.meta.resolve(pkg));
36
+ } catch {
37
+ throw new Error(
38
+ `Unsupported platform: ${os}-${cpu}. Install the platform-specific package "${pkg}" manually.`
39
+ );
40
+ }
41
+ }
42
+
43
+ const binPath = getBinaryPath();
44
+
45
+ try {
46
+ execFileSync(binPath, process.argv.slice(2), {
47
+ stdio: "inherit",
48
+ env: { ...process.env, SUPER_RELEASE_VERSION: pkg.version },
49
+ });
50
+ process.exit(0);
51
+ } catch (err) {
52
+ if (err.code === "ENOENT" || err.code === "EACCES") {
53
+ console.error(
54
+ `super-release: binary not found or not executable at ${binPath}`
55
+ );
56
+ console.error(err);
57
+ } else if (err.status === null) {
58
+ console.error(`super-release: failed to execute binary at ${binPath}`);
59
+ console.error(
60
+ `If running on Alpine/musl, ensure the musl build is being downloaded.`
61
+ );
62
+ console.error(err);
63
+ }
64
+ process.exit(err.status ?? 1);
65
+ }
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
+ "name": "super-release",
3
+ "type": "module",
4
+ "version": "1.4.0",
2
5
  "bin": {
3
- "super-release": "npm/bin/super-release.js"
6
+ "super-release": "bin/super-release.js"
4
7
  },
5
8
  "description": "A fast semantic-release alternative for monorepos, written in Rust",
6
9
  "engines": {
7
10
  "node": ">=20"
8
11
  },
9
12
  "files": [
10
- "npm/bin",
13
+ "bin",
11
14
  "README.md"
12
15
  ],
13
16
  "keywords": [
@@ -18,7 +21,6 @@
18
21
  "conventional-commits"
19
22
  ],
20
23
  "license": "MIT",
21
- "name": "super-release",
22
24
  "publishConfig": {
23
25
  "access": "public",
24
26
  "provenance": true
@@ -27,9 +29,15 @@
27
29
  "type": "git",
28
30
  "url": "git+https://github.com/BowlingX/super-release.git"
29
31
  },
30
- "type": "module",
31
- "version": "1.2.0",
32
+ "optionalDependencies": {
33
+ "super-release-linux-x64": "1.2.0",
34
+ "super-release-linux-arm64": "1.2.0",
35
+ "super-release-darwin-x64": "1.2.0",
36
+ "super-release-darwin-arm64": "1.2.0",
37
+ "super-release-windows-x64": "1.2.0"
38
+ },
32
39
  "scripts": {
33
- "super-release": "node npm/bin/super-release.js"
40
+ "prepublish": "cp ../../README.md README.md",
41
+ "super-release": "node bin/super-release.js"
34
42
  }
35
43
  }
@@ -1 +0,0 @@
1
- 71794d83631b0d1836e6890a5d0a3360085bb3e2aad37080774026d936e30d1a super-release-darwin-aarch64.tar.gz
@@ -1 +0,0 @@
1
- e853cd54e6a245b80fd8446afee4aaa81871af6ef6c415af108fee48a15979cb super-release-darwin-x86_64.tar.gz
@@ -1 +0,0 @@
1
- 455d0bb89c981360e22092d65dc2cf21011c55a827807495fd88f63ab0cb585f super-release-linux-aarch64.tar.gz
@@ -1 +0,0 @@
1
- 80c6c77119ee232a7b8138a358b86bb6317cd0ef358473d8f2e0c868f9d29511 super-release-linux-x86_64-musl.tar.gz
@@ -1 +0,0 @@
1
- b9a26668bbe4efbff75e9169afd9fd0f4f6c380d5d440a3d7f066a7bba776eb5 super-release-linux-x86_64.tar.gz
@@ -1 +0,0 @@
1
- F2250B18DE1F400175D88C5E65A27B7CFE2CE287FF153122C8564BBA5BD0FECC
@@ -1,151 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { execFileSync } from "node:child_process";
4
- import {
5
- existsSync,
6
- mkdirSync,
7
- createWriteStream,
8
- readFileSync,
9
- unlinkSync,
10
- chmodSync,
11
- } from "node:fs";
12
- import { dirname, join } from "node:path";
13
- import { platform, arch, tmpdir } from "node:os";
14
- import { get } from "node:https";
15
- import { pipeline } from "node:stream/promises";
16
- import { fileURLToPath } from "node:url";
17
- import pkg from "../../package.json" with { type: "json" };
18
-
19
- const __dirname = dirname(fileURLToPath(import.meta.url));
20
- const binPath = join(
21
- __dirname,
22
- platform() === "win32" ? "super-release.exe" : "super-release"
23
- );
24
-
25
- if (!existsSync(binPath)) {
26
- await install();
27
- }
28
-
29
- try {
30
- execFileSync(binPath, process.argv.slice(2), {
31
- stdio: "inherit",
32
- env: { ...process.env, SUPER_RELEASE_VERSION: pkg.version },
33
- });
34
- process.exit(0);
35
- } catch (err) {
36
- if (err.code === "ENOENT" || err.code === "EACCES") {
37
- console.error(`super-release: binary not found or not executable at ${binPath}`);
38
- console.error(err);
39
- } else if (err.status === null) {
40
- // No exit status = binary couldn't run at all (wrong libc, missing interpreter)
41
- console.error(`super-release: failed to execute binary at ${binPath}`);
42
- console.error(`If running on Alpine/musl, ensure the musl build is being downloaded.`);
43
- console.error(err);
44
- }
45
- process.exit(err.status ?? 1);
46
- }
47
-
48
- function isMusl() {
49
- try {
50
- // ldd --version outputs to stderr on musl and exits non-zero
51
- const result = execFileSync("ldd", ["--version"], { stdio: ["pipe", "pipe", "pipe"] });
52
- return result.toString().includes("musl");
53
- } catch (err) {
54
- // On musl, ldd exits with error but stderr contains "musl"
55
- if (err.stderr && err.stderr.toString().includes("musl")) {
56
- return true;
57
- }
58
- return existsSync("/lib/ld-musl-x86_64.so.1") || existsSync("/lib/ld-musl-aarch64.so.1");
59
- }
60
- }
61
-
62
- async function install() {
63
- const REPO = "bowlingx/super-release";
64
- const musl = platform() === "linux" && isMusl();
65
- const PLATFORM_MAP = {
66
- "linux-x64": musl ? "super-release-linux-x86_64-musl" : "super-release-linux-x86_64",
67
- "linux-arm64": "super-release-linux-aarch64",
68
- "darwin-x64": "super-release-darwin-x86_64",
69
- "darwin-arm64": "super-release-darwin-aarch64",
70
- "win32-x64": "super-release-windows-x86_64",
71
- };
72
-
73
- const { version } = pkg;
74
- const key = `${platform()}-${arch()}`;
75
- const artifact = PLATFORM_MAP[key];
76
-
77
- if (!artifact) {
78
- console.error(
79
- `Unsupported platform: ${key}. Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`
80
- );
81
- process.exit(1);
82
- }
83
-
84
- const isWindows = platform() === "win32";
85
- const ext = isWindows ? "zip" : "tar.gz";
86
- const url = `https://github.com/${REPO}/releases/download/v${version}/${artifact}.${ext}`;
87
- console.error(`Downloading super-release v${version} for ${key}...`);
88
-
89
- mkdirSync(__dirname, { recursive: true });
90
-
91
- const tmpFile = join(tmpdir(), `super-release-${Date.now()}.${ext}`);
92
- try {
93
- const response = await download(url);
94
- await pipeline(response, createWriteStream(tmpFile));
95
-
96
- const hashFile = join(__dirname, `${artifact}.${ext}.sha256`);
97
- if (existsSync(hashFile)) {
98
- const expectedHash = readFileSync(hashFile, "utf8").trim().split(/\s+/)[0].toLowerCase();
99
- const fileBuffer = readFileSync(tmpFile);
100
- const hashBuffer = await crypto.subtle.digest("SHA-256", fileBuffer);
101
- const actualHash = Array.from(new Uint8Array(hashBuffer)).map(b => b.toString(16).padStart(2, "0")).join("");
102
- if (actualHash !== expectedHash) {
103
- console.error(`Hash mismatch for ${artifact}.${ext}!`);
104
- console.error(` Expected: ${expectedHash}`);
105
- console.error(` Actual: ${actualHash}`);
106
- console.error(`This may indicate a tampered or corrupted download.`);
107
- unlinkSync(tmpFile);
108
- process.exit(1);
109
- }
110
- console.error(`Hash verified for ${artifact}.${ext}`);
111
- } else {
112
- console.error(`No hash file found at ${hashFile}, cannot verify download integrity.`);
113
- unlinkSync(tmpFile);
114
- process.exit(1);
115
- }
116
-
117
- if (isWindows) {
118
- execFileSync("powershell", ["-Command", `Expand-Archive -Path '${tmpFile}' -DestinationPath '${__dirname}' -Force`], { stdio: "ignore" });
119
- } else {
120
- execFileSync("tar", ["xzf", tmpFile, "-C", __dirname], { stdio: "ignore" });
121
- chmodSync(binPath, 0o755);
122
- }
123
- unlinkSync(tmpFile);
124
- console.error(`Installed super-release v${version}`);
125
- } catch (err) {
126
- console.error(`Failed to install super-release: ${err.message}`);
127
- console.error(
128
- `Install manually from: https://github.com/${REPO}/releases/tag/v${version}`
129
- );
130
- process.exit(1);
131
- }
132
- }
133
-
134
- function download(url) {
135
- return new Promise((resolve, reject) => {
136
- get(url, (res) => {
137
- if (
138
- res.statusCode >= 300 &&
139
- res.statusCode < 400 &&
140
- res.headers.location
141
- ) {
142
- return download(res.headers.location).then(resolve, reject);
143
- }
144
- if (res.statusCode !== 200) {
145
- reject(new Error(`Download failed: HTTP ${res.statusCode}`));
146
- return;
147
- }
148
- resolve(res);
149
- }).on("error", reject);
150
- });
151
- }