@skalfa/skalfa-cli 1.0.10 → 1.0.11

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.
@@ -62,7 +62,7 @@ program
62
62
  program
63
63
  .command("init")
64
64
  .description("Initialize a new Skalfa monorepo project containing both API and App.")
65
- .argument("<name>", "project folder name")
65
+ .argument("[name]", "project folder name")
66
66
  .action(async (name) => {
67
67
  await runCommand(() => (0, init_1.initProject)(name));
68
68
  });
@@ -152,6 +152,12 @@ Here is the list of features and their development status:
152
152
  | :--- | :--- | :---: |
153
153
  | **Login** | API Login | \\\`[x] Completed\\\` |
154
154
 
155
+ ## API Documentation
156
+ The API documentation is automatically generated and updated in the \\\`./docs/\\\` folder.
157
+
158
+ To generate or update the documentation, run:
159
+ \\\`bun skalfa generate:docs\\\`
160
+
155
161
  ## Development Setup
156
162
 
157
163
  ### Prerequisites
@@ -32,10 +32,19 @@ class Questioner {
32
32
  }
33
33
  async function initProject(projectName) {
34
34
  const cwd = process.cwd();
35
- const target = node_path_1.default.resolve(cwd, projectName);
35
+ const isCurrentDir = !projectName || projectName === ".";
36
+ const target = isCurrentDir ? cwd : node_path_1.default.resolve(cwd, projectName);
37
+ const resolvedProjectName = isCurrentDir ? (node_path_1.default.basename(cwd) || "skalfa-project") : projectName;
36
38
  (0, fs_1.assertInsideDirectory)(cwd, target);
37
- if ((0, fs_1.exists)(target)) {
38
- throw new Error(`Target directory already exists: ${target}`);
39
+ if (isCurrentDir) {
40
+ if ((0, fs_1.exists)(node_path_1.default.join(target, "api")) || (0, fs_1.exists)(node_path_1.default.join(target, "app")) || (0, fs_1.exists)(node_path_1.default.join(target, "package.json"))) {
41
+ throw new Error(`Current directory already contains conflicting files/folders (api, app, or package.json).`);
42
+ }
43
+ }
44
+ else {
45
+ if ((0, fs_1.exists)(target)) {
46
+ throw new Error(`Target directory already exists: ${target}`);
47
+ }
39
48
  }
40
49
  // Ask interactive questions sequentially
41
50
  const q = new Questioner();
@@ -110,7 +119,7 @@ async function initProject(projectName) {
110
119
  console.log("\nConfiguring root files...");
111
120
  // 1. Root package.json
112
121
  const rootPackageJson = {
113
- name: projectName,
122
+ name: resolvedProjectName,
114
123
  private: true,
115
124
  workspaces: [
116
125
  "api",
@@ -124,7 +133,7 @@ async function initProject(projectName) {
124
133
  `;
125
134
  node_fs_1.default.writeFileSync(node_path_1.default.join(target, ".gitignore"), rootGitignore, "utf8");
126
135
  // 3. Root README.md
127
- const rootReadme = `# ${projectName}
136
+ const rootReadme = `# ${resolvedProjectName}
128
137
 
129
138
  This is a Skalfa monorepo project containing both the backend (API) and the frontend (App).
130
139
 
@@ -170,6 +179,11 @@ This is a combined Skalfa project containing both the backend (\`api\`) and fron
170
179
  3. Always ensure that API contracts and communication between the frontend and backend are aligned.
171
180
  `;
172
181
  node_fs_1.default.writeFileSync(node_path_1.default.join(agentsDir, "AGENTS.md"), agentsMd, "utf8");
173
- console.log(`\nSuccessfully initialized ${projectName}!`);
174
- console.log(`\nNext steps:\n cd ${projectName}\n bun install\n bun run --cwd api dev (or cd api && bun run dev)\n bun run --cwd app dev (or cd app && bun run dev)`);
182
+ console.log(`\nSuccessfully initialized ${resolvedProjectName}!`);
183
+ if (isCurrentDir) {
184
+ console.log(`\nNext steps:\n bun install\n bun run --cwd api dev (or cd api && bun run dev)\n bun run --cwd app dev (or cd app && bun run dev)`);
185
+ }
186
+ else {
187
+ console.log(`\nNext steps:\n cd ${projectName}\n bun install\n bun run --cwd api dev (or cd api && bun run dev)\n bun run --cwd app dev (or cd app && bun run dev)`);
188
+ }
175
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skalfa/skalfa-cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Command Line Interface tool for scaffolding Skalfa projects, managing extensions, and ejecting core utilities.",
5
5
  "main": "dist/bin/skalfa.js",
6
6
  "bin": {