create-nexa-app 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.
Files changed (2) hide show
  1. package/bin/nexa.js +91 -3
  2. package/package.json +1 -1
package/bin/nexa.js CHANGED
@@ -202,6 +202,9 @@ ${C.bold}${C.blue}Examples${C.reset}
202
202
  ${C.gray}nexa new svc auth-service${C.reset}
203
203
  ${C.gray}nexa new ctx user-session${C.reset}
204
204
  ${C.gray}nexa --version${C.reset}
205
+ ${C.gray}nexa doctor${C.reset}
206
+
207
+
205
208
  `);
206
209
  }
207
210
  /**
@@ -1213,13 +1216,98 @@ function parseArgs(argv) {
1213
1216
  filtered.push(argv[i]);
1214
1217
  }
1215
1218
 
1219
+ /** Runs the doctor in the cli */
1220
+ function runDoctor() {
1221
+ console.log(`\n${C.cyan}${C.bold}🩺 Nexa Doctor${C.reset}\n`);
1222
+
1223
+ // Node
1224
+ try {
1225
+ const nodeVersion = process.version;
1226
+ console.log(`${C.green}✔ Node:${C.reset} ${nodeVersion}`);
1227
+ } catch {
1228
+ console.log(`${C.red}✖ Node not found${C.reset}`);
1229
+ }
1230
+
1231
+ // npm
1232
+ try {
1233
+ const npmVersion = execSync("npm -v").toString().trim();
1234
+ console.log(`${C.green}✔ npm:${C.reset} ${npmVersion}`);
1235
+ } catch {
1236
+ console.log(`${C.red}✖ npm not found${C.reset}`);
1237
+ }
1238
+
1239
+ // CLI version
1240
+ try {
1241
+ const pkg = JSON.parse(
1242
+ fs.readFileSync(path.join(__dirname, "../package.json"), "utf8"),
1243
+ );
1244
+ console.log(`${C.green}✔ Nexa CLI:${C.reset} v${pkg.version}`);
1245
+ } catch {
1246
+ console.log(`${C.yellow}⚠ Could not read CLI version${C.reset}`);
1247
+ }
1248
+
1249
+ const cwd = process.cwd();
1250
+
1251
+ console.log(`\n${C.cyan}Project Checks:${C.reset}\n`);
1252
+
1253
+ // package.json
1254
+ if (fs.existsSync(path.join(cwd, "package.json"))) {
1255
+ console.log(`${C.green}✔ package.json found${C.reset}`);
1256
+ } else {
1257
+ console.log(`${C.red}✖ package.json missing${C.reset}`);
1258
+ }
1259
+
1260
+ // node_modules
1261
+ if (fs.existsSync(path.join(cwd, "node_modules"))) {
1262
+ console.log(`${C.green}✔ node_modules installed${C.reset}`);
1263
+ } else {
1264
+ console.log(
1265
+ `${C.yellow}⚠ node_modules missing (run npm install)${C.reset}`,
1266
+ );
1267
+ }
1268
+
1269
+ // src
1270
+ if (fs.existsSync(path.join(cwd, "src"))) {
1271
+ console.log(`${C.green}✔ src folder found${C.reset}`);
1272
+ } else {
1273
+ console.log(`${C.red}✖ src folder missing${C.reset}`);
1274
+ }
1275
+
1276
+ // nexa.config.js
1277
+ if (fs.existsSync(path.join(cwd, "nexa.config.js"))) {
1278
+ console.log(`${C.green}✔ nexa.config.js found${C.reset}`);
1279
+ } else {
1280
+ console.log(`${C.yellow}⚠ nexa.config.js missing${C.reset}`);
1281
+ }
1282
+
1283
+ // index.html
1284
+ if (fs.existsSync(path.join(cwd, "index.html"))) {
1285
+ console.log(`${C.green}✔ index.html found${C.reset}`);
1286
+ } else {
1287
+ console.log(`${C.red}✖ index.html missing${C.reset}`);
1288
+ }
1289
+
1290
+ // manifest
1291
+ if (fs.existsSync(path.join(cwd, "public", "manifest.json"))) {
1292
+ console.log(`${C.green}✔ manifest.json found${C.reset}`);
1293
+ } else {
1294
+ console.log(`${C.yellow}⚠ manifest.json missing${C.reset}`);
1295
+ }
1296
+
1297
+ console.log(`\n${C.green}${C.bold}Doctor check complete ✔${C.reset}\n`);
1298
+ }
1299
+
1216
1300
  const first = filtered[0];
1217
1301
  const second = filtered[1];
1218
1302
  const third = filtered[2];
1219
1303
 
1220
- if (!first) {
1221
- printUsage();
1222
- process.exit(1);
1304
+ if (first === "doctor") {
1305
+ runDoctor();
1306
+ process.exit(0);
1307
+ }
1308
+ if (first === "doctor") {
1309
+ runDoctor();
1310
+ return;
1223
1311
  }
1224
1312
 
1225
1313
  if (first === "help" || first === "--help" || first === "-h") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nexa-app",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Create a new Nexa app with prebuilt structure, PWA support, and modern React/Vite setup",
5
5
  "bin": {
6
6
  "create-nexa-app": "bin/nexa.js",