create-fiyuu-app 0.1.1 → 0.2.0

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/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # create-fiyuu-app
2
+
3
+ Scaffold a new Fiyuu project with a single command.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx create-fiyuu-app my-app
9
+ cd my-app
10
+ npm install
11
+ npm run dev
12
+ ```
13
+
14
+ ## Options
15
+
16
+ The CLI prompts you to select features:
17
+
18
+ - **Sockets** - WebSocket real-time communication
19
+ - **Database** - F1 DB embedded database
20
+ - **Encryption** - Request encryption
21
+ - **Skills** - AI skills integration
22
+ - **Theming** - Dark/light mode support
23
+ - **Auth hints** - Authentication scaffolding
24
+
25
+ ## Project Structure
26
+
27
+ ```
28
+ my-app/
29
+ app/
30
+ page.tsx # Home page
31
+ layout.tsx # Root layout
32
+ meta.ts # Route metadata
33
+ query.ts # Data fetching
34
+ action.ts # Server mutations
35
+ schema.ts # Zod schemas
36
+ middleware.ts # Request middleware
37
+ api/
38
+ health.ts # API endpoint
39
+ fiyuu.config.ts # Framework configuration
40
+ package.json
41
+ ```
42
+
43
+ ## License
44
+
45
+ MIT
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { existsSync, realpathSync } from "node:fs";
3
+ import { existsSync } from "node:fs";
4
4
  import { mkdir, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -27,7 +27,9 @@ if (!projectName) {
27
27
  process.exit(1);
28
28
  }
29
29
 
30
- const useLocal = flags.includes("--local");
30
+ const frameworkRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
31
+ const localFrameworkCheckout = isLocalFrameworkCheckout(frameworkRoot);
32
+ const useLocal = flags.includes("--local") || localFrameworkCheckout;
31
33
  const useDefaults = flags.includes("--yes");
32
34
  const currentDirectory = process.cwd();
33
35
  const targetDirectory = path.resolve(currentDirectory, projectName);
@@ -38,7 +40,10 @@ if (existsSync(targetDirectory)) {
38
40
  process.exit(1);
39
41
  }
40
42
 
41
- const frameworkRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
43
+ if (flags.includes("--local") && !localFrameworkCheckout) {
44
+ console.warn("Local Fiyuu checkout not found next to create-fiyuu-app. Falling back to the published package.");
45
+ }
46
+
42
47
  const dependencyStrategy = resolveDependencyStrategy(frameworkRoot, useLocal);
43
48
  const answers = await collectAnswers(useDefaults);
44
49
 
@@ -258,18 +263,28 @@ function color(...codes) {
258
263
  return useColor ? `\u001b[${codes.join(";")}m` : "";
259
264
  }
260
265
 
266
+ function isLocalFrameworkCheckout(frameworkRoot) {
267
+ return existsSync(path.join(frameworkRoot, "bin", "fiyuu.mjs"))
268
+ && existsSync(path.join(frameworkRoot, "client.ts"));
269
+ }
270
+
261
271
  function resolveDependencyStrategy(frameworkRoot, useLocalFlag) {
262
272
  if (useLocalFlag) {
263
273
  return {
264
- usesLocalFramework: true,
265
- frameworkDependency: `file:${realpathSync(frameworkRoot).split(path.sep).join("/")}`,
266
- clientImportModule: "fiyuu/client",
274
+ cliDependency: `file:${path.join(frameworkRoot, "packages/cli")}`,
275
+ coreDependency: `file:${path.join(frameworkRoot, "packages/core")}`,
276
+ runtimeDependency: `file:${path.join(frameworkRoot, "packages/runtime")}`,
277
+ dbDependency: `file:${path.join(frameworkRoot, "packages/db")}`,
278
+ realtimeDependency: `file:${path.join(frameworkRoot, "packages/realtime")}`,
279
+ clientImportModule: "@fiyuu/core/client",
267
280
  };
268
281
  }
269
-
270
282
  return {
271
- usesLocalFramework: false,
272
- frameworkDependency: null,
283
+ cliDependency: "^0.3.0",
284
+ coreDependency: "^0.3.0",
285
+ runtimeDependency: "^0.3.0",
286
+ dbDependency: "^0.4.0",
287
+ realtimeDependency: "^0.4.0",
273
288
  clientImportModule: "@fiyuu/core/client",
274
289
  };
275
290
  }
@@ -349,8 +364,7 @@ async function createProject(targetDirectory, packageName, dependencyStrategy, a
349
364
  }
350
365
 
351
366
  function createPackageJson(projectName, dependencyStrategy) {
352
- const { usesLocalFramework, frameworkDependency } = dependencyStrategy;
353
- const includeSockets = false;
367
+ const { cliDependency, coreDependency, runtimeDependency, dbDependency, realtimeDependency } = dependencyStrategy;
354
368
 
355
369
  return `${JSON.stringify(
356
370
  {
@@ -359,19 +373,22 @@ function createPackageJson(projectName, dependencyStrategy) {
359
373
  private: true,
360
374
  type: "module",
361
375
  scripts: {
362
- dev: "npx fiyuu dev",
363
- build: "npx fiyuu build",
364
- start: "npx fiyuu start",
376
+ dev: "fiyuu dev",
377
+ build: "fiyuu build",
378
+ start: "fiyuu start",
365
379
  },
366
380
  dependencies: {
367
- fiyuu: usesLocalFramework ? frameworkDependency : "^0.2.0",
381
+ "@fiyuu/cli": cliDependency,
382
+ "@fiyuu/core": coreDependency,
383
+ "@fiyuu/runtime": runtimeDependency,
384
+ "@fiyuu/db": dbDependency,
385
+ "@fiyuu/realtime": realtimeDependency,
368
386
  "@geajs/core": "^1.1.3",
369
- ...(includeSockets ? { ws: "^8.18.1" } : {}),
370
387
  zod: "^3.24.2",
371
388
  },
372
389
  devDependencies: {
373
390
  "@types/node": "^22.13.10",
374
- ...(includeSockets ? { "@types/ws": "^8.5.14" } : {}),
391
+ typescript: "^5.8.2",
375
392
  },
376
393
  },
377
394
  null,
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "create-fiyuu-app",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-fiyuu-app": "./bin/create-fiyuu-app.mjs"
7
- }
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "README.md"
11
+ ]
8
12
  }