@taj-special/dravix-code 1.4.0 → 1.4.1
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/cli/index.js +26 -12
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -34,25 +34,39 @@ function markProjectVisited(hash) {
|
|
|
34
34
|
}
|
|
35
35
|
async function showFirstTimeDialog(projectName) {
|
|
36
36
|
const cols = process.stdout.columns ?? 80;
|
|
37
|
-
const W = Math.min(cols - 4,
|
|
37
|
+
const W = Math.min(cols - 4, 56);
|
|
38
|
+
const inner = W + 2;
|
|
38
39
|
const BC = chalk.hex('#6366f1');
|
|
39
40
|
const Wt = chalk.hex('#e2e8f0');
|
|
40
41
|
const Dim = chalk.hex('#6b7280');
|
|
41
42
|
const G = chalk.hex('#34d399');
|
|
42
43
|
const R = chalk.hex('#f87171');
|
|
44
|
+
const head = chalk.hex('#a78bfa').bold('Dravix Code') + Dim(' - first time in this project');
|
|
45
|
+
const projText = chalk.hex('#c4b5fd').bold(' ' + projectName);
|
|
46
|
+
function row(text) {
|
|
47
|
+
const visible = text.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
48
|
+
const pad = Math.max(inner - visible, 0);
|
|
49
|
+
return ' ' + BC('│') + ' ' + text + ' '.repeat(pad) + BC('│');
|
|
50
|
+
}
|
|
51
|
+
function padLine(fullWidth, left, right) {
|
|
52
|
+
const lVisible = left.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
53
|
+
const rVisible = right.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
54
|
+
const pad = Math.max(fullWidth - lVisible - rVisible, 0);
|
|
55
|
+
return left + right + ' '.repeat(pad);
|
|
56
|
+
}
|
|
43
57
|
console.clear();
|
|
44
58
|
console.log('');
|
|
45
|
-
console.log(' ' + BC('╭' + '─'.repeat(
|
|
46
|
-
console.log(
|
|
47
|
-
console.log(' ' + BC('├' + '─'.repeat(
|
|
48
|
-
console.log(
|
|
49
|
-
console.log(
|
|
50
|
-
console.log(' ' + BC('├' + '─'.repeat(
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
55
|
-
console.log(' ' + BC('╰' + '─'.repeat(
|
|
59
|
+
console.log(' ' + BC('╭' + '─'.repeat(inner) + '╮'));
|
|
60
|
+
console.log(row(head));
|
|
61
|
+
console.log(' ' + BC('├' + '─'.repeat(inner) + '┤'));
|
|
62
|
+
console.log(row(Wt('Open Dravix Code in:')));
|
|
63
|
+
console.log(row(projText));
|
|
64
|
+
console.log(' ' + BC('├' + '─'.repeat(inner) + '┤'));
|
|
65
|
+
console.log(row(''));
|
|
66
|
+
console.log(row(padLine(inner - 2, G.bold(' [ Enter ] '), Wt(' Yes, open here'))));
|
|
67
|
+
console.log(row(padLine(inner - 2, R.bold(' [ Esc ] '), Wt(' No, exit'))));
|
|
68
|
+
console.log(row(''));
|
|
69
|
+
console.log(' ' + BC('╰' + '─'.repeat(inner) + '╯'));
|
|
56
70
|
console.log('');
|
|
57
71
|
return new Promise((resolve) => {
|
|
58
72
|
process.stdin.setRawMode(true);
|