@limlabs/rex 0.15.2 → 0.16.0-beta.497

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.
Files changed (2) hide show
  1. package/bin/rex.js +33 -2
  2. package/package.json +5 -5
package/bin/rex.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
 
4
- const { execFileSync } = require("child_process");
4
+ const { execFileSync, execSync } = require("child_process");
5
5
  const path = require("path");
6
6
 
7
7
  const PLATFORM_PACKAGES = {
@@ -47,13 +47,44 @@ function getBinaryPath() {
47
47
  }
48
48
  }
49
49
 
50
+ function isRexGloballyInstalled() {
51
+ try {
52
+ execSync("rex --version", { stdio: "ignore" });
53
+ return true;
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
58
+
50
59
  const binary = getBinaryPath();
60
+ const args = process.argv.slice(2);
61
+ const isInit = args[0] === "init";
51
62
 
52
63
  try {
53
- execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
64
+ execFileSync(binary, args, { stdio: "inherit" });
54
65
  } catch (e) {
55
66
  if (e.status !== null) {
56
67
  process.exit(e.status);
57
68
  }
58
69
  throw e;
59
70
  }
71
+
72
+ // After init, install rex globally if not already available so `rex dev` works
73
+ if (isInit && !isRexGloballyInstalled()) {
74
+ const dim = (s) => `\x1b[2m${s}\x1b[0m`;
75
+ const greenBold = (s) => `\x1b[1;32m${s}\x1b[0m`;
76
+
77
+ process.stderr.write(` Installing rex globally...\n\n`);
78
+ try {
79
+ execSync("npm install -g @limlabs/rex", {
80
+ stdio: ["ignore", "ignore", "inherit"],
81
+ });
82
+ process.stderr.write(
83
+ ` ${greenBold("✓")} ${greenBold("Rex installed globally")}\n\n`
84
+ );
85
+ } catch {
86
+ process.stderr.write(
87
+ ` ${dim("Could not install rex globally. Run 'npm install -g @limlabs/rex' manually.")}\n\n`
88
+ );
89
+ }
90
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limlabs/rex",
3
- "version": "0.15.2",
3
+ "version": "0.16.0-beta.497",
4
4
  "description": "Rex - Next.js Pages Router reimplemented in Rust",
5
5
  "bin": {
6
6
  "rex": "bin/rex.js"
@@ -56,10 +56,10 @@
56
56
  },
57
57
  "dependencies": {},
58
58
  "optionalDependencies": {
59
- "@limlabs/rex-darwin-arm64": "0.15.2",
60
- "@limlabs/rex-darwin-x64": "0.15.2",
61
- "@limlabs/rex-linux-x64": "0.15.2",
62
- "@limlabs/rex-linux-arm64": "0.15.2"
59
+ "@limlabs/rex-darwin-arm64": "0.16.0-beta.497",
60
+ "@limlabs/rex-darwin-x64": "0.16.0-beta.497",
61
+ "@limlabs/rex-linux-x64": "0.16.0-beta.497",
62
+ "@limlabs/rex-linux-arm64": "0.16.0-beta.497"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "react": "^18.0.0 || ^19.0.0",