@kibibot/cli 1.0.12 → 1.0.13
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/dist/commands/about.js +13 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/commands/about.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { readFileSync, existsSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
5
6
|
function getVersion() {
|
|
6
7
|
try {
|
|
7
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -47,5 +48,16 @@ export function registerAbout(program) {
|
|
|
47
48
|
}
|
|
48
49
|
console.log(chalk.cyan(` ╚${'═'.repeat(W)}╝`));
|
|
49
50
|
console.log();
|
|
51
|
+
// Mark as welcomed
|
|
52
|
+
try {
|
|
53
|
+
const kibiDir = join(homedir(), '.kibi');
|
|
54
|
+
const marker = join(kibiDir, '.welcomed');
|
|
55
|
+
if (!existsSync(marker)) {
|
|
56
|
+
if (!existsSync(kibiDir))
|
|
57
|
+
mkdirSync(kibiDir, { recursive: true });
|
|
58
|
+
writeFileSync(marker, new Date().toISOString());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch { }
|
|
50
62
|
});
|
|
51
63
|
}
|
package/dist/index.js
CHANGED
|
@@ -38,9 +38,10 @@ program
|
|
|
38
38
|
enableDebug();
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
// Show about box on first run
|
|
41
|
+
// Show about box on first run (skip if user is running 'kibi about' directly)
|
|
42
42
|
const welcomeMarker = join(homedir(), '.kibi', '.welcomed');
|
|
43
|
-
|
|
43
|
+
const isAboutCommand = process.argv[2] === 'about';
|
|
44
|
+
if (!existsSync(welcomeMarker) && !isAboutCommand) {
|
|
44
45
|
try {
|
|
45
46
|
const W = 43;
|
|
46
47
|
const pad = (t) => t + ' '.repeat(Math.max(0, W - t.length));
|