@rebasepro/cli 0.11.1-canary.gfd39654 → 0.12.1-canary.g009ed95
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/bin/rebase.js +48 -1
- package/dist/bundle.d.ts +60 -7
- package/dist/commands/cloud/context.d.ts +53 -0
- package/dist/commands/cloud/deploy.d.ts +64 -0
- package/dist/commands/cloud/index.d.ts +23 -0
- package/dist/commands/dev.d.ts +16 -0
- package/dist/commands/eject.d.ts +1 -0
- package/dist/commands/init.d.ts +19 -15
- package/dist/fold-static.d.ts +41 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1262 -285
- package/dist/index.es.js.map +1 -1
- package/dist/manifest.d.ts +27 -8
- package/package.json +11 -11
- package/runtime/dev-server.mjs +0 -1
- package/templates/{template/backend → eject}/Dockerfile +16 -4
- package/templates/{template → eject}/backend/src/env.ts +0 -1
- package/templates/{template → eject}/backend/src/index.ts +41 -27
- package/templates/eject/docker-compose.custom.yml +71 -0
- package/templates/overlays/baas/backend/package.json +3 -6
- package/templates/overlays/baas/backend/tsconfig.json +8 -2
- package/templates/overlays/baas/config/index.ts +15 -0
- package/templates/overlays/baas/config/package.json +28 -0
- package/templates/overlays/baas/package.json +3 -3
- package/templates/overlays/baas/pnpm-workspace.yaml +1 -0
- package/templates/overlays/baas/rebase.json +2 -6
- package/templates/template/.env.example +15 -0
- package/templates/template/README.md +56 -22
- package/templates/template/ai-instructions.md +1 -0
- package/templates/template/backend/functions/hello.ts +45 -14
- package/templates/template/backend/package.json +3 -6
- package/templates/template/backend/tsconfig.json +23 -2
- package/templates/template/config/collections/index.ts +9 -1
- package/templates/template/config/tsconfig.json +16 -1
- package/templates/template/docker-compose.yml +62 -38
- package/templates/template/frontend/package.json +3 -3
- package/templates/template/frontend/src/App.tsx +2 -1
- package/templates/template/frontend/src/main.tsx +10 -2
- package/templates/template/frontend/vite.config.ts +5 -1
- package/templates/template/package.json +1 -2
- package/templates/template/rebase.json +5 -8
- package/templates/overlays/baas/backend/src/index.ts +0 -216
- package/templates/template/frontend/Dockerfile +0 -52
- package/templates/template/frontend/nginx.conf +0 -40
- /package/templates/overlays/baas/{backend/src → config}/storage.ts +0 -0
package/bin/rebase.js
CHANGED
|
@@ -65,6 +65,53 @@ try {
|
|
|
65
65
|
/* ignore */
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* `dist/` is gitignored, so in a fresh clone it does not exist until someone
|
|
70
|
+
* runs a build — and `rebase` is reached long before that: CONTRIBUTING's
|
|
71
|
+
* getting-started steps call `db push` and `dev` through it. Importing a
|
|
72
|
+
* missing module raises a bare ERR_MODULE_NOT_FOUND stack trace naming an
|
|
73
|
+
* internal path, which reads as a broken repository rather than a missing step.
|
|
74
|
+
*
|
|
75
|
+
* stderr, like the staleness warning above, so `--json` output stays parseable.
|
|
76
|
+
*/
|
|
77
|
+
if (!existsSync(distEntry)) {
|
|
78
|
+
const dev = existsSync(srcDir);
|
|
79
|
+
process.stderr.write(
|
|
80
|
+
`\x1b[31m✗ rebase CLI: not built yet — ${distEntry} is missing.\x1b[0m\n` +
|
|
81
|
+
(dev
|
|
82
|
+
? " Build it with: pnpm --filter @rebasepro/cli build\n" +
|
|
83
|
+
" (or `pnpm build` from the repo root to build every package)\n"
|
|
84
|
+
: " This install looks incomplete; try reinstalling @rebasepro/cli.\n")
|
|
85
|
+
);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
68
89
|
const { entry } = await import("../dist/index.es.js");
|
|
69
90
|
|
|
70
|
-
|
|
91
|
+
/**
|
|
92
|
+
* The CLI's last line of defence.
|
|
93
|
+
*
|
|
94
|
+
* `entry()` returns a promise and nothing was awaiting it, so anything a
|
|
95
|
+
* command threw surfaced as an unhandled rejection: Node's own stack trace,
|
|
96
|
+
* rooted in `dist/index.es.js`, with the CLI's bundled line numbers and no
|
|
97
|
+
* exit code of its own. "Collections directory not found" is a sentence a
|
|
98
|
+
* developer can act on; the same sentence under ten frames of bundle internals
|
|
99
|
+
* reads as a crash in Rebase.
|
|
100
|
+
*
|
|
101
|
+
* The message is the error's own — commands that already print something
|
|
102
|
+
* friendly and exit never reach here. The stack is available behind
|
|
103
|
+
* `--debug`/`REBASE_DEBUG`, because when the message is *not* enough that is
|
|
104
|
+
* the only thing that helps.
|
|
105
|
+
*/
|
|
106
|
+
const wantsStack = process.argv.includes("--debug") || process.env.REBASE_DEBUG === "1";
|
|
107
|
+
|
|
108
|
+
entry(process.argv).catch((error) => {
|
|
109
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
110
|
+
process.stderr.write(`\x1b[31m✗ ${message}\x1b[0m\n`);
|
|
111
|
+
if (wantsStack && error instanceof Error && error.stack) {
|
|
112
|
+
process.stderr.write(`\n${error.stack}\n`);
|
|
113
|
+
} else {
|
|
114
|
+
process.stderr.write("\x1b[90m Re-run with --debug for the stack trace.\x1b[0m\n");
|
|
115
|
+
}
|
|
116
|
+
process.exit(1);
|
|
117
|
+
});
|
package/dist/bundle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type NativeDependency, type RebaseBundleManifest, type RebaseBackendAppConfig } from "@rebasepro/types";
|
|
1
|
+
import { type DeclaredStorageSources, type NativeDependency, type RebaseBundleManifest, type RebaseBackendAppConfig } from "@rebasepro/types";
|
|
2
2
|
export declare const DEFAULT_BUNDLE_DIR = "dist-bundle";
|
|
3
3
|
export interface BuildBundleOptions {
|
|
4
4
|
projectRoot: string;
|
|
@@ -8,6 +8,13 @@ export interface BuildBundleOptions {
|
|
|
8
8
|
outDir?: string;
|
|
9
9
|
/** Runtime range from the manifest, recorded for compatibility checks. */
|
|
10
10
|
runtimeRange: string;
|
|
11
|
+
/**
|
|
12
|
+
* The `storage` block of `rebase.json` — which buckets this project uses.
|
|
13
|
+
*
|
|
14
|
+
* Passed in rather than re-read here so `rebase.json` is parsed and validated
|
|
15
|
+
* once, by the command that owns it.
|
|
16
|
+
*/
|
|
17
|
+
storage?: DeclaredStorageSources;
|
|
11
18
|
/** Skip type checking. Faster, and strictly worse — for iteration only. */
|
|
12
19
|
skipTypeCheck?: boolean;
|
|
13
20
|
/** Skip regenerating the Drizzle schema from the collections. */
|
|
@@ -37,7 +44,7 @@ export interface BuildBundleResult {
|
|
|
37
44
|
* says exactly how to proceed, while a false positive would hand back the crash
|
|
38
45
|
* loop this exists to prevent.
|
|
39
46
|
*/
|
|
40
|
-
export declare function detectStorageAuthorize(compiledConfigDir: string): boolean;
|
|
47
|
+
export declare function detectStorageAuthorize(compiledConfigDir: string, depth?: number): boolean;
|
|
41
48
|
/**
|
|
42
49
|
* Detect native code in the dependency closure.
|
|
43
50
|
*
|
|
@@ -61,6 +68,41 @@ export declare function detectNativeDependencies(projectRoot: string, declared:
|
|
|
61
68
|
* own config package already travels inside the bundle.
|
|
62
69
|
*/
|
|
63
70
|
export declare function collectDeclaredDependencies(projectRoot: string): Record<string, string>;
|
|
71
|
+
/** One `@rebasepro/*` dependency as some package.json in the project declares it. */
|
|
72
|
+
export interface DeclaredFrameworkDep {
|
|
73
|
+
name: string;
|
|
74
|
+
range: string;
|
|
75
|
+
/** Project-relative package.json it was declared in. */
|
|
76
|
+
file: string;
|
|
77
|
+
}
|
|
78
|
+
export interface FrameworkDepDrift {
|
|
79
|
+
/** Declared at a version that can never reach the CLI's own. */
|
|
80
|
+
behind: DeclaredFrameworkDep[];
|
|
81
|
+
/**
|
|
82
|
+
* The distinct lower bounds found across all declared `@rebasepro/*`, when
|
|
83
|
+
* there is more than one — the project is pinning mixed-era framework
|
|
84
|
+
* packages against each other.
|
|
85
|
+
*/
|
|
86
|
+
disagreeing: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Find `@rebasepro/*` dependencies pinned to a version older than this CLI.
|
|
90
|
+
*
|
|
91
|
+
* This is the only place a developer can be told. In development, every
|
|
92
|
+
* `@rebasepro/*` resolves through pnpm's `link:`/`workspace:` overrides to the
|
|
93
|
+
* checkout, so the version STRINGS in package.json are never exercised — the
|
|
94
|
+
* project runs fine locally on whatever is on disk, and the declared numbers are
|
|
95
|
+
* first honoured when the runtime npm-installs them from a bundle in the cloud.
|
|
96
|
+
* A project scaffolded at 0.10.0 therefore keeps working on a developer's
|
|
97
|
+
* machine indefinitely while being, in the cloud, a 0.10.0 driver.
|
|
98
|
+
*
|
|
99
|
+
* That matters because the image supplies only `@rebasepro/server`; the database
|
|
100
|
+
* driver comes from these declarations and a newer runtime never updates it.
|
|
101
|
+
* Every package.json is scanned, `dependencies` and `devDependencies` both,
|
|
102
|
+
* because they have to be bumped together and the one that gets forgotten is the
|
|
103
|
+
* one nobody looks at.
|
|
104
|
+
*/
|
|
105
|
+
export declare function detectFrameworkDepDrift(projectRoot: string, cliVersion: string): FrameworkDepDrift;
|
|
64
106
|
/**
|
|
65
107
|
* Rewrite relative import specifiers in emitted JavaScript so Node can resolve them.
|
|
66
108
|
*
|
|
@@ -94,11 +136,10 @@ export declare function normalizeEsmSpecifiers(outDir: string): {
|
|
|
94
136
|
* deployed green, and answered 404 on every one of them, with the file still
|
|
95
137
|
* sitting in the repository looking exactly like the server.
|
|
96
138
|
*
|
|
97
|
-
* A project that means to keep its own entrypoint
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* a mistake.
|
|
139
|
+
* A project that means to keep its own entrypoint runs `rebase eject`, which
|
|
140
|
+
* writes the entrypoint, a Dockerfile and a compose file together and flips the
|
|
141
|
+
* backend to `runtime: "custom"`. The warning names that route rather than
|
|
142
|
+
* implying the file is a mistake.
|
|
102
143
|
*/
|
|
103
144
|
export declare function findUnusedServerEntry(projectRoot: string, functionsDir: string): string | undefined;
|
|
104
145
|
/**
|
|
@@ -151,8 +192,15 @@ export declare function foldStaticIntoBundle(options: {
|
|
|
151
192
|
bundleDir: string;
|
|
152
193
|
/** Directory of built frontend assets (the static app's `output`). */
|
|
153
194
|
assetsDir: string;
|
|
195
|
+
/** The app's name in `rebase.json`. Names its directory inside the bundle. */
|
|
196
|
+
appName: string;
|
|
197
|
+
/** Public base path this app is served under. */
|
|
198
|
+
path: string;
|
|
199
|
+
/** Serve `index.html` for unmatched paths under `path`. */
|
|
200
|
+
spa: boolean;
|
|
154
201
|
}): {
|
|
155
202
|
fileCount: number;
|
|
203
|
+
dir: string;
|
|
156
204
|
};
|
|
157
205
|
export declare function buildStaticBundle(options: {
|
|
158
206
|
projectRoot: string;
|
|
@@ -160,8 +208,13 @@ export declare function buildStaticBundle(options: {
|
|
|
160
208
|
assetsDir: string;
|
|
161
209
|
outDir: string;
|
|
162
210
|
runtimeRange: string;
|
|
211
|
+
/** Public base path. Default `/` — a standalone bundle owns its origin. */
|
|
212
|
+
path?: string;
|
|
213
|
+
/** Serve `index.html` for unmatched paths. Default `true`. */
|
|
214
|
+
spa?: boolean;
|
|
163
215
|
}): {
|
|
164
216
|
outDir: string;
|
|
165
217
|
manifest: RebaseBundleManifest;
|
|
166
218
|
fileCount: number;
|
|
167
219
|
};
|
|
220
|
+
export declare function resolveCliVersion(): string;
|
|
@@ -84,6 +84,39 @@ export interface ProjectLink {
|
|
|
84
84
|
export declare function readLink(cwd?: string): ProjectLink | null;
|
|
85
85
|
export declare function writeLink(link: ProjectLink, cwd?: string): void;
|
|
86
86
|
export declare function removeLink(cwd?: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Flags that may appear anywhere on a `rebase cloud` line, including *before*
|
|
89
|
+
* the resource group.
|
|
90
|
+
*
|
|
91
|
+
* They have to be declared wherever positionals are resolved, because `arg`'s
|
|
92
|
+
* `permissive: true` does not merely tolerate an undeclared flag — it pushes it
|
|
93
|
+
* into `_` alongside the positionals, and for a flag that takes a value it
|
|
94
|
+
* pushes the value in too. So `cloud --project acme storage create` parsed
|
|
95
|
+
* without this spec yields `_` of `["--project", "acme", "storage", "create"]`,
|
|
96
|
+
* and the group reads as `"acme"`: a real project name, in the group position,
|
|
97
|
+
* dispatching to nothing. Skipping tokens that start with `-` does not save you
|
|
98
|
+
* there — the damage is the orphaned value, which looks exactly like a
|
|
99
|
+
* positional.
|
|
100
|
+
*
|
|
101
|
+
* Only genuinely global flags belong here. Group-specific ones (`--bucket`,
|
|
102
|
+
* `--region`, …) are declared by the handler that owns them and always follow
|
|
103
|
+
* the group, so they cannot shift the group or action.
|
|
104
|
+
*
|
|
105
|
+
* `-p` is `--project` in eighteen places and `--password` in `login`. That
|
|
106
|
+
* ambiguity does not matter to the one caller that reads this spec: it resolves
|
|
107
|
+
* positionals and never looks at a flag's value, so all it needs to know is
|
|
108
|
+
* that `-p` takes one. Anything that wants the value must keep declaring it
|
|
109
|
+
* itself, with the meaning its own command gives it.
|
|
110
|
+
*/
|
|
111
|
+
export declare const GLOBAL_CLOUD_FLAGS: {
|
|
112
|
+
readonly "--json": BooleanConstructor;
|
|
113
|
+
readonly "--yes": BooleanConstructor;
|
|
114
|
+
readonly "--help": BooleanConstructor;
|
|
115
|
+
readonly "--project": StringConstructor;
|
|
116
|
+
readonly "-p": "--project";
|
|
117
|
+
readonly "-y": "--yes";
|
|
118
|
+
readonly "-h": "--help";
|
|
119
|
+
};
|
|
87
120
|
/**
|
|
88
121
|
* The raw project reference to operate on: explicit `--project` flag wins,
|
|
89
122
|
* otherwise the linked project. Exits with guidance when neither is present.
|
|
@@ -134,6 +167,26 @@ export declare function printJson(value: unknown): void;
|
|
|
134
167
|
* call is what guarantees a command can never print a table AND a JSON blob.
|
|
135
168
|
*/
|
|
136
169
|
export declare function emit(human: () => void, json: unknown): void;
|
|
170
|
+
/**
|
|
171
|
+
* Print a warning (+ optional hint) — in every output mode, always to stderr.
|
|
172
|
+
*
|
|
173
|
+
* `emit` is for a command's *result*, and JSON mode legitimately replaces the
|
|
174
|
+
* human rendering of one. A warning is not a result: it says the command is
|
|
175
|
+
* about to do something the caller may not have meant, and that is exactly as
|
|
176
|
+
* true when the output is piped. Gating one on `!isJsonMode()` deleted it
|
|
177
|
+
* precisely where nobody was watching the terminal — a `--source` deploy ejected
|
|
178
|
+
* a live project off the managed runtime and said so only to a TTY that wasn't
|
|
179
|
+
* there.
|
|
180
|
+
*
|
|
181
|
+
* stdout carries the JSON value and nothing else, so warnings go to stderr:
|
|
182
|
+
* a machine parser reading stdout cannot be corrupted by one. Only the
|
|
183
|
+
* *formatting* may depend on the mode — colour and indentation for a terminal,
|
|
184
|
+
* plain ASCII otherwise. Whether a warning is emitted at all may not.
|
|
185
|
+
*
|
|
186
|
+
* Anything a caller might branch on belongs in the JSON payload as well; stderr
|
|
187
|
+
* is for whoever reads the transcript afterwards.
|
|
188
|
+
*/
|
|
189
|
+
export declare function warn(message: string, hint?: string): void;
|
|
137
190
|
/** Print an error (+ optional hint) and exit non-zero. Never returns. */
|
|
138
191
|
export declare function fail(message: string, hint?: string, code?: string): never;
|
|
139
192
|
/**
|
|
@@ -46,5 +46,69 @@ export declare function timeAgo(value: string | Date | undefined, now: Date): st
|
|
|
46
46
|
export declare function isManagedProject(project: DeployProjectRow | undefined, latest: DeploySourceRow | undefined): boolean;
|
|
47
47
|
/** What a `deploy` with nothing attached will build, in the words to print. */
|
|
48
48
|
export declare function planBareDeploy(project: DeployProjectRow | undefined, latest: DeploySourceRow | undefined, now: Date): BareDeployPlan;
|
|
49
|
+
/**
|
|
50
|
+
* A warning attached to a deploy: printed for the human, carried in the JSON.
|
|
51
|
+
*
|
|
52
|
+
* `code` is the stable half — the message is prose and will be reworded, so it
|
|
53
|
+
* is the code that CI or an agent branches on.
|
|
54
|
+
*/
|
|
55
|
+
export interface DeployWarning {
|
|
56
|
+
code: string;
|
|
57
|
+
message: string;
|
|
58
|
+
hint?: string;
|
|
59
|
+
}
|
|
60
|
+
/** `code` of the warning below, and the field name it sets in the payload. */
|
|
61
|
+
export declare const EJECTS_MANAGED_RUNTIME = "ejects_managed_runtime";
|
|
62
|
+
/** The one sentence that says a source build undoes `runtimeMode: managed`. */
|
|
63
|
+
export declare function ejectWarning(projectRef: string): DeployWarning;
|
|
64
|
+
/** How a container-image deploy was asked for — the input to both rules below. */
|
|
65
|
+
export interface EjectContext {
|
|
66
|
+
/** The project currently runs on the managed runtime. */
|
|
67
|
+
managed: boolean;
|
|
68
|
+
/** `--source` was passed: build this directory. */
|
|
69
|
+
source: boolean;
|
|
70
|
+
/** `--force` was passed: eject on purpose. */
|
|
71
|
+
force: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Why a container-image deploy of a managed project is refused — or `undefined`
|
|
75
|
+
* to let it through.
|
|
76
|
+
*
|
|
77
|
+
* Every path below this point builds a container image, and a successful one
|
|
78
|
+
* sets `runtimeMode: "custom"` server-side. So the question is never "which flag
|
|
79
|
+
* was used" but "did the caller ask to leave the managed runtime", and only
|
|
80
|
+
* `--force` answers it.
|
|
81
|
+
*
|
|
82
|
+
* `--source` used to be read as answering it too, on the theory that uploading a
|
|
83
|
+
* build context is self-evidently a deliberate eject. It is not: `--source`
|
|
84
|
+
* picks *which source* gets built — this directory, rather than the stale
|
|
85
|
+
* archive the control plane is holding — and the eject is a side effect of the
|
|
86
|
+
* answer. That is exactly how a live project got flipped to `custom` by someone
|
|
87
|
+
* whose actual intent was "deploy what I have here", and it is the same
|
|
88
|
+
* ignorance the bare form is refused for. Same ignorance, same refusal.
|
|
89
|
+
*/
|
|
90
|
+
export declare function ejectRefusal(opts: EjectContext, projectRef: string): {
|
|
91
|
+
message: string;
|
|
92
|
+
hint: string;
|
|
93
|
+
code: string;
|
|
94
|
+
} | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Which warnings a container-image deploy has earned.
|
|
97
|
+
*
|
|
98
|
+
* Pure, and separate from the printing, because the printing is what went
|
|
99
|
+
* wrong: the eject warning used to be written inline behind `!isJsonMode()`, so
|
|
100
|
+
* the fact that a deploy ejects a managed project existed only as a side effect
|
|
101
|
+
* of a TTY being attached. Deciding here, emitting once at the call site, means
|
|
102
|
+
* the decision cannot be output-mode-dependent again.
|
|
103
|
+
*
|
|
104
|
+
* The condition is just `managed`: anything reaching this point is a container
|
|
105
|
+
* image build that `ejectRefusal` has already let through, and on a managed
|
|
106
|
+
* project that is an eject however it was spelled. A caller who passed `--force`
|
|
107
|
+
* knows — the warning is for the transcript and the payload, which is what
|
|
108
|
+
* anyone reviewing the deploy afterwards actually reads.
|
|
109
|
+
*/
|
|
110
|
+
export declare function deployWarnings(opts: EjectContext, projectRef: string): DeployWarning[];
|
|
111
|
+
/** The warning half of a deploy's JSON payload — merged into whatever it emits. */
|
|
112
|
+
export declare function warningPayload(warnings: DeployWarning[]): Record<string, unknown>;
|
|
49
113
|
export declare function deployCommand(rawArgs: string[], projectRef: string): Promise<void>;
|
|
50
114
|
export declare function logsCommand(rawArgs: string[], projectRef: string): Promise<void>;
|
|
@@ -1 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Positional tokens after `rebase cloud` (group, action, …).
|
|
3
|
+
*
|
|
4
|
+
* Two things stop a flag being mistaken for the group. `GLOBAL_CLOUD_FLAGS` is
|
|
5
|
+
* declared so `arg` *consumes* the flags that may precede it — critically
|
|
6
|
+
* together with their values, which is the half that filtering cannot do. The
|
|
7
|
+
* leading-`-` skip then covers a flag nobody declared, so an unrecognised
|
|
8
|
+
* boolean shifts nothing.
|
|
9
|
+
*
|
|
10
|
+
* Only leading tokens are skipped: past the group and action, an undeclared
|
|
11
|
+
* flag and its value are somebody else's positionals and none of our business.
|
|
12
|
+
* A flag this file has never heard of, that takes a value, placed before the
|
|
13
|
+
* group, is the one shape still unresolvable here — there is no way to know
|
|
14
|
+
* whether the token after it is its value or the group, and guessing either way
|
|
15
|
+
* is worse than the handler reporting an unknown group.
|
|
16
|
+
*
|
|
17
|
+
* Exported so its tests can drive the real thing. The dispatch test used to
|
|
18
|
+
* re-implement it locally as `slice(3).filter(a => !a.startsWith("-"))` — which
|
|
19
|
+
* filtered flags, while this function did not — so the test asserted the
|
|
20
|
+
* behaviour we wanted against a copy that had it, and stayed green for as long
|
|
21
|
+
* as the real dispatcher was broken.
|
|
22
|
+
*/
|
|
23
|
+
export declare function positionals(rawArgs: string[]): string[];
|
|
1
24
|
export declare function cloudCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
+
/** Well-known filename the backend writes its actual port to. */
|
|
2
|
+
export declare const DEV_PORT_FILENAME = ".rebase-dev-port";
|
|
3
|
+
/**
|
|
4
|
+
* Compute a deterministic port from the project root path.
|
|
5
|
+
* Range: 3001–3999 (avoids privileged ports and common services).
|
|
6
|
+
* Two different project directories will almost always get different ports.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getProjectPort(projectRoot: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the best starting port for this project:
|
|
11
|
+
* 1. Explicit --port flag (highest priority)
|
|
12
|
+
* 2. PORT env var
|
|
13
|
+
* 3. Previously used port from .rebase-dev-port (port affinity across restarts)
|
|
14
|
+
* 4. Deterministic hash from project path (unique per project)
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveStartPort(projectRoot: string, explicitPort?: number): number;
|
|
1
17
|
export declare function devCommand(rawArgs: string[]): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ejectCommand(rawArgs?: string[]): Promise<void>;
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import type { PackageManager, PMCommands } from "../utils/package-manager";
|
|
2
|
-
/** Returns an error message, or null when the name is a valid package name. */
|
|
3
|
-
export declare function validateProjectName(name: string): string | null;
|
|
4
|
-
export type TemplatePreset = "blog" | "ecommerce" | "blank";
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
3
|
+
* Every scaffolded file that carries a `{{PLACEHOLDER}}`.
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
5
|
+
* Exported because it is the single source of truth: `init.test.ts` reads it and
|
|
6
|
+
* asserts that every template file containing `{{` appears here. It used to be a
|
|
7
|
+
* local, with the test harness keeping a *second* copy — so the two drifted, and
|
|
8
|
+
* a test built on the copy could not observe the production list at all.
|
|
9
|
+
*
|
|
10
|
+
* The drift shipped: `docker-compose.yml` arrived with the self-host work
|
|
11
|
+
* (26fd5259c) and was added to neither, so every scaffolded project got a literal
|
|
12
|
+
* `name: {{PROJECT_NAME}}`. In YAML `{{...}}` is a map, not a string, so the
|
|
13
|
+
* documented `docker compose up` path failed on the file before doing anything:
|
|
14
|
+
*
|
|
15
|
+
* yaml: unmarshal errors: line 28: cannot unmarshal !!map into string
|
|
15
16
|
*/
|
|
16
|
-
export
|
|
17
|
+
export declare const TEMPLATE_PLACEHOLDER_FILES: string[];
|
|
18
|
+
/** Returns an error message, or null when the name is a valid package name. */
|
|
19
|
+
export declare function validateProjectName(name: string): string | null;
|
|
20
|
+
export type TemplatePreset = "blog" | "ecommerce" | "blank";
|
|
17
21
|
export interface InitOptions {
|
|
18
22
|
projectName: string;
|
|
19
23
|
git: boolean;
|
|
@@ -26,8 +30,8 @@ export interface InitOptions {
|
|
|
26
30
|
preset: TemplatePreset;
|
|
27
31
|
/** Whether `preset` came from an explicit --template rather than the default. */
|
|
28
32
|
explicitPreset?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
|
|
33
|
+
/** Scaffold the backend alone, with no admin panel and no collections. */
|
|
34
|
+
headless: boolean;
|
|
31
35
|
/** Detected package manager (pnpm or npm). */
|
|
32
36
|
pm: PackageManager;
|
|
33
37
|
/** Command helpers for the detected PM. */
|
|
@@ -42,7 +46,7 @@ export interface InitOptions {
|
|
|
42
46
|
export interface BuildQuestionsParams {
|
|
43
47
|
nameArg?: string;
|
|
44
48
|
templateArg?: TemplatePreset;
|
|
45
|
-
|
|
49
|
+
headlessArg?: boolean;
|
|
46
50
|
hasGitFlag: boolean;
|
|
47
51
|
hasInstallFlag: boolean;
|
|
48
52
|
pm: PackageManager;
|
package/dist/fold-static.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface FoldableManifest {
|
|
|
4
4
|
type?: string;
|
|
5
5
|
build?: string;
|
|
6
6
|
output?: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
spa?: boolean;
|
|
7
9
|
}>;
|
|
8
10
|
}
|
|
9
11
|
export interface FoldOptions {
|
|
@@ -11,36 +13,60 @@ export interface FoldOptions {
|
|
|
11
13
|
manifest: FoldableManifest;
|
|
12
14
|
/** The backend bundle directory, already written. */
|
|
13
15
|
bundleDir: string;
|
|
14
|
-
/** Skip running
|
|
16
|
+
/** Skip running each app's own build command; fold what is already built. */
|
|
15
17
|
skipBuild?: boolean;
|
|
16
18
|
log?: (message: string) => void;
|
|
17
19
|
}
|
|
18
20
|
export interface FoldOutcome {
|
|
19
21
|
appName: string;
|
|
20
22
|
fileCount: number;
|
|
23
|
+
/** Public base path this app was folded in at. */
|
|
24
|
+
path: string;
|
|
25
|
+
}
|
|
26
|
+
/** A static app as folding sees it, with the manifest's defaults applied. */
|
|
27
|
+
export interface FoldableApp {
|
|
28
|
+
name: string;
|
|
29
|
+
build?: string;
|
|
30
|
+
output?: string;
|
|
31
|
+
/** Public base path, defaulted to `/`. */
|
|
32
|
+
path: string;
|
|
33
|
+
/** SPA fallback, defaulted to `true`. */
|
|
34
|
+
spa: boolean;
|
|
21
35
|
}
|
|
22
36
|
/**
|
|
23
|
-
*
|
|
37
|
+
* Every static app in the manifest, in mount order.
|
|
24
38
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* filesystem.
|
|
39
|
+
* Longest path first, so the `/`-rooted app is registered last — its catch-all
|
|
40
|
+
* would otherwise claim its siblings' URLs. Pure, so the ordering is testable
|
|
41
|
+
* without a filesystem.
|
|
29
42
|
*/
|
|
30
|
-
export declare function
|
|
31
|
-
|
|
43
|
+
export declare function foldableApps(manifest: FoldableManifest): {
|
|
44
|
+
apps: FoldableApp[];
|
|
45
|
+
/** Apps that cannot be folded, and why. */
|
|
46
|
+
skipped: {
|
|
32
47
|
name: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
/** Why nothing will be folded, when that is the answer. */
|
|
37
|
-
reason?: string;
|
|
48
|
+
reason: string;
|
|
49
|
+
}[];
|
|
38
50
|
};
|
|
39
51
|
/**
|
|
40
|
-
*
|
|
52
|
+
* Assert a built app's assets are actually rooted at the path it is served from.
|
|
53
|
+
*
|
|
54
|
+
* An app mounted at `/admin` but built with Vite's default `base: "/"` emits
|
|
55
|
+
* `<script src="/assets/index-a1b2.js">`. The server serves `index.html` fine
|
|
56
|
+
* and 404s every asset: a blank page, no server error, nothing in the logs. It
|
|
57
|
+
* is the single most expensive silent failure in this design, so it is a build
|
|
58
|
+
* error rather than a runtime surprise.
|
|
59
|
+
*
|
|
60
|
+
* Only `<script src>` and `<link href>` are inspected — those are what a bundler
|
|
61
|
+
* rewrites through `base`. Author-written anchors and canonical URLs are not
|
|
62
|
+
* evidence of a misbuild.
|
|
63
|
+
*/
|
|
64
|
+
export declare function assertBuiltForPath(indexHtml: string, basePath: string, appName: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Build the project's static apps and fold them into the backend bundle.
|
|
41
67
|
*
|
|
42
68
|
* Throws rather than exiting, so the caller decides whether a missing frontend
|
|
43
69
|
* should fail its command — a `build` may reasonably want to stop, and so should
|
|
44
70
|
* a deploy, but that is not this function's call to make.
|
|
45
71
|
*/
|
|
46
|
-
export declare function foldFrontendIntoBundle(options: FoldOptions): Promise<FoldOutcome
|
|
72
|
+
export declare function foldFrontendIntoBundle(options: FoldOptions): Promise<FoldOutcome[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./commands/schema";
|
|
|
4
4
|
export * from "./commands/db";
|
|
5
5
|
export * from "./commands/dev";
|
|
6
6
|
export * from "./commands/build";
|
|
7
|
+
export * from "./commands/eject";
|
|
7
8
|
export * from "./commands/start";
|
|
8
9
|
export * from "./commands/auth";
|
|
9
10
|
export * from "./commands/doctor";
|