create-guren-app 1.11.0 → 1.11.1
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 +33 -65
- package/package.json +1 -1
- package/templates/api-only/package.json +3 -3
- package/templates/default/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1356,14 +1356,10 @@ const DATABASE_DRIVERS = [
|
|
|
1356
1356
|
"mysql"
|
|
1357
1357
|
];
|
|
1358
1358
|
/**
|
|
1359
|
-
* The directory holding every template a blueprint can copy from
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1363
|
-
* `examples/blog`, which no tarball contains.
|
|
1364
|
-
*
|
|
1365
|
-
* Layers are therefore named, not pathed — `TemplateName` makes a layer outside
|
|
1366
|
-
* this directory unrepresentable rather than merely asserted against.
|
|
1359
|
+
* The directory holding every template a blueprint can copy from, and the only
|
|
1360
|
+
* source tree in this package's `files` field: a layer resolved outside it
|
|
1361
|
+
* scaffolds fine from the monorepo and ENOENTs from an npm install (how `blog`
|
|
1362
|
+
* shipped broken, overlaying `examples/blog`). Layers are named, not pathed.
|
|
1367
1363
|
*/
|
|
1368
1364
|
const TEMPLATES_ROOT = fileURLToPath(new URL("../templates", import.meta.url));
|
|
1369
1365
|
function templateDir(name) {
|
|
@@ -1500,12 +1496,10 @@ const DATABASE_DEFAULTS = {
|
|
|
1500
1496
|
}
|
|
1501
1497
|
};
|
|
1502
1498
|
/**
|
|
1503
|
-
* `config/database.ts` ships as one real source
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1507
|
-
* `tests/database-config-template.test.ts` pins the files to this path and to
|
|
1508
|
-
* the `DATABASE_DEFAULTS` constants they hardcode.
|
|
1499
|
+
* `config/database.ts` ships as one real source per driver, copied verbatim —
|
|
1500
|
+
* no tokens, and `templates/database` is not a `TemplateName` layer, so only the
|
|
1501
|
+
* selected driver's file reaches the app. `tests/database-config-template.test.ts`
|
|
1502
|
+
* pins the files to this path and to the `DATABASE_DEFAULTS` they hardcode.
|
|
1509
1503
|
*/
|
|
1510
1504
|
function databaseConfigTemplatePath(driver) {
|
|
1511
1505
|
return join(TEMPLATES_ROOT, "database", driver, "config/database.ts");
|
|
@@ -1518,16 +1512,11 @@ async function loadDatabaseConfig(driver) {
|
|
|
1518
1512
|
}
|
|
1519
1513
|
}
|
|
1520
1514
|
/**
|
|
1521
|
-
* The generic single-`users`-table schema, one real source per driver
|
|
1522
|
-
*
|
|
1523
|
-
* `
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1526
|
-
* `add resource` merge new columns into.
|
|
1527
|
-
*
|
|
1528
|
-
* Named `db/schema.ts`, not `db/schema.<driver>.ts`: the suffixed name means
|
|
1529
|
-
* "a template ships its own schema" (see `schemaVariantPath`), and these are
|
|
1530
|
-
* the fallback for templates that ship none.
|
|
1515
|
+
* The generic single-`users`-table schema, one real source per driver, each
|
|
1516
|
+
* importing its own `@guren/orm/drizzle/<dialect>` barrel — what `guren add
|
|
1517
|
+
* auth` / `add resource` merge columns into. The suffixed
|
|
1518
|
+
* `db/schema.<driver>.ts` name means "a template ships its own schema" (see
|
|
1519
|
+
* `schemaVariantPath`); this is the fallback for the rest.
|
|
1531
1520
|
*/
|
|
1532
1521
|
function databaseSchemaTemplatePath(driver) {
|
|
1533
1522
|
return join(TEMPLATES_ROOT, "database", driver, "db/schema.ts");
|
|
@@ -1540,19 +1529,11 @@ async function loadFallbackSchema(driver) {
|
|
|
1540
1529
|
}
|
|
1541
1530
|
}
|
|
1542
1531
|
/**
|
|
1543
|
-
* Templates
|
|
1544
|
-
*
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1548
|
-
* `db/schema.ts` — a template carrying a plain `db/schema.ts` written for one
|
|
1549
|
-
* driver would otherwise be handed to users who picked another. The blueprint
|
|
1550
|
-
* this replaced worked around that by regenerating its schema from a copy kept
|
|
1551
|
-
* in this file, which then drifted from the columns its own controllers read.
|
|
1552
|
-
*
|
|
1553
|
-
* A template that ships some variants but not the selected one is a packaging
|
|
1554
|
-
* bug, not a reason to fall back to the generic schema: the fallback would
|
|
1555
|
-
* scaffold an app whose models reference tables that do not exist.
|
|
1532
|
+
* Templates needing more than the generic `users` table ship a schema per driver
|
|
1533
|
+
* as `db/schema.<driver>.ts`; the selected one becomes `db/schema.ts` and the
|
|
1534
|
+
* rest are deleted — `applyDatabaseConfig` overwrites `db/schema.ts` regardless.
|
|
1535
|
+
* A template shipping variants but not the selected driver is a packaging bug,
|
|
1536
|
+
* not a reason to fall back to the generic schema.
|
|
1556
1537
|
*/
|
|
1557
1538
|
function schemaVariantPath(destination, driver) {
|
|
1558
1539
|
return join(destination, `db/schema.${driver}.ts`);
|
|
@@ -1564,12 +1545,9 @@ async function resolveSchema(destination, driver) {
|
|
|
1564
1545
|
return readFile(schemaVariantPath(destination, driver), "utf8");
|
|
1565
1546
|
}
|
|
1566
1547
|
/**
|
|
1567
|
-
* `drizzle.config.ts` ships
|
|
1568
|
-
*
|
|
1569
|
-
* string
|
|
1570
|
-
* `DATABASE_DEFAULTS`, plus the SQLite-only DATABASE_URL guard that Postgres
|
|
1571
|
-
* and MySQL must not inherit (they take a real connection string here, so a
|
|
1572
|
-
* scheme check would reject every valid value they have).
|
|
1548
|
+
* `drizzle.config.ts` ships one real source per driver, copied verbatim. Only
|
|
1549
|
+
* SQLite carries the DATABASE_URL scheme guard: Postgres and MySQL take a real
|
|
1550
|
+
* connection string here, which such a check would reject.
|
|
1573
1551
|
*/
|
|
1574
1552
|
function drizzleConfigTemplatePath(driver) {
|
|
1575
1553
|
return join(TEMPLATES_ROOT, "database", driver, "drizzle.config.ts");
|
|
@@ -1582,9 +1560,8 @@ async function loadDrizzleConfig(driver) {
|
|
|
1582
1560
|
}
|
|
1583
1561
|
}
|
|
1584
1562
|
/**
|
|
1585
|
-
* True when the driver runs in a container the scaffolder provisions —
|
|
1586
|
-
*
|
|
1587
|
-
* the next-steps output mentions starting a database.
|
|
1563
|
+
* True when the driver runs in a container the scaffolder provisions — decides
|
|
1564
|
+
* docker-compose.yml, the db:up/db:down scripts, and the next-steps output.
|
|
1588
1565
|
*/
|
|
1589
1566
|
function usesDatabaseContainer(driver) {
|
|
1590
1567
|
return generateDockerCompose(driver) !== null;
|
|
@@ -1666,12 +1643,9 @@ function listAppBlueprints() {
|
|
|
1666
1643
|
/**
|
|
1667
1644
|
* The templates a blueprint copies from, in copy order: base first, then
|
|
1668
1645
|
* overlays, each overwriting what came before. Omit `renderingMode` for every
|
|
1669
|
-
* mode the blueprint supports
|
|
1670
|
-
*
|
|
1671
|
-
*
|
|
1672
|
-
* Repeats are returned as-is rather than deduped: a name listed twice means
|
|
1673
|
-
* "copy it again at this point", and collapsing it would silently change which
|
|
1674
|
-
* template wins.
|
|
1646
|
+
* mode the blueprint supports; pass one for a single scaffold. Repeats are not
|
|
1647
|
+
* deduped — a name listed twice means "copy it again", and collapsing it would
|
|
1648
|
+
* change which template wins.
|
|
1675
1649
|
*/
|
|
1676
1650
|
function listBlueprintTemplates(blueprint, renderingMode) {
|
|
1677
1651
|
const overlays = renderingMode ? blueprint.overlayTemplates[renderingMode] ?? [] : Object.values(blueprint.overlayTemplates).flat();
|
|
@@ -1714,16 +1688,11 @@ async function scaffoldAppBlueprint(options) {
|
|
|
1714
1688
|
//#endregion
|
|
1715
1689
|
//#region src/git.ts
|
|
1716
1690
|
/**
|
|
1717
|
-
* How long the scaffolder waits on `git` before giving up.
|
|
1718
|
-
*
|
|
1719
|
-
*
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
* visibly working. These run with `stdio: 'pipe'` and no terminal, where a
|
|
1723
|
-
* signing passphrase prompt, a credential helper, or a stalled name lookup
|
|
1724
|
-
* while git guesses the committer identity waits on input that can never
|
|
1725
|
-
* arrive — silently, with the app already written to disk. Generous enough
|
|
1726
|
-
* that an ordinary commit on a loaded machine never trips it.
|
|
1691
|
+
* How long the scaffolder waits on `git` before giving up. These children run
|
|
1692
|
+
* with `stdio: 'pipe'` and no terminal, so a signing passphrase prompt, a
|
|
1693
|
+
* credential helper, or a stalled identity lookup would wait forever on input
|
|
1694
|
+
* that can never arrive, with the app already on disk. Generous enough that an
|
|
1695
|
+
* ordinary commit on a loaded machine never trips it.
|
|
1727
1696
|
*/
|
|
1728
1697
|
const GIT_TIMEOUT_MS = 3e4;
|
|
1729
1698
|
function runGit(cwd, args, timeoutMs = GIT_TIMEOUT_MS) {
|
|
@@ -1857,9 +1826,8 @@ const AGENT_CHOICES_HELP = `Supported values are: ${AGENT_CHOICES.join(", ")}, a
|
|
|
1857
1826
|
const DEFAULT_AGENTS = ["claude"];
|
|
1858
1827
|
/**
|
|
1859
1828
|
* The selection handed to `guren agent:init --target`: agent names, `['all']`
|
|
1860
|
-
* forwarded verbatim
|
|
1861
|
-
*
|
|
1862
|
-
* when the user opted out of the harness entirely.
|
|
1829
|
+
* forwarded verbatim so the app's CLI owns the expansion, or null when the user
|
|
1830
|
+
* opted out of the harness entirely.
|
|
1863
1831
|
*/
|
|
1864
1832
|
async function resolveAgents(flagValue) {
|
|
1865
1833
|
const raw = Array.isArray(flagValue) ? flagValue.join(",") : flagValue;
|
package/package.json
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"test": "bun test"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@guren/cli": "^2.
|
|
22
|
-
"@guren/core": "^1.13.
|
|
23
|
-
"@guren/orm": "^2.6.
|
|
21
|
+
"@guren/cli": "^2.15.0",
|
|
22
|
+
"@guren/core": "^1.13.1",
|
|
23
|
+
"@guren/orm": "^2.6.3",
|
|
24
24
|
"drizzle-orm": "1.0.0-rc.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"db:seed": "bunx guren db:seed"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@guren/cli": "^2.
|
|
23
|
-
"@guren/core": "^1.13.
|
|
24
|
-
"@guren/inertia-client": "^1.1.
|
|
25
|
-
"@guren/orm": "^2.6.
|
|
22
|
+
"@guren/cli": "^2.15.0",
|
|
23
|
+
"@guren/core": "^1.13.1",
|
|
24
|
+
"@guren/inertia-client": "^1.1.3",
|
|
25
|
+
"@guren/orm": "^2.6.3",
|
|
26
26
|
"@inertiajs/react": "^3.6.1",
|
|
27
27
|
"drizzle-orm": "1.0.0-rc.4",
|
|
28
28
|
"react": "^19.0.0",
|