bosia 0.6.11 → 0.6.12
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/package.json +1 -1
- package/src/cli/create.ts +22 -4
- package/src/cli/index.ts +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bosia",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A fast, batteries-included fullstack framework — SSR · Svelte 5 Runes · Bun · ElysiaJS. File-based routing inspired by SvelteKit. No Node.js, no Vite, no adapters.",
|
|
6
6
|
"keywords": [
|
package/src/cli/create.ts
CHANGED
|
@@ -32,16 +32,24 @@ export async function runCreate(name: string | undefined, args: string[] = []) {
|
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// Parse --template flag
|
|
35
|
+
// Parse --template flag (supports `--template foo` and `--template=foo`)
|
|
36
36
|
let template: string | undefined;
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
template =
|
|
37
|
+
const templateEq = args.find((a) => a.startsWith("--template="));
|
|
38
|
+
if (templateEq) {
|
|
39
|
+
template = templateEq.slice("--template=".length);
|
|
40
|
+
} else {
|
|
41
|
+
const templateIdx = args.indexOf("--template");
|
|
42
|
+
if (templateIdx !== -1 && args[templateIdx + 1]) {
|
|
43
|
+
template = args[templateIdx + 1];
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
// Parse --local flag
|
|
43
48
|
const isLocal = args.includes("--local");
|
|
44
49
|
|
|
50
|
+
// Parse --no-install flag (skip final `bun install`)
|
|
51
|
+
const skipInstall = args.includes("--no-install");
|
|
52
|
+
|
|
45
53
|
// If no --template flag, prompt interactively
|
|
46
54
|
if (!template) {
|
|
47
55
|
template = await promptTemplate();
|
|
@@ -93,6 +101,16 @@ export async function runCreate(name: string | undefined, args: string[] = []) {
|
|
|
93
101
|
|
|
94
102
|
console.log(`\n✅ Project created at ${targetDir}\n`);
|
|
95
103
|
|
|
104
|
+
if (skipInstall) {
|
|
105
|
+
console.log(`Skipped \`bun install\` (--no-install).\n\ncd ${name} && bun install\n`);
|
|
106
|
+
const instPath = join(templateDir, "instructions.txt");
|
|
107
|
+
if (existsSync(instPath)) {
|
|
108
|
+
const instructions = readFileSync(instPath, "utf-8").trimEnd();
|
|
109
|
+
if (instructions) console.log(instructions);
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
96
114
|
console.log("Installing dependencies...");
|
|
97
115
|
const proc = spawn(["bun", "install"], {
|
|
98
116
|
stdout: "inherit",
|
package/src/cli/index.ts
CHANGED
|
@@ -12,8 +12,25 @@ const [, , command, ...args] = process.argv;
|
|
|
12
12
|
async function main() {
|
|
13
13
|
switch (command) {
|
|
14
14
|
case "create": {
|
|
15
|
+
// Name is the first non-flag token; --template consumes the next arg as its value
|
|
16
|
+
// (also accepts --template=value form).
|
|
17
|
+
let name: string | undefined;
|
|
18
|
+
const rest: string[] = [];
|
|
19
|
+
for (let i = 0; i < args.length; i++) {
|
|
20
|
+
const a = args[i];
|
|
21
|
+
if (a === "--template" && args[i + 1]) {
|
|
22
|
+
rest.push(a, args[i + 1]);
|
|
23
|
+
i++;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (!name && !a.startsWith("-")) {
|
|
27
|
+
name = a;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
rest.push(a);
|
|
31
|
+
}
|
|
15
32
|
const { runCreate } = await import("./create.ts");
|
|
16
|
-
await runCreate(
|
|
33
|
+
await runCreate(name, rest);
|
|
17
34
|
break;
|
|
18
35
|
}
|
|
19
36
|
case "dev": {
|