xynginc 1.0.72 → 1.0.74
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.
- package/dist/downloadBinary.d.ts.map +1 -1
- package/dist/downloadBinary.js +23 -24
- package/dist/downloadBinary.js.map +1 -1
- package/package.json +2 -1
- package/scripts/build.sh +44 -0
- package/scripts/postinstall.js +27 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadBinary.d.ts","sourceRoot":"","sources":["../src/downloadBinary.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"downloadBinary.d.ts","sourceRoot":"","sources":["../src/downloadBinary.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiErE"}
|
package/dist/downloadBinary.js
CHANGED
|
@@ -63,24 +63,21 @@ async function downloadBinary(version) {
|
|
|
63
63
|
}
|
|
64
64
|
const localPath = path.join(constant_1.BINARY_DIR, constant_1.BINARY_NAME);
|
|
65
65
|
return new Promise((resolve, reject) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.on("error", reject);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
66
|
+
function download(url) {
|
|
67
|
+
https
|
|
68
|
+
.get(url, (response) => {
|
|
69
|
+
if (response.statusCode &&
|
|
70
|
+
response.statusCode >= 300 &&
|
|
71
|
+
response.statusCode < 400 &&
|
|
72
|
+
response.headers.location) {
|
|
73
|
+
download(response.headers.location);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (response.statusCode !== 200) {
|
|
77
|
+
reject(new Error(`Failed to download binary: HTTP ${response.statusCode}`));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const file = fs.createWriteStream(localPath);
|
|
84
81
|
response.pipe(file);
|
|
85
82
|
file.on("finish", () => {
|
|
86
83
|
file.close();
|
|
@@ -88,12 +85,14 @@ async function downloadBinary(version) {
|
|
|
88
85
|
logger_1.Logger.success("[XyNginC] ✓ Binary downloaded successfully");
|
|
89
86
|
resolve(localPath);
|
|
90
87
|
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
})
|
|
89
|
+
.on("error", (err) => {
|
|
90
|
+
if (fs.existsSync(localPath))
|
|
91
|
+
fs.unlinkSync(localPath);
|
|
92
|
+
reject(err);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
download(downloadUrl);
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
//# sourceMappingURL=downloadBinary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadBinary.js","sourceRoot":"","sources":["../src/downloadBinary.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,
|
|
1
|
+
{"version":3,"file":"downloadBinary.js","sourceRoot":"","sources":["../src/downloadBinary.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,wCAiEC;AA9ED,qCAAkC;AAClC,6CAA+B;AAC/B,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,yCAAkE;AAElE;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,OAAe;IAClD,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAEvB,IAAI,QAAQ,K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AAO;gBACT,CAAC;gBAED,MAAM,IAAI,GAAG,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBAC7C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACrB,IAAI,CAAC,KAAK,EAAE,CAAC;oBACb,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,kBAAkB;oBAClD,eAAM,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC;oBAC7D,OAAO,CAAC,SAAS,CAAC,CAAC;gBACrB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACnB,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;oBAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBACvD,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC;QAED,QAAQ,CAAC,WAAW,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xynginc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.74",
|
|
4
4
|
"description": "XyPriss Nginx Controller - Automatic Nginx & SSL management for XyPriss servers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"build": "tsc && xfpm run build:go",
|
|
12
12
|
"build:go": "cd core-go && go build -o xynginc && cp xynginc ../bin/",
|
|
13
13
|
"build:all": "xfpm run build:go && xfpm run build",
|
|
14
|
+
"build:multi": "bash scripts/build.sh",
|
|
14
15
|
"dev": "tsc --watch",
|
|
15
16
|
"prepublishOnly": "xfpm run build",
|
|
16
17
|
"postinstall": "node scripts/postinstall.js",
|
package/scripts/build.sh
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# XyNginC Multi-Arch Build Script
|
|
4
|
+
# This script compiles the Go binary for different Linux architectures
|
|
5
|
+
# to match the naming convention used by the post-install downloader.
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
PROJECT_ROOT=$(pwd)
|
|
10
|
+
CORE_DIR="$PROJECT_ROOT/core-go"
|
|
11
|
+
RELEASE_DIR="$PROJECT_ROOT/releases"
|
|
12
|
+
|
|
13
|
+
echo "🚀 Starting multi-arch build for XyNginC..."
|
|
14
|
+
|
|
15
|
+
# Create release directory
|
|
16
|
+
mkdir -p "$RELEASE_DIR"
|
|
17
|
+
|
|
18
|
+
cd "$CORE_DIR"
|
|
19
|
+
|
|
20
|
+
# Ensure dependencies are up to date
|
|
21
|
+
go mod tidy
|
|
22
|
+
|
|
23
|
+
# Define targets: GOOS/GOARCH/Suffix
|
|
24
|
+
TARGETS=(
|
|
25
|
+
"linux/amd64/x64"
|
|
26
|
+
"linux/arm64/arm64"
|
|
27
|
+
"linux/386/ia32"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
for target in "${TARGETS[@]}"; do
|
|
31
|
+
IFS="/" read -r OS ARCH SUFFIX <<< "$target"
|
|
32
|
+
|
|
33
|
+
BINARY_NAME="xynginc-linux-$SUFFIX"
|
|
34
|
+
echo "📦 Building $BINARY_NAME (OS=$OS ARCH=$ARCH)..."
|
|
35
|
+
|
|
36
|
+
# Compile
|
|
37
|
+
GOOS=$OS GOARCH=$ARCH go build -ldflags="-s -w" -o "$RELEASE_DIR/$BINARY_NAME"
|
|
38
|
+
|
|
39
|
+
echo " ✅ Done: $BINARY_NAME"
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
echo ""
|
|
43
|
+
echo "🎉 All binaries built successfully in: $RELEASE_DIR"
|
|
44
|
+
ls -lh "$RELEASE_DIR"
|
package/scripts/postinstall.js
CHANGED
|
@@ -21,11 +21,6 @@ if (platform !== "linux") {
|
|
|
21
21
|
|
|
22
22
|
const binDir = path.join(__dirname, "../bin");
|
|
23
23
|
const binaryPath = path.join(binDir, "xynginc");
|
|
24
|
-
const downloadUrl =
|
|
25
|
-
"https://github.com/Nehonix-Team/xynginc/releases/latest/download/xynginc";
|
|
26
|
-
|
|
27
|
-
console.log(`> [XyNginC] Downloading latest binary from GitHub release...`);
|
|
28
|
-
console.log(` URL: ${downloadUrl}`);
|
|
29
24
|
|
|
30
25
|
// Create bin directory if it doesn't exist
|
|
31
26
|
if (!fs.existsSync(binDir)) {
|
|
@@ -34,33 +29,29 @@ if (!fs.existsSync(binDir)) {
|
|
|
34
29
|
|
|
35
30
|
function download(url, dest) {
|
|
36
31
|
return new Promise((resolve, reject) => {
|
|
37
|
-
const file = fs.createWriteStream(dest);
|
|
38
|
-
|
|
39
32
|
https
|
|
40
33
|
.get(url, (response) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fs.unlink(dest, () => {});
|
|
53
|
-
reject(err);
|
|
54
|
-
});
|
|
55
|
-
} else if (response.statusCode !== 200) {
|
|
34
|
+
if (
|
|
35
|
+
response.statusCode >= 300 &&
|
|
36
|
+
response.statusCode < 400 &&
|
|
37
|
+
response.headers.location
|
|
38
|
+
) {
|
|
39
|
+
// Recurse for redirects
|
|
40
|
+
download(response.headers.location, dest).then(resolve).catch(reject);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (response.statusCode !== 200) {
|
|
56
45
|
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
57
|
-
|
|
58
|
-
response.pipe(file);
|
|
59
|
-
file.on("finish", () => {
|
|
60
|
-
file.close();
|
|
61
|
-
resolve();
|
|
62
|
-
});
|
|
46
|
+
return;
|
|
63
47
|
}
|
|
48
|
+
|
|
49
|
+
const file = fs.createWriteStream(dest);
|
|
50
|
+
response.pipe(file);
|
|
51
|
+
file.on("finish", () => {
|
|
52
|
+
file.close();
|
|
53
|
+
resolve();
|
|
54
|
+
});
|
|
64
55
|
})
|
|
65
56
|
.on("error", (err) => {
|
|
66
57
|
fs.unlink(dest, () => {});
|
|
@@ -70,6 +61,14 @@ function download(url, dest) {
|
|
|
70
61
|
}
|
|
71
62
|
|
|
72
63
|
async function run() {
|
|
64
|
+
const arch = os.arch();
|
|
65
|
+
const binaryName = `xynginc-${platform}-${arch}`;
|
|
66
|
+
const downloadUrl = `https://github.com/Nehonix-Team/xynginc/releases/latest/download/${binaryName}`;
|
|
67
|
+
|
|
68
|
+
console.log(`> [XyNginC] Target Binary: ${binaryName}`);
|
|
69
|
+
console.log(`> [XyNginC] Downloading latest binary from GitHub release...`);
|
|
70
|
+
console.log(` URL: ${downloadUrl}`);
|
|
71
|
+
|
|
73
72
|
try {
|
|
74
73
|
await download(downloadUrl, binaryPath);
|
|
75
74
|
|