vipcare 0.3.16 → 0.3.17
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/vip.js +47 -0
- package/package.json +1 -1
package/bin/vip.js
CHANGED
|
@@ -762,6 +762,53 @@ program.command('tags')
|
|
|
762
762
|
}
|
|
763
763
|
});
|
|
764
764
|
|
|
765
|
+
// --- reset ---
|
|
766
|
+
program.command('reset')
|
|
767
|
+
.description('Delete all profiles, config, and changelog data')
|
|
768
|
+
.option('-y, --yes', 'Skip confirmation')
|
|
769
|
+
.action(async (opts) => {
|
|
770
|
+
if (!opts.yes) {
|
|
771
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
772
|
+
try {
|
|
773
|
+
const answer = await rl.question(c.red('This will delete ALL profiles, config, and changelog. Are you sure? (type "yes") > '));
|
|
774
|
+
if (answer.trim().toLowerCase() !== 'yes') {
|
|
775
|
+
console.log('Aborted.');
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
} finally { rl.close(); }
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
const { CONFIG_DIR } = await import('../lib/config.js');
|
|
782
|
+
const profilesDir = getProfilesDir();
|
|
783
|
+
|
|
784
|
+
// Delete profiles
|
|
785
|
+
if (fs.existsSync(profilesDir)) {
|
|
786
|
+
const files = fs.readdirSync(profilesDir).filter(f => f.endsWith('.md'));
|
|
787
|
+
for (const f of files) fs.unlinkSync(path.join(profilesDir, f));
|
|
788
|
+
console.log(c.green(` Deleted ${files.length} profile(s)`));
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// Delete config and changelog
|
|
792
|
+
if (fs.existsSync(CONFIG_DIR)) {
|
|
793
|
+
const configFiles = fs.readdirSync(CONFIG_DIR);
|
|
794
|
+
for (const f of configFiles) {
|
|
795
|
+
const fp = path.join(CONFIG_DIR, f);
|
|
796
|
+
if (fs.statSync(fp).isFile()) fs.unlinkSync(fp);
|
|
797
|
+
}
|
|
798
|
+
console.log(c.green(' Deleted config and changelog'));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Delete generated web files
|
|
802
|
+
const webDir = path.join(path.dirname(new URL(import.meta.url).pathname), '..', 'web');
|
|
803
|
+
if (fs.existsSync(webDir)) {
|
|
804
|
+
const webFiles = fs.readdirSync(webDir).filter(f => f.endsWith('.html'));
|
|
805
|
+
for (const f of webFiles) fs.unlinkSync(path.join(webDir, f));
|
|
806
|
+
if (webFiles.length) console.log(c.green(` Deleted ${webFiles.length} card page(s)`));
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
console.log(c.green('\nAll data cleared. Run "vip init" to start fresh.'));
|
|
810
|
+
});
|
|
811
|
+
|
|
765
812
|
// --- upgrade ---
|
|
766
813
|
program.command('upgrade')
|
|
767
814
|
.description('Update vipcare to the latest version')
|