neatnode 3.1.5 → 3.1.6

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/bin/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import("../src/cli.js");
2
+ import "../src/cli.js";
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "neatnode",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Plug & Play Node.js backend starter templates — build REST APIs, socket servers, and more in seconds.",
5
5
  "bin": {
6
- "neatnode": "./bin/index.js"
6
+ "neatnode": "bin/index.js"
7
7
  },
8
8
  "keywords": [
9
9
  "nodejs",
@@ -9,7 +9,7 @@ import { downloadTemplate } from "../utils/downloadRepoTemplate.js";
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = path.dirname(__filename);
11
11
 
12
- export async function createProject({ projectName, repoPath, includeCrud, crudName }) {
12
+ export async function createProject({ projectName, repoPath, includeCrud, crudName, langKey }) {
13
13
  try {
14
14
  const targetPath = projectName === "."
15
15
  ? process.cwd()
@@ -33,10 +33,10 @@ export async function createProject({ projectName, repoPath, includeCrud, crudNa
33
33
  "author": os.userInfo().username || "author",
34
34
  });
35
35
 
36
- if (includeCrud && crudName ) {
36
+ if (!includeCrud && crudName ) {
37
37
  console.log("šŸ—‘ Removing CRUD files...");
38
- removeCrud(targetPath, crudName);
39
- removeCrudReferences(path.join(targetPath, "src", "app.js"));
38
+ removeCrud(targetPath, crudName, langKey);
39
+ removeCrudReferences(path.join(targetPath, "src", `app.${langKey}`));
40
40
  }
41
41
 
42
42
  console.log(`\nāœ… Project "${projectName}" created successfully!\n`);
@@ -2,16 +2,16 @@ import fs from "fs";
2
2
  import path from "path";
3
3
 
4
4
 
5
- export function removeCrud(targetPath, name) {
5
+ export function removeCrud(targetPath, name, langKey) {
6
6
  try {
7
7
  const crudPaths = [
8
- `src/models/${name}.model.js`,
9
- `src/controllers/${name}.controller.js`,
10
- `src/routes/${name}.route.js`,
11
- `src/services/${name}.service.js`,
12
- `src/validations/${name}.validation.js`,
13
- "src/middlewares/auth.middleware.js",
14
- `src/schemas/${name}.schema.js`
8
+ `src/models/${name}.model.${langKey}`,
9
+ `src/controllers/${name}.controller.${langKey}`,
10
+ `src/routes/${name}.route.${langKey}`,
11
+ `src/services/${name}.service.${langKey}`,
12
+ `src/validations/${name}.validation.${langKey}`,
13
+ `src/middlewares/auth.middleware.${langKey}`,
14
+ `src/schemas/${name}.schema.${langKey}`
15
15
  ];
16
16
 
17
17
  crudPaths.forEach(relPath => {
package/src/cli.js CHANGED
@@ -72,13 +72,26 @@ async function main() {
72
72
  crudName = "user";
73
73
  }
74
74
 
75
+ if (chosen.name === "Basic Express (TS)") {
76
+ const { includeCrud: answer } = await inquirer.prompt([
77
+ {
78
+ type: "confirm",
79
+ name: "includeCrud",
80
+ message: "Include example User CRUD?",
81
+ default: true,
82
+ },
83
+ ]);
84
+ includeCrud = answer;
85
+ crudName = "todo";
86
+ }
87
+
75
88
  // STEP 5 — Create Project (Remote download logic inside)
76
89
  await createProject({
77
90
  projectName,
78
91
  repoPath: chosen.repoPath,
79
92
  includeCrud,
80
93
  crudName,
81
- language: langKey,
94
+ langKey,
82
95
  });
83
96
 
84
97