@rebasepro/cli 0.11.0 → 0.11.1-canary.g8caabf3
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 +21 -0
- package/dist/bundle.d.ts +15 -5
- package/dist/commands/cloud/resources.d.ts +20 -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 +766 -241
- package/dist/index.es.js.map +1 -1
- package/dist/manifest.d.ts +26 -7
- package/package.json +7 -7
- 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/eject/docker-compose.custom.yml +71 -0
- package/templates/overlays/baas/backend/package.json +1 -4
- 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 +2 -1
- package/templates/overlays/baas/pnpm-workspace.yaml +1 -0
- package/templates/overlays/baas/rebase.json +2 -6
- package/templates/template/README.md +34 -16
- package/templates/template/backend/package.json +1 -4
- package/templates/template/docker-compose.yml +62 -38
- package/templates/template/frontend/src/main.tsx +8 -1
- package/templates/template/frontend/vite.config.ts +5 -0
- 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/{template → eject}/backend/src/index.ts +0 -0
- /package/templates/overlays/baas/{backend/src → config}/storage.ts +0 -0
package/bin/rebase.js
CHANGED
|
@@ -65,6 +65,27 @@ 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
|
entry(process.argv);
|
package/dist/bundle.d.ts
CHANGED
|
@@ -94,11 +94,10 @@ export declare function normalizeEsmSpecifiers(outDir: string): {
|
|
|
94
94
|
* deployed green, and answered 404 on every one of them, with the file still
|
|
95
95
|
* sitting in the repository looking exactly like the server.
|
|
96
96
|
*
|
|
97
|
-
* A project that means to keep its own entrypoint
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* a mistake.
|
|
97
|
+
* A project that means to keep its own entrypoint runs `rebase eject`, which
|
|
98
|
+
* writes the entrypoint, a Dockerfile and a compose file together and flips the
|
|
99
|
+
* backend to `runtime: "custom"`. The warning names that route rather than
|
|
100
|
+
* implying the file is a mistake.
|
|
102
101
|
*/
|
|
103
102
|
export declare function findUnusedServerEntry(projectRoot: string, functionsDir: string): string | undefined;
|
|
104
103
|
/**
|
|
@@ -151,8 +150,15 @@ export declare function foldStaticIntoBundle(options: {
|
|
|
151
150
|
bundleDir: string;
|
|
152
151
|
/** Directory of built frontend assets (the static app's `output`). */
|
|
153
152
|
assetsDir: string;
|
|
153
|
+
/** The app's name in `rebase.json`. Names its directory inside the bundle. */
|
|
154
|
+
appName: string;
|
|
155
|
+
/** Public base path this app is served under. */
|
|
156
|
+
path: string;
|
|
157
|
+
/** Serve `index.html` for unmatched paths under `path`. */
|
|
158
|
+
spa: boolean;
|
|
154
159
|
}): {
|
|
155
160
|
fileCount: number;
|
|
161
|
+
dir: string;
|
|
156
162
|
};
|
|
157
163
|
export declare function buildStaticBundle(options: {
|
|
158
164
|
projectRoot: string;
|
|
@@ -160,6 +166,10 @@ export declare function buildStaticBundle(options: {
|
|
|
160
166
|
assetsDir: string;
|
|
161
167
|
outDir: string;
|
|
162
168
|
runtimeRange: string;
|
|
169
|
+
/** Public base path. Default `/` — a standalone bundle owns its origin. */
|
|
170
|
+
path?: string;
|
|
171
|
+
/** Serve `index.html` for unmatched paths. Default `true`. */
|
|
172
|
+
spa?: boolean;
|
|
163
173
|
}): {
|
|
164
174
|
outDir: string;
|
|
165
175
|
manifest: RebaseBundleManifest;
|
|
@@ -35,6 +35,26 @@ export declare function describeStorageState(state: StorageState | undefined): s
|
|
|
35
35
|
* type; the verdict appears once there is one.
|
|
36
36
|
*/
|
|
37
37
|
export declare function describeDatabaseState(db: Record<string, unknown> | undefined): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* One line describing what engine is serving this project.
|
|
40
|
+
*
|
|
41
|
+
* Three numbers are in play and they are easy to conflate — I have watched it
|
|
42
|
+
* happen. The **runtime version** (`1.2.0`) is the contract line a bundle's
|
|
43
|
+
* range resolves against; its major IS the contract major. The **framework
|
|
44
|
+
* version** (`0.11.0`) is the `@rebasepro` release the runtime image ships. They
|
|
45
|
+
* move independently on purpose: tying the contract line to the framework would
|
|
46
|
+
* make `^1` become `^0.11`, and pre-1.0 caret is restrictive, so every framework
|
|
47
|
+
* minor would fall outside every project's range and force a rebuild to receive
|
|
48
|
+
* an engine upgrade — the opposite of what the bundle/runtime split is for.
|
|
49
|
+
*
|
|
50
|
+
* So both are printed, rather than leaving anyone to infer one from a Docker tag.
|
|
51
|
+
*/
|
|
52
|
+
export declare function describeRuntime(project: {
|
|
53
|
+
runtimeMode?: string | null;
|
|
54
|
+
runtimeVersion?: string | null;
|
|
55
|
+
runtimeFrameworkVersion?: string | null;
|
|
56
|
+
runtimeVersionPin?: string | null;
|
|
57
|
+
}): string;
|
|
38
58
|
export declare function statusCommand(rawArgs: string[]): Promise<void>;
|
|
39
59
|
export declare function metricsCommand(rawArgs: string[]): Promise<void>;
|
|
40
60
|
export declare function webhooksCommand(subcommand: string | undefined, 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";
|