create-strata 1.0.1 → 1.0.3
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/cli.js
CHANGED
|
@@ -2528,10 +2528,11 @@ function renderPackageJson(projectName, options = {}) {
|
|
|
2528
2528
|
"@getstrata/cli": "workspace:*",
|
|
2529
2529
|
"@getstrata/core": "workspace:*"
|
|
2530
2530
|
} : {
|
|
2531
|
-
"@getstrata/bootstrap": "^1.0.
|
|
2532
|
-
"@getstrata/cli": "^1.0.
|
|
2533
|
-
"@getstrata/core": "^1.0.
|
|
2531
|
+
"@getstrata/bootstrap": "^1.0.3",
|
|
2532
|
+
"@getstrata/cli": "^1.0.3",
|
|
2533
|
+
"@getstrata/core": "^1.0.3"
|
|
2534
2534
|
};
|
|
2535
|
+
coreDeps.eta = "^4.6.0";
|
|
2535
2536
|
if (options.layers?.database === "mysql") {
|
|
2536
2537
|
coreDeps.mysql2 = "^3.24.3";
|
|
2537
2538
|
}
|
|
@@ -2626,7 +2627,7 @@ function renderSupportingToolsReadme(layers) {
|
|
|
2626
2627
|
}
|
|
2627
2628
|
function renderApiDocs(projectName, layers) {
|
|
2628
2629
|
const rows = ["| Method | Path | Notes |", "| --- | --- | --- |"];
|
|
2629
|
-
rows.push("| `GET` | `/health` | Plain text `ok` (200), or `degraded` (503)
|
|
2630
|
+
rows.push("| `GET` | `/health` | Plain text `ok` (200), or `degraded` (503) until the database ping succeeds and the migrated `notes` table exists. Docker HEALTHCHECK uses this path. |", '| `GET` | `/ready` | JSON from the framework: `{"status":"ready","checks":{"database":"ok","redis":"skipped"}}` (200) or `not_ready` (503). `redis` is `ok` or `error` when `REDIS_URL` is set and `skipped` otherwise. It does not check the schema, so use `/health` as the deploy gate. |');
|
|
2630
2631
|
rows.push("| `GET` | `/` | Welcome page. Restyle or replace it. |");
|
|
2631
2632
|
if (authUsesToken(layers.auth)) {
|
|
2632
2633
|
rows.push("| `POST` | `/api/v1/auth/login` | `{ email, password }` returns `{ token }`. |", "| `POST` | `/api/v1/auth/register` | Creates a user and returns a token. |", "| `GET` | `/api/v1/auth/me` | Requires `Authorization: Bearer <token>`. |");
|
|
@@ -3086,13 +3087,13 @@ function renderMigrateTs(layers) {
|
|
|
3086
3087
|
}
|
|
3087
3088
|
const list = statements.map((sql) => ` \`${sql}\`,`).join(`
|
|
3088
3089
|
`);
|
|
3089
|
-
const
|
|
3090
|
-
const notePlaceholder =
|
|
3090
|
+
const ph = layers.database === "postgres";
|
|
3091
|
+
const notePlaceholder = ph ? "$1" : "?";
|
|
3091
3092
|
const verifyOn = layers.extras.emailVerification && authNeedsUsers(layers.auth);
|
|
3092
3093
|
const userColumns = verifyOn ? "name, email, password, is_admin, email_verified_at" : "name, email, password, is_admin";
|
|
3093
|
-
const userPlaceholders = verifyOn ?
|
|
3094
|
-
const adminFlag =
|
|
3095
|
-
const adminTrue =
|
|
3094
|
+
const userPlaceholders = verifyOn ? ph ? "$1, $2, $3, $4, $5), ($6, $7, $8, $9, $10" : "?, ?, ?, ?, ?), (?, ?, ?, ?, ?" : ph ? "$1, $2, $3, $4), ($5, $6, $7, $8" : "?, ?, ?, ?), (?, ?, ?, ?";
|
|
3095
|
+
const adminFlag = ph ? "false" : "0";
|
|
3096
|
+
const adminTrue = ph ? "true" : "1";
|
|
3096
3097
|
const verifiedNow = nowTimestampLiteral(layers.database);
|
|
3097
3098
|
const userValues = verifyOn ? `["Demo User", "demo@example.com", password, ${adminFlag}, ${verifiedNow}, "Admin User", "admin@example.test", password, ${adminTrue}, ${verifiedNow}]` : `["Demo User", "demo@example.com", password, ${adminFlag}, "Admin User", "admin@example.test", password, ${adminTrue}]`;
|
|
3098
3099
|
const seedTenant = tenancyOn ? `
|
|
@@ -3101,7 +3102,7 @@ function renderMigrateTs(layers) {
|
|
|
3101
3102
|
);
|
|
3102
3103
|
if (Number(tenantCount) === 0) {
|
|
3103
3104
|
await sql.unsafe(
|
|
3104
|
-
"INSERT INTO tenant (slug, plan, region) VALUES (${
|
|
3105
|
+
"INSERT INTO tenant (slug, plan, region) VALUES (${ph ? "$1, $2, $3" : "?, ?, ?"})",
|
|
3105
3106
|
["default", "enterprise", "eu"],
|
|
3106
3107
|
);
|
|
3107
3108
|
}` : "";
|
|
@@ -4,7 +4,8 @@ This scaffold sets `FRONTEND_MODE=api`: no server-rendered views beyond the welc
|
|
|
4
4
|
|
|
5
5
|
## What exists after migrating
|
|
6
6
|
|
|
7
|
-
- `GET /health` returns plain text `ok`, or `degraded`
|
|
7
|
+
- `GET /health` returns plain text `ok`, or `degraded` (503) until the database ping succeeds and the migrated `notes` table exists. Docker HEALTHCHECK uses `/health`.
|
|
8
|
+
- `GET /ready` returns JSON `{"status":"ready","checks":{"database":"ok","redis":"skipped"}}` (200) or `not_ready` (503). `redis` is `ok` or `error` when `REDIS_URL` is set and `skipped` otherwise. It does not check the schema, so `/health` is the deploy gate.
|
|
8
9
|
- `GET /` returns the welcome page.
|
|
9
10
|
- A `notes` table, with no routes on it yet.
|
|
10
11
|
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
"check": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@getstrata/bootstrap": "^1.0.
|
|
15
|
-
"@getstrata/cli": "^1.0.
|
|
16
|
-
"@getstrata/core": "^1.0.
|
|
14
|
+
"@getstrata/bootstrap": "^1.0.3",
|
|
15
|
+
"@getstrata/cli": "^1.0.3",
|
|
16
|
+
"@getstrata/core": "^1.0.3",
|
|
17
|
+
"eta": "^4.6.0"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"@types/bun": "^1.4.0",
|