create-fiyuu-app 0.1.1 → 0.1.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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { existsSync, realpathSync } from "node:fs";
4
4
  import { mkdir, writeFile } from "node:fs/promises";
5
+ import { execSync } from "node:child_process";
5
6
  import path from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
8
  import readline from "node:readline/promises";
@@ -20,6 +21,17 @@ const ui = {
20
21
  bold: color(1),
21
22
  };
22
23
 
24
+ async function linkFramework(targetDirectory, frameworkRoot) {
25
+ try {
26
+ execSync("npm link", { cwd: frameworkRoot, stdio: "inherit" });
27
+ execSync("npm link fiyuu", { cwd: targetDirectory, stdio: "inherit" });
28
+ } catch (error) {
29
+ console.error("Failed to link fiyuu framework. You may need to run:");
30
+ console.error(` cd ${frameworkRoot} && npm link`);
31
+ console.error(` cd ${targetDirectory} && npm link fiyuu`);
32
+ }
33
+ }
34
+
23
35
  const [, , projectName, ...flags] = process.argv;
24
36
 
25
37
  if (!projectName) {
@@ -27,7 +39,7 @@ if (!projectName) {
27
39
  process.exit(1);
28
40
  }
29
41
 
30
- const useLocal = flags.includes("--local");
42
+ const useLocal = true;
31
43
  const useDefaults = flags.includes("--yes");
32
44
  const currentDirectory = process.cwd();
33
45
  const targetDirectory = path.resolve(currentDirectory, projectName);
@@ -45,6 +57,8 @@ const answers = await collectAnswers(useDefaults);
45
57
  await mkdir(targetDirectory, { recursive: true });
46
58
  await createProject(targetDirectory, packageName, dependencyStrategy, answers);
47
59
 
60
+ await linkFramework(targetDirectory, frameworkRoot);
61
+
48
62
  renderSuccess(packageName, targetDirectory, answers);
49
63
 
50
64
  async function collectAnswers(useDefaultsFlag) {
@@ -259,18 +273,10 @@ function color(...codes) {
259
273
  }
260
274
 
261
275
  function resolveDependencyStrategy(frameworkRoot, useLocalFlag) {
262
- if (useLocalFlag) {
263
- return {
264
- usesLocalFramework: true,
265
- frameworkDependency: `file:${realpathSync(frameworkRoot).split(path.sep).join("/")}`,
266
- clientImportModule: "fiyuu/client",
267
- };
268
- }
269
-
270
276
  return {
271
- usesLocalFramework: false,
272
- frameworkDependency: null,
273
- clientImportModule: "@fiyuu/core/client",
277
+ usesLocalFramework: true,
278
+ frameworkDependency: "^0.2.0",
279
+ clientImportModule: "fiyuu/client",
274
280
  };
275
281
  }
276
282
 
@@ -359,12 +365,12 @@ function createPackageJson(projectName, dependencyStrategy) {
359
365
  private: true,
360
366
  type: "module",
361
367
  scripts: {
362
- dev: "npx fiyuu dev",
363
- build: "npx fiyuu build",
364
- start: "npx fiyuu start",
368
+ dev: "node node_modules/fiyuu/bin/fiyuu.mjs dev",
369
+ build: "node node_modules/fiyuu/bin/fiyuu.mjs build",
370
+ start: "node node_modules/fiyuu/bin/fiyuu.mjs start",
365
371
  },
366
372
  dependencies: {
367
- fiyuu: usesLocalFramework ? frameworkDependency : "^0.2.0",
373
+ ...(usesLocalFramework ? {} : { fiyuu: frameworkDependency }),
368
374
  "@geajs/core": "^1.1.3",
369
375
  ...(includeSockets ? { ws: "^8.18.1" } : {}),
370
376
  zod: "^3.24.2",
@@ -424,8 +430,8 @@ Generated with create-fiyuu-app.
424
430
  - npm run dev
425
431
  - npm run build
426
432
  - npm run start
427
- - npx fiyuu feat list
428
- - npx fiyuu feat socket on|off
433
+ - node node_modules/fiyuu/bin/fiyuu.mjs feat list
434
+ - node node_modules/fiyuu/bin/fiyuu.mjs feat socket on|off
429
435
 
430
436
  ## Starter Routes
431
437
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fiyuu-app",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-fiyuu-app": "./bin/create-fiyuu-app.mjs"