create-fumapress 0.1.13 → 0.1.15

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.
Files changed (2) hide show
  1. package/dist/index.mjs +24 -16
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { mkdir, readdir, writeFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { cancel, confirm, intro, isCancel, log, outro, text } from "@clack/prompts";
5
- import { Command } from "commander";
5
+ import { cac } from "cac";
6
6
  import { x } from "tinyexec";
7
7
  //#region ../create-fumapress-versions/package.json
8
8
  var dependencies = {
@@ -26,7 +26,7 @@ var devDependencies = {
26
26
  };
27
27
  //#endregion
28
28
  //#region ../core/package.json
29
- var version = "1.3.0";
29
+ var version = "1.3.1";
30
30
  //#endregion
31
31
  //#region src/index.ts
32
32
  const packageManagers = [
@@ -35,20 +35,28 @@ const packageManagers = [
35
35
  "yarn",
36
36
  "bun"
37
37
  ];
38
- const program = new Command().name("create-fumapress").description("Initialize a Fumapress app").argument("[directory]", "directory to create the app in").option("-y, --yes", "use defaults and install dependencies").option("--force", "write files even when the target directory is not empty").option("--install", "install dependencies after scaffolding").option("--no-install", "skip dependency installation").option("--package-manager <name>", "package manager to use: npm, pnpm, yarn, or bun").parse(process.argv);
39
- const [directory] = program.args;
40
- const options = program.opts();
41
- intro("create-fumapress");
42
- const projectDirectory = options.yes ? directory ?? "my-fumapress-app" : await promptProjectDirectory(directory);
43
- const packageManager = getPackageManager(options.packageManager);
44
- const shouldInstall = options.yes ? options.install !== false : options.install ?? await promptInstall(packageManager);
45
- const root = path.resolve(projectDirectory);
46
- const name = toPackageName(path.basename(root));
47
- await assertCanInitialize(root, Boolean(options.force));
48
- await writeProject(root, name);
49
- log.success(`Created ${path.relative(process.cwd(), root) || "."}`);
50
- if (shouldInstall) await installDependencies(root, packageManager);
51
- printNextSteps(root, packageManager, shouldInstall);
38
+ const cli = cac("create-fumapress");
39
+ cli.command("[directory]", "Initialize a Fumapress app in the given directory").option("-y, --yes", "use defaults and install dependencies").option("--force", "write files even when the target directory is not empty").option("--install", "install dependencies after scaffolding, or --no-install to skip").option("--package-manager <name>", "package manager to use: npm, pnpm, yarn, or bun").action(create);
40
+ cli.help((sections) => sections.filter((section) => !section.title?.startsWith("For more info")));
41
+ try {
42
+ cli.parse();
43
+ } catch (error) {
44
+ cancel(error instanceof Error ? error.message : String(error));
45
+ process.exit(1);
46
+ }
47
+ async function create(directory, options) {
48
+ intro("create-fumapress");
49
+ const projectDirectory = options.yes ? directory ?? "my-fumapress-app" : await promptProjectDirectory(directory);
50
+ const packageManager = getPackageManager(options.packageManager);
51
+ const shouldInstall = options.yes ? options.install !== false : options.install ?? await promptInstall(packageManager);
52
+ const root = path.resolve(projectDirectory);
53
+ const name = toPackageName(path.basename(root));
54
+ await assertCanInitialize(root, Boolean(options.force));
55
+ await writeProject(root, name);
56
+ log.success(`Created ${path.relative(process.cwd(), root) || "."}`);
57
+ if (shouldInstall) await installDependencies(root, packageManager);
58
+ printNextSteps(root, packageManager, shouldInstall);
59
+ }
52
60
  async function promptProjectDirectory(initialValue) {
53
61
  return unwrapPrompt(await text({
54
62
  message: "Where should the Fumapress app be created?",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fumapress",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Initialize a Fumapress app",
5
5
  "keywords": [
6
6
  "Docs",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clack/prompts": "^1.7.0",
31
- "commander": "^15.0.0",
31
+ "cac": "^7.0.0",
32
32
  "tinyexec": "^1.3.1"
33
33
  },
34
34
  "devDependencies": {