create-nexa-app 1.0.9 → 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.
- package/bin/nexa.js +94 -6
- 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
|
/**
|
|
@@ -820,8 +823,8 @@ coverage/
|
|
|
820
823
|
.replace(/href=["']\/favicon\.png["']/i, 'href="./favicon.png"')
|
|
821
824
|
.replace(/href=["']\.\/nexa\.svg["']/i, 'href="./nexa.svg"')
|
|
822
825
|
.replace(/href=["']\/nexa\.svg["']/i, 'href="./nexa.svg"')
|
|
823
|
-
.replace(/src=["']\.\/src\/main\.jsx["']/i, 'src="
|
|
824
|
-
.replace(/src=["']src\/main\.jsx["']/i, 'src="
|
|
826
|
+
.replace(/src=["']\.\/src\/main\.jsx["']/i, 'src="./src/main.jsx"')
|
|
827
|
+
.replace(/src=["']\/src\/main\.jsx["']/i, 'src="./src/main.jsx"');
|
|
825
828
|
|
|
826
829
|
writeFileSafe(rootIndexPath, patchedIndex);
|
|
827
830
|
fs.unlinkSync(publicIndexPath);
|
|
@@ -846,7 +849,7 @@ coverage/
|
|
|
846
849
|
</head>
|
|
847
850
|
<body>
|
|
848
851
|
<div id="root"></div>
|
|
849
|
-
<script type="module" src="
|
|
852
|
+
<script type="module" src="./src/main.jsx"></script>
|
|
850
853
|
</body>
|
|
851
854
|
</html>
|
|
852
855
|
`;
|
|
@@ -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 (
|
|
1221
|
-
|
|
1222
|
-
process.exit(
|
|
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") {
|