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