@rebasepro/cli 0.9.1-canary.e2fc7b6 → 0.9.1-canary.eab7ae2
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/index.es.js +38 -20
- package/dist/index.es.js.map +1 -1
- package/dist/utils/package-manager.d.ts +19 -5
- package/package.json +7 -7
- package/templates/overlays/baas/backend/package.json +1 -1
- package/templates/overlays/baas/backend/tsconfig.json +2 -1
- package/templates/template/backend/src/env.ts +30 -1
|
@@ -20,13 +20,27 @@ export interface PMCommands {
|
|
|
20
20
|
workspaceProtocol: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Whether pnpm is runnable on this machine.
|
|
24
|
+
*
|
|
25
|
+
* Used to decide whether a fresh project can be scaffolded with pnpm. Kept
|
|
26
|
+
* cheap and non-interactive (short timeout, output discarded) so it never
|
|
27
|
+
* hangs detection if a corepack shim misbehaves.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isPnpmAvailable(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Detect the package manager for a Rebase project.
|
|
32
|
+
*
|
|
33
|
+
* Rebase recommends pnpm, so detection prefers it. Crucially, *how the CLI was
|
|
34
|
+
* invoked* (`npx` vs `pnpm dlx`, i.e. `npm_config_user_agent`) is deliberately
|
|
35
|
+
* ignored: running `npx @rebasepro/cli init` says nothing about how the user
|
|
36
|
+
* wants to manage the project they're creating, and letting it pin the scaffold
|
|
37
|
+
* to npm is what made every `npx`-invoked project an npm project.
|
|
24
38
|
*
|
|
25
39
|
* Detection order:
|
|
26
|
-
* 1.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
40
|
+
* 1. An existing lock file — an explicit choice we always respect
|
|
41
|
+
* (`pnpm-lock.yaml` wins over `package-lock.json` when both are present).
|
|
42
|
+
* 2. pnpm, whenever it is installed.
|
|
43
|
+
* 3. npm, only as a fallback when pnpm is genuinely unavailable.
|
|
30
44
|
*/
|
|
31
45
|
export declare function detectPackageManager(targetDir?: string): PackageManager;
|
|
32
46
|
/** Build the command helpers for a given package manager. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/cli",
|
|
3
|
-
"version": "0.9.1-canary.
|
|
3
|
+
"version": "0.9.1-canary.eab7ae2",
|
|
4
4
|
"description": "Developer tools for Rebase projects",
|
|
5
5
|
"main": "./dist/index.es.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"execa": "^9.6.1",
|
|
32
32
|
"inquirer": "14.0.2",
|
|
33
33
|
"jiti": "^2.7.0",
|
|
34
|
-
"@rebasepro/agent-skills": "0.9.1-canary.
|
|
35
|
-
"@rebasepro/
|
|
36
|
-
"@rebasepro/server": "0.9.1-canary.
|
|
37
|
-
"@rebasepro/server-postgres": "0.9.1-canary.
|
|
38
|
-
"@rebasepro/
|
|
39
|
-
"@rebasepro/types": "0.9.1-canary.
|
|
34
|
+
"@rebasepro/agent-skills": "0.9.1-canary.eab7ae2",
|
|
35
|
+
"@rebasepro/codegen": "0.9.1-canary.eab7ae2",
|
|
36
|
+
"@rebasepro/server": "0.9.1-canary.eab7ae2",
|
|
37
|
+
"@rebasepro/server-postgres": "0.9.1-canary.eab7ae2",
|
|
38
|
+
"@rebasepro/client": "0.9.1-canary.eab7ae2",
|
|
39
|
+
"@rebasepro/types": "0.9.1-canary.eab7ae2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^25.9.3",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"moduleResolution": "node",
|
|
6
6
|
"lib": ["ES2022"],
|
|
7
7
|
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
8
9
|
"strict": true,
|
|
9
10
|
"esModuleInterop": true,
|
|
10
11
|
"allowSyntheticDefaultImports": true,
|
|
@@ -14,5 +15,5 @@
|
|
|
14
15
|
"declaration": true,
|
|
15
16
|
"sourceMap": true
|
|
16
17
|
},
|
|
17
|
-
"include": ["src/**/*"
|
|
18
|
+
"include": ["src/**/*"]
|
|
18
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as dotenv from "dotenv";
|
|
2
|
+
import fs from "fs";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import { fileURLToPath } from "url";
|
|
4
5
|
import { loadEnv } from "@rebasepro/server";
|
|
@@ -7,7 +8,35 @@ import { z } from "zod";
|
|
|
7
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
9
|
const __dirname = path.dirname(__filename);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Locate the project's `.env` by walking up the directory tree.
|
|
13
|
+
*
|
|
14
|
+
* A fixed relative path can't work in both modes: in dev this file runs from
|
|
15
|
+
* source at `backend/src/env.ts`, but the compiled output lives at
|
|
16
|
+
* `backend/dist/backend/src/env.js` — two directories deeper — so
|
|
17
|
+
* `../../.env` points at a file that doesn't exist in production. Walking up
|
|
18
|
+
* finds the root `.env` from either location.
|
|
19
|
+
*/
|
|
20
|
+
function findEnvFile(startDir: string): string | undefined {
|
|
21
|
+
let dir = startDir;
|
|
22
|
+
// eslint-disable-next-line no-constant-condition
|
|
23
|
+
while (true) {
|
|
24
|
+
const candidate = path.join(dir, ".env");
|
|
25
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
26
|
+
const parent = path.dirname(dir);
|
|
27
|
+
if (parent === dir) return undefined;
|
|
28
|
+
dir = parent;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// `rebase start` sets DOTENV_CONFIG_PATH to the project's .env; honor it first,
|
|
33
|
+
// then fall back to searching up from this file. When neither is found (e.g. a
|
|
34
|
+
// production host that injects env vars directly), skip dotenv entirely and let
|
|
35
|
+
// the real process environment flow through.
|
|
36
|
+
const envPath = process.env.DOTENV_CONFIG_PATH || findEnvFile(__dirname);
|
|
37
|
+
if (envPath && fs.existsSync(envPath)) {
|
|
38
|
+
dotenv.config({ path: envPath });
|
|
39
|
+
}
|
|
11
40
|
|
|
12
41
|
export const env = loadEnv({
|
|
13
42
|
extend: z.object({
|