@magneticjs/cli 0.1.3 → 0.1.4
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/package.json +1 -1
- package/scripts/install-server.js +12 -12
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* for the current platform during `npm install @magneticjs/cli`.
|
|
5
5
|
*
|
|
6
6
|
* Update strategy:
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
7
|
+
* - SERVER_VERSION is hardcoded (decoupled from npm package version)
|
|
8
|
+
* - Only bump SERVER_VERSION when a new binary is uploaded to GitHub Releases
|
|
9
9
|
* - Binary version is tracked in bin/.version
|
|
10
10
|
* - If version mismatch → re-download; if match → skip
|
|
11
11
|
*
|
|
@@ -26,18 +26,18 @@ const binDir = join(pkgDir, 'bin');
|
|
|
26
26
|
const binPath = join(binDir, 'magnetic-v8-server');
|
|
27
27
|
const versionFile = join(binDir, '.version');
|
|
28
28
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
const
|
|
29
|
+
// Server binary version — decoupled from npm package version.
|
|
30
|
+
// Only bump this when a new binary is uploaded to GitHub Releases.
|
|
31
|
+
const SERVER_VERSION = '0.1.0';
|
|
32
32
|
|
|
33
|
-
// Check if installed binary matches current
|
|
33
|
+
// Check if installed binary matches current server version
|
|
34
34
|
if (existsSync(binPath) && existsSync(versionFile)) {
|
|
35
35
|
const installed = readFileSync(versionFile, 'utf-8').trim();
|
|
36
|
-
if (installed ===
|
|
37
|
-
console.log(`[magnetic] Server binary v${
|
|
36
|
+
if (installed === SERVER_VERSION) {
|
|
37
|
+
console.log(`[magnetic] Server binary v${SERVER_VERSION} already installed, skipping`);
|
|
38
38
|
process.exit(0);
|
|
39
39
|
}
|
|
40
|
-
console.log(`[magnetic] Server binary outdated (${installed} → ${
|
|
40
|
+
console.log(`[magnetic] Server binary outdated (${installed} → ${SERVER_VERSION}), updating...`);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// Determine platform target
|
|
@@ -60,7 +60,7 @@ if (!target) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const baseUrl = process.env.MAGNETIC_BINARY_URL ||
|
|
63
|
-
`https://github.com/inventhq/magnetic/releases/download/v${
|
|
63
|
+
`https://github.com/inventhq/magnetic/releases/download/v${SERVER_VERSION}`;
|
|
64
64
|
const filename = `magnetic-v8-server-${target}.tar.gz`;
|
|
65
65
|
const url = `${baseUrl}/${filename}`;
|
|
66
66
|
|
|
@@ -91,8 +91,8 @@ try {
|
|
|
91
91
|
|
|
92
92
|
if (downloaded && existsSync(binPath)) {
|
|
93
93
|
chmodSync(binPath, 0o755);
|
|
94
|
-
writeFileSync(versionFile,
|
|
95
|
-
console.log(`[magnetic] ✓ Server binary v${
|
|
94
|
+
writeFileSync(versionFile, SERVER_VERSION);
|
|
95
|
+
console.log(`[magnetic] ✓ Server binary v${SERVER_VERSION} installed: ${binPath}`);
|
|
96
96
|
} else {
|
|
97
97
|
throw new Error(`Download failed or binary not found after extraction`);
|
|
98
98
|
}
|