@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magneticjs/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Magnetic CLI — build, dev, and deploy server-driven UI apps",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,8 +4,8 @@
4
4
  * for the current platform during `npm install @magneticjs/cli`.
5
5
  *
6
6
  * Update strategy:
7
- * - Version is read from ../package.json (matches @magneticjs/cli version)
8
- * - When user runs `npm update @magneticjs/cli`, this script re-runs
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
- // Read version from package.json (stays in sync with npm version)
30
- const pkg = JSON.parse(readFileSync(join(pkgDir, 'package.json'), 'utf-8'));
31
- const version = pkg.version;
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 CLI version
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 === version) {
37
- console.log(`[magnetic] Server binary v${version} already installed, skipping`);
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} → ${version}), updating...`);
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${version}`;
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, version);
95
- console.log(`[magnetic] ✓ Server binary v${version} installed: ${binPath}`);
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
  }