npms-exam-kit 3.0.4 → 3.0.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/exam-kit.js +3 -10
- package/package.json +2 -3
package/bin/exam-kit.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
4
|
import chalk from 'chalk';
|
|
6
5
|
import inquirer from 'inquirer';
|
|
7
6
|
import { exec } from 'child_process';
|
|
8
7
|
import { promisify } from 'util';
|
|
9
|
-
import { existsSync, readFileSync, writeFileSync, copyFileSync, mkdirSync, readdirSync, statSync } from 'fs';
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync, copyFileSync, mkdirSync, readdirSync, statSync, cpSync, rmSync } from 'fs';
|
|
10
9
|
|
|
11
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
11
|
const __dirname = dirname(__filename);
|
|
@@ -517,7 +516,7 @@ async function main(){
|
|
|
517
516
|
log(chalk.yellow(` Warning: ${exist.join(', ')} already exists here.`));
|
|
518
517
|
const {overwrite}=await inquirer.prompt([{type:'confirm',name:'overwrite',message:'Overwrite?',default:false}]);
|
|
519
518
|
if(!overwrite){log(chalk.yellow(' Cancelled.'));process.exit(0);}
|
|
520
|
-
for(const f of['backend-project','frontend-project','database.sql']){const p=join(targetDir,f);if(existsSync(p))
|
|
519
|
+
for(const f of['backend-project','frontend-project','database.sql']){const p=join(targetDir,f);if(existsSync(p))rmSync(p,{recursive:true,force:true});}
|
|
521
520
|
}
|
|
522
521
|
|
|
523
522
|
const srcDir=join(PROJECTS_DIR,project==='SIMS'?'SIMS-master':'CRPMS-main');
|
|
@@ -532,19 +531,13 @@ async function main(){
|
|
|
532
531
|
// ── INSTALL ──
|
|
533
532
|
log(chalk.bold(`\n Installing ${project} → ${targetDir} ...`));
|
|
534
533
|
|
|
535
|
-
// DEBUG: show source paths
|
|
536
|
-
log(chalk.dim(` Script: ${import.meta.url}`));
|
|
537
|
-
log(chalk.dim(` Projects dir: ${PROJECTS_DIR}`));
|
|
538
|
-
log(chalk.dim(` Source: ${srcDir}`));
|
|
539
|
-
log(chalk.dim(` Source contents: ${inDir(srcDir).join(', ')}`));
|
|
540
|
-
|
|
541
534
|
try{
|
|
542
535
|
// Copy files first (instant — no spinner needed)
|
|
543
536
|
const entries=readdirSync(srcDir);
|
|
544
537
|
for(const entry of entries){
|
|
545
538
|
if(entry==='node_modules')continue;
|
|
546
539
|
const s=join(srcDir,entry),d=join(targetDir,entry);
|
|
547
|
-
if(statSync(s).isDirectory())
|
|
540
|
+
if(statSync(s).isDirectory())cpSync(s,d,{recursive:true,force:true});
|
|
548
541
|
else copyFileSync(s,d);
|
|
549
542
|
}
|
|
550
543
|
log(chalk.green(' ✓ Project files installed'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npms-exam-kit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "NESA National Practical Exam Projects Installer - SIMS & CRPMS",
|
|
5
5
|
"bin": {
|
|
6
6
|
"npms-exam-kit": "bin/exam-kit.js"
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"chalk": "^5.3.0",
|
|
19
|
-
"inquirer": "^9.2.0"
|
|
20
|
-
"fs-extra": "^11.2.0"
|
|
19
|
+
"inquirer": "^9.2.0"
|
|
21
20
|
},
|
|
22
21
|
"type": "module",
|
|
23
22
|
"engines": {
|