@vertz/cli 0.2.1 → 0.2.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/index.d.ts +0 -2
- package/dist/index.js +8 -51
- package/dist/vertz.js +8 -51
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,6 @@ declare function checkAction(options: CheckOptions): Promise<Result2<CheckData,
|
|
|
31
31
|
import { Result as Result3 } from "@vertz/errors";
|
|
32
32
|
interface CreateOptions {
|
|
33
33
|
projectName?: string;
|
|
34
|
-
runtime?: string;
|
|
35
|
-
example?: boolean;
|
|
36
34
|
}
|
|
37
35
|
declare function createAction(options: CreateOptions): Promise<Result3<void, Error>>;
|
|
38
36
|
import { Result as Result4 } from "@vertz/errors";
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ function findFile(dir, base, extensions) {
|
|
|
34
34
|
}
|
|
35
35
|
function detectAppType(projectRoot) {
|
|
36
36
|
const srcDir = join(projectRoot, "src");
|
|
37
|
-
const serverEntry = findFile(srcDir, "server", SERVER_EXTENSIONS);
|
|
37
|
+
const serverEntry = findFile(srcDir, "server", SERVER_EXTENSIONS) ?? findFile(join(srcDir, "api"), "server", SERVER_EXTENSIONS);
|
|
38
38
|
const uiEntry = findFile(srcDir, "app", APP_EXTENSIONS);
|
|
39
39
|
const ssrEntry = existsSync(join(srcDir, "entry-server.ts")) ? join(srcDir, "entry-server.ts") : undefined;
|
|
40
40
|
const clientEntry = existsSync(join(srcDir, "entry-client.ts")) ? join(srcDir, "entry-client.ts") : undefined;
|
|
@@ -1139,7 +1139,7 @@ ${errors.map((e) => ` - ${e}`).join(`
|
|
|
1139
1139
|
import { resolveOptions, scaffold } from "@vertz/create-vertz-app";
|
|
1140
1140
|
import { err as err3, ok as ok3 } from "@vertz/errors";
|
|
1141
1141
|
async function createAction(options) {
|
|
1142
|
-
const { projectName
|
|
1142
|
+
const { projectName } = options;
|
|
1143
1143
|
if (!projectName) {
|
|
1144
1144
|
return err3(new Error("Project name is required. Usage: vertz create <project-name>"));
|
|
1145
1145
|
}
|
|
@@ -1147,27 +1147,9 @@ async function createAction(options) {
|
|
|
1147
1147
|
if (!validName) {
|
|
1148
1148
|
return err3(new Error("Project name must be lowercase alphanumeric with hyphens only"));
|
|
1149
1149
|
}
|
|
1150
|
-
const validRuntimes = ["bun", "node", "deno"];
|
|
1151
|
-
const runtimeValue = (runtime || "bun").toLowerCase();
|
|
1152
|
-
if (!validRuntimes.includes(runtimeValue)) {
|
|
1153
|
-
return err3(new Error(`Invalid runtime. Must be one of: ${validRuntimes.join(", ")}`));
|
|
1154
|
-
}
|
|
1155
|
-
let includeExample;
|
|
1156
|
-
if (example === true) {
|
|
1157
|
-
includeExample = true;
|
|
1158
|
-
} else if (example === false) {
|
|
1159
|
-
includeExample = false;
|
|
1160
|
-
}
|
|
1161
|
-
const cliOptions = {
|
|
1162
|
-
projectName,
|
|
1163
|
-
runtime: runtimeValue,
|
|
1164
|
-
includeExample
|
|
1165
|
-
};
|
|
1166
1150
|
try {
|
|
1167
|
-
const resolved = await resolveOptions(
|
|
1151
|
+
const resolved = await resolveOptions({ projectName });
|
|
1168
1152
|
console.log(`Creating Vertz app: ${resolved.projectName}`);
|
|
1169
|
-
console.log(`Runtime: ${resolved.runtime}`);
|
|
1170
|
-
console.log(`Include example: ${resolved.includeExample ? "Yes" : "No"}`);
|
|
1171
1153
|
const targetDir = process.cwd();
|
|
1172
1154
|
await scaffold(targetDir, resolved);
|
|
1173
1155
|
console.log(`
|
|
@@ -1432,6 +1414,7 @@ async function startDevServer(options) {
|
|
|
1432
1414
|
};
|
|
1433
1415
|
process.on("SIGINT", shutdown);
|
|
1434
1416
|
process.on("SIGTERM", shutdown);
|
|
1417
|
+
process.on("SIGHUP", shutdown);
|
|
1435
1418
|
}
|
|
1436
1419
|
function startApiOnlyServer(serverEntry, port) {
|
|
1437
1420
|
const pm = createProcessManager((entryPoint, env) => spawn("bun", ["run", "--watch", entryPoint], {
|
|
@@ -1446,6 +1429,7 @@ function startApiOnlyServer(serverEntry, port) {
|
|
|
1446
1429
|
};
|
|
1447
1430
|
process.on("SIGINT", shutdown);
|
|
1448
1431
|
process.on("SIGTERM", shutdown);
|
|
1432
|
+
process.on("SIGHUP", shutdown);
|
|
1449
1433
|
});
|
|
1450
1434
|
}
|
|
1451
1435
|
|
|
@@ -1497,6 +1481,7 @@ async function devAction(options = {}) {
|
|
|
1497
1481
|
};
|
|
1498
1482
|
process.on("SIGINT", shutdown);
|
|
1499
1483
|
process.on("SIGTERM", shutdown);
|
|
1484
|
+
process.on("SIGHUP", shutdown);
|
|
1500
1485
|
try {
|
|
1501
1486
|
const initialResult = await orchestrator.runFull();
|
|
1502
1487
|
if (!initialResult.success) {
|
|
@@ -1573,28 +1558,6 @@ function toPascalCase(name) {
|
|
|
1573
1558
|
return name.split(/[-_\s]+/).map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join("");
|
|
1574
1559
|
}
|
|
1575
1560
|
|
|
1576
|
-
// src/generators/module.ts
|
|
1577
|
-
function generateModule(name, sourceDir) {
|
|
1578
|
-
const kebab = toKebabCase(name);
|
|
1579
|
-
const pascal = toPascalCase(kebab);
|
|
1580
|
-
const dir = `${sourceDir}/modules/${kebab}`;
|
|
1581
|
-
const moduleDefContent = `import { createModuleDef } from '@vertz/server';
|
|
1582
|
-
|
|
1583
|
-
export const ${pascal}ModuleDef = createModuleDef('${kebab}');
|
|
1584
|
-
`;
|
|
1585
|
-
const moduleContent = `import { createModule } from '@vertz/server';
|
|
1586
|
-
import { ${pascal}ModuleDef } from './${kebab}.module-def';
|
|
1587
|
-
|
|
1588
|
-
export const ${pascal}Module = createModule(${pascal}ModuleDef, (m) => {
|
|
1589
|
-
return m;
|
|
1590
|
-
});
|
|
1591
|
-
`;
|
|
1592
|
-
return [
|
|
1593
|
-
{ path: `${dir}/${kebab}.module-def.ts`, content: moduleDefContent },
|
|
1594
|
-
{ path: `${dir}/${kebab}.module.ts`, content: moduleContent }
|
|
1595
|
-
];
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
1561
|
// src/generators/router.ts
|
|
1599
1562
|
function generateRouter(name, moduleName, sourceDir) {
|
|
1600
1563
|
const kebab = toKebabCase(name);
|
|
@@ -1661,8 +1624,6 @@ function generateAction(options) {
|
|
|
1661
1624
|
}
|
|
1662
1625
|
const ensuredModuleName = moduleName;
|
|
1663
1626
|
switch (type) {
|
|
1664
|
-
case "module":
|
|
1665
|
-
return ok6({ files: generateModule(name, sourceDir) });
|
|
1666
1627
|
case "service":
|
|
1667
1628
|
return ok6({ files: generateService(name, ensuredModuleName, sourceDir) });
|
|
1668
1629
|
case "router":
|
|
@@ -1862,12 +1823,8 @@ async function loadMigrationFiles(dir) {
|
|
|
1862
1823
|
function createCLI() {
|
|
1863
1824
|
const program = new Command;
|
|
1864
1825
|
program.name("vertz").description("Vertz CLI — build, check, and serve your Vertz app").version("0.1.0");
|
|
1865
|
-
program.command("create <name>").description("Scaffold a new Vertz project").
|
|
1866
|
-
const result = await createAction({
|
|
1867
|
-
projectName: name,
|
|
1868
|
-
runtime: opts.runtime,
|
|
1869
|
-
example: opts.example
|
|
1870
|
-
});
|
|
1826
|
+
program.command("create <name>").description("Scaffold a new Vertz project").action(async (name) => {
|
|
1827
|
+
const result = await createAction({ projectName: name });
|
|
1871
1828
|
if (!result.ok) {
|
|
1872
1829
|
console.error(result.error.message);
|
|
1873
1830
|
process.exit(1);
|
package/dist/vertz.js
CHANGED
|
@@ -24,7 +24,7 @@ function findFile(dir, base, extensions) {
|
|
|
24
24
|
}
|
|
25
25
|
function detectAppType(projectRoot) {
|
|
26
26
|
const srcDir = join(projectRoot, "src");
|
|
27
|
-
const serverEntry = findFile(srcDir, "server", SERVER_EXTENSIONS);
|
|
27
|
+
const serverEntry = findFile(srcDir, "server", SERVER_EXTENSIONS) ?? findFile(join(srcDir, "api"), "server", SERVER_EXTENSIONS);
|
|
28
28
|
const uiEntry = findFile(srcDir, "app", APP_EXTENSIONS);
|
|
29
29
|
const ssrEntry = existsSync(join(srcDir, "entry-server.ts")) ? join(srcDir, "entry-server.ts") : undefined;
|
|
30
30
|
const clientEntry = existsSync(join(srcDir, "entry-client.ts")) ? join(srcDir, "entry-client.ts") : undefined;
|
|
@@ -1115,7 +1115,7 @@ ${errors.map((e) => ` - ${e}`).join(`
|
|
|
1115
1115
|
import { resolveOptions, scaffold } from "@vertz/create-vertz-app";
|
|
1116
1116
|
import { err as err3, ok as ok3 } from "@vertz/errors";
|
|
1117
1117
|
async function createAction(options) {
|
|
1118
|
-
const { projectName
|
|
1118
|
+
const { projectName } = options;
|
|
1119
1119
|
if (!projectName) {
|
|
1120
1120
|
return err3(new Error("Project name is required. Usage: vertz create <project-name>"));
|
|
1121
1121
|
}
|
|
@@ -1123,27 +1123,9 @@ async function createAction(options) {
|
|
|
1123
1123
|
if (!validName) {
|
|
1124
1124
|
return err3(new Error("Project name must be lowercase alphanumeric with hyphens only"));
|
|
1125
1125
|
}
|
|
1126
|
-
const validRuntimes = ["bun", "node", "deno"];
|
|
1127
|
-
const runtimeValue = (runtime || "bun").toLowerCase();
|
|
1128
|
-
if (!validRuntimes.includes(runtimeValue)) {
|
|
1129
|
-
return err3(new Error(`Invalid runtime. Must be one of: ${validRuntimes.join(", ")}`));
|
|
1130
|
-
}
|
|
1131
|
-
let includeExample;
|
|
1132
|
-
if (example === true) {
|
|
1133
|
-
includeExample = true;
|
|
1134
|
-
} else if (example === false) {
|
|
1135
|
-
includeExample = false;
|
|
1136
|
-
}
|
|
1137
|
-
const cliOptions = {
|
|
1138
|
-
projectName,
|
|
1139
|
-
runtime: runtimeValue,
|
|
1140
|
-
includeExample
|
|
1141
|
-
};
|
|
1142
1126
|
try {
|
|
1143
|
-
const resolved = await resolveOptions(
|
|
1127
|
+
const resolved = await resolveOptions({ projectName });
|
|
1144
1128
|
console.log(`Creating Vertz app: ${resolved.projectName}`);
|
|
1145
|
-
console.log(`Runtime: ${resolved.runtime}`);
|
|
1146
|
-
console.log(`Include example: ${resolved.includeExample ? "Yes" : "No"}`);
|
|
1147
1129
|
const targetDir = process.cwd();
|
|
1148
1130
|
await scaffold(targetDir, resolved);
|
|
1149
1131
|
console.log(`
|
|
@@ -1408,6 +1390,7 @@ async function startDevServer(options) {
|
|
|
1408
1390
|
};
|
|
1409
1391
|
process.on("SIGINT", shutdown);
|
|
1410
1392
|
process.on("SIGTERM", shutdown);
|
|
1393
|
+
process.on("SIGHUP", shutdown);
|
|
1411
1394
|
}
|
|
1412
1395
|
function startApiOnlyServer(serverEntry, port) {
|
|
1413
1396
|
const pm = createProcessManager((entryPoint, env) => spawn("bun", ["run", "--watch", entryPoint], {
|
|
@@ -1422,6 +1405,7 @@ function startApiOnlyServer(serverEntry, port) {
|
|
|
1422
1405
|
};
|
|
1423
1406
|
process.on("SIGINT", shutdown);
|
|
1424
1407
|
process.on("SIGTERM", shutdown);
|
|
1408
|
+
process.on("SIGHUP", shutdown);
|
|
1425
1409
|
});
|
|
1426
1410
|
}
|
|
1427
1411
|
|
|
@@ -1473,6 +1457,7 @@ async function devAction(options = {}) {
|
|
|
1473
1457
|
};
|
|
1474
1458
|
process.on("SIGINT", shutdown);
|
|
1475
1459
|
process.on("SIGTERM", shutdown);
|
|
1460
|
+
process.on("SIGHUP", shutdown);
|
|
1476
1461
|
try {
|
|
1477
1462
|
const initialResult = await orchestrator.runFull();
|
|
1478
1463
|
if (!initialResult.success) {
|
|
@@ -1534,28 +1519,6 @@ function toPascalCase(name) {
|
|
|
1534
1519
|
return name.split(/[-_\s]+/).map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join("");
|
|
1535
1520
|
}
|
|
1536
1521
|
|
|
1537
|
-
// src/generators/module.ts
|
|
1538
|
-
function generateModule(name, sourceDir) {
|
|
1539
|
-
const kebab = toKebabCase(name);
|
|
1540
|
-
const pascal = toPascalCase(kebab);
|
|
1541
|
-
const dir = `${sourceDir}/modules/${kebab}`;
|
|
1542
|
-
const moduleDefContent = `import { createModuleDef } from '@vertz/server';
|
|
1543
|
-
|
|
1544
|
-
export const ${pascal}ModuleDef = createModuleDef('${kebab}');
|
|
1545
|
-
`;
|
|
1546
|
-
const moduleContent = `import { createModule } from '@vertz/server';
|
|
1547
|
-
import { ${pascal}ModuleDef } from './${kebab}.module-def';
|
|
1548
|
-
|
|
1549
|
-
export const ${pascal}Module = createModule(${pascal}ModuleDef, (m) => {
|
|
1550
|
-
return m;
|
|
1551
|
-
});
|
|
1552
|
-
`;
|
|
1553
|
-
return [
|
|
1554
|
-
{ path: `${dir}/${kebab}.module-def.ts`, content: moduleDefContent },
|
|
1555
|
-
{ path: `${dir}/${kebab}.module.ts`, content: moduleContent }
|
|
1556
|
-
];
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
1522
|
// src/generators/router.ts
|
|
1560
1523
|
function generateRouter(name, moduleName, sourceDir) {
|
|
1561
1524
|
const kebab = toKebabCase(name);
|
|
@@ -1622,8 +1585,6 @@ function generateAction(options) {
|
|
|
1622
1585
|
}
|
|
1623
1586
|
const ensuredModuleName = moduleName;
|
|
1624
1587
|
switch (type) {
|
|
1625
|
-
case "module":
|
|
1626
|
-
return ok6({ files: generateModule(name, sourceDir) });
|
|
1627
1588
|
case "service":
|
|
1628
1589
|
return ok6({ files: generateService(name, ensuredModuleName, sourceDir) });
|
|
1629
1590
|
case "router":
|
|
@@ -1823,12 +1784,8 @@ async function loadMigrationFiles(dir) {
|
|
|
1823
1784
|
function createCLI() {
|
|
1824
1785
|
const program = new Command;
|
|
1825
1786
|
program.name("vertz").description("Vertz CLI — build, check, and serve your Vertz app").version("0.1.0");
|
|
1826
|
-
program.command("create <name>").description("Scaffold a new Vertz project").
|
|
1827
|
-
const result = await createAction({
|
|
1828
|
-
projectName: name,
|
|
1829
|
-
runtime: opts.runtime,
|
|
1830
|
-
example: opts.example
|
|
1831
|
-
});
|
|
1787
|
+
program.command("create <name>").description("Scaffold a new Vertz project").action(async (name) => {
|
|
1788
|
+
const result = await createAction({ projectName: name });
|
|
1832
1789
|
if (!result.ok) {
|
|
1833
1790
|
console.error(result.error.message);
|
|
1834
1791
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertz/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Vertz CLI — dev, build, create, and deploy commands",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vertz/codegen": "0.2.
|
|
37
|
+
"@vertz/codegen": "0.2.2",
|
|
38
38
|
"@vertz/errors": "0.2.1",
|
|
39
|
-
"@vertz/tui": "0.2.
|
|
40
|
-
"@vertz/compiler": "0.2.
|
|
39
|
+
"@vertz/tui": "0.2.2",
|
|
40
|
+
"@vertz/compiler": "0.2.2",
|
|
41
41
|
"@vertz/create-vertz-app": "0.2.1",
|
|
42
|
-
"@vertz/db": "0.2.
|
|
43
|
-
"@vertz/ui-server": "0.2.
|
|
42
|
+
"@vertz/db": "0.2.2",
|
|
43
|
+
"@vertz/ui-server": "0.2.2",
|
|
44
44
|
"commander": "^14.0.0",
|
|
45
45
|
"ink": "^6.6.0",
|
|
46
46
|
"jiti": "^2.4.2",
|