@a5gard/asgard 0.0.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/.env +2 -0
- package/.gitignore copy +6 -0
- package/.vscode/ntrsync/.vscode/ocrmnavigator/id.txt +1 -0
- package/.vscode/ntrsync/.vscode/ocrmnavigator.code-snippets +3664 -0
- package/.vscode/ntrsync/00002_CRM URGENT_todo.md +79 -0
- package/.vscode/ntrsync/10005_notes repo url.md +3 -0
- package/.vscode/ntrsync/10012_vscode_color_settings.md +133 -0
- package/.vscode/ntrsync/10013_Googles Snapchat Upload Hack note.md +11 -0
- package/.vscode/ntrsync/10014_APP IDEA - Lawyer CRM.md +229 -0
- package/.vscode/ntrsync/10015_APP IDEA - Onlyfans.md +293 -0
- package/.vscode/ntrsync/10016_notes repo url.md +3 -0
- package/.vscode/ntrsync/10504_adhd symptom.md +3 -0
- package/.vscode/ntrsync/10505_APP IDEA - GMAIL.md +39 -0
- package/.vscode/ntrsync/10506_container home - build mats.md +18 -0
- package/.vscode/ntrsync/10507_cleint facing site meta and loader function.md +25 -0
- package/.vscode/ntrsync/10508_Sabaak VSCode 1-8 players - private teams, solo q, duos q.md +11 -0
- package/.vscode/ntrsync/10509_schema dump.md +80 -0
- package/.vscode/ntrsync/10510_APPT BEACONHILL_reminder.md +7 -0
- package/.vscode/ntrsync/10512_clipboard very usefull should use asap within all apps.md +101 -0
- package/.vscode/ntrsync/10516_DevStack_todo.md +130 -0
- package/.vscode/ntrsync/10517_CRM_todo.md +95 -0
- package/.vscode/ntrsync/10518_Catalyst POS_todo.md +73 -0
- package/.vscode/ntrsync/10519_Catalyst Software_todo.md +497 -0
- package/.vscode/ntrsync/10523_new note.md +6 -0
- package/.vscode/ntrsync/10524_New Reminder_reminder.md +5 -0
- package/.vscode/ntrsync/10525_Mobile - Notes, To-Dos And Things_todo.md +4 -0
- package/.vscode/ntrsync/90002_COMPLETED_todo.md +97 -0
- package/.vscode/ntrsync/README.md +1 -0
- package/.vscode/ocrmnavigator/id.txt +1 -0
- package/.vscode/ocrmnavigator.code-snippets +349 -0
- package/.vscode/settings.json +1 -0
- package/CHANGELOG.md +6 -0
- package/LICENSE.md +21 -0
- package/README.md +1612 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +17 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/config.asgard +8 -0
- package/dist/commands/add-source.d.ts +9 -0
- package/dist/commands/add-source.d.ts.map +1 -0
- package/dist/commands/add-source.js +68 -0
- package/dist/commands/add-source.js.map +1 -0
- package/dist/commands/baldr.d.ts +5 -0
- package/dist/commands/baldr.d.ts.map +1 -0
- package/dist/commands/baldr.js +35 -0
- package/dist/commands/baldr.js.map +1 -0
- package/dist/commands/combine-timelines.d.ts +5 -0
- package/dist/commands/combine-timelines.d.ts.map +1 -0
- package/dist/commands/combine-timelines.js +53 -0
- package/dist/commands/combine-timelines.js.map +1 -0
- package/dist/commands/create-project.d.ts +10 -0
- package/dist/commands/create-project.d.ts.map +1 -0
- package/dist/commands/create-project.js +195 -0
- package/dist/commands/create-project.js.map +1 -0
- package/dist/commands/create-timeline.d.ts +8 -0
- package/dist/commands/create-timeline.d.ts.map +1 -0
- package/dist/commands/create-timeline.js +54 -0
- package/dist/commands/create-timeline.js.map +1 -0
- package/dist/commands/delete-project.d.ts +5 -0
- package/dist/commands/delete-project.d.ts.map +1 -0
- package/dist/commands/delete-project.js +47 -0
- package/dist/commands/delete-project.js.map +1 -0
- package/dist/commands/delete-source.d.ts +8 -0
- package/dist/commands/delete-source.d.ts.map +1 -0
- package/dist/commands/delete-source.js +57 -0
- package/dist/commands/delete-source.js.map +1 -0
- package/dist/commands/delete-timeline.d.ts +8 -0
- package/dist/commands/delete-timeline.d.ts.map +1 -0
- package/dist/commands/delete-timeline.js +54 -0
- package/dist/commands/delete-timeline.js.map +1 -0
- package/dist/commands/delete-version.d.ts +8 -0
- package/dist/commands/delete-version.d.ts.map +1 -0
- package/dist/commands/delete-version.js +65 -0
- package/dist/commands/delete-version.js.map +1 -0
- package/dist/commands/download-file.d.ts +17 -0
- package/dist/commands/download-file.d.ts.map +1 -0
- package/dist/commands/download-file.js +87 -0
- package/dist/commands/download-file.js.map +1 -0
- package/dist/commands/download-folder.d.ts +18 -0
- package/dist/commands/download-folder.d.ts.map +1 -0
- package/dist/commands/download-folder.js +111 -0
- package/dist/commands/download-folder.js.map +1 -0
- package/dist/commands/download-source.d.ts +12 -0
- package/dist/commands/download-source.d.ts.map +1 -0
- package/dist/commands/download-source.js +46 -0
- package/dist/commands/download-source.js.map +1 -0
- package/dist/commands/gh-setup.d.ts +7 -0
- package/dist/commands/gh-setup.d.ts.map +1 -0
- package/dist/commands/gh-setup.js +106 -0
- package/dist/commands/gh-setup.js.map +1 -0
- package/dist/commands/load-project.d.ts +5 -0
- package/dist/commands/load-project.d.ts.map +1 -0
- package/dist/commands/load-project.js +56 -0
- package/dist/commands/load-project.js.map +1 -0
- package/dist/commands/menu.d.ts +5 -0
- package/dist/commands/menu.d.ts.map +1 -0
- package/dist/commands/menu.js +41 -0
- package/dist/commands/menu.js.map +1 -0
- package/dist/commands/midgardr.d.ts +5 -0
- package/dist/commands/midgardr.d.ts.map +1 -0
- package/dist/commands/midgardr.js +24 -0
- package/dist/commands/midgardr.js.map +1 -0
- package/dist/commands/publish-project.d.ts +5 -0
- package/dist/commands/publish-project.d.ts.map +1 -0
- package/dist/commands/publish-project.js +102 -0
- package/dist/commands/publish-project.js.map +1 -0
- package/dist/commands/replace-timeline.d.ts +8 -0
- package/dist/commands/replace-timeline.d.ts.map +1 -0
- package/dist/commands/replace-timeline.js +63 -0
- package/dist/commands/replace-timeline.js.map +1 -0
- package/dist/commands/restore-version.d.ts +8 -0
- package/dist/commands/restore-version.d.ts.map +1 -0
- package/dist/commands/restore-version.js +67 -0
- package/dist/commands/restore-version.js.map +1 -0
- package/dist/commands/save-project.d.ts +8 -0
- package/dist/commands/save-project.d.ts.map +1 -0
- package/dist/commands/save-project.js +43 -0
- package/dist/commands/save-project.js.map +1 -0
- package/dist/commands/set-source.d.ts +9 -0
- package/dist/commands/set-source.d.ts.map +1 -0
- package/dist/commands/set-source.js +59 -0
- package/dist/commands/set-source.js.map +1 -0
- package/dist/commands/switch-timeline.d.ts +8 -0
- package/dist/commands/switch-timeline.d.ts.map +1 -0
- package/dist/commands/switch-timeline.js +61 -0
- package/dist/commands/switch-timeline.js.map +1 -0
- package/dist/commands/sync-source.d.ts +5 -0
- package/dist/commands/sync-source.d.ts.map +1 -0
- package/dist/commands/sync-source.js +29 -0
- package/dist/commands/sync-source.js.map +1 -0
- package/dist/commands/upload-project+++.d.ts +5 -0
- package/dist/commands/upload-project+++.d.ts.map +1 -0
- package/dist/commands/upload-project+++.js +32 -0
- package/dist/commands/upload-project+++.js.map +1 -0
- package/dist/commands/upload-project++.d.ts +5 -0
- package/dist/commands/upload-project++.d.ts.map +1 -0
- package/dist/commands/upload-project++.js +33 -0
- package/dist/commands/upload-project++.js.map +1 -0
- package/dist/commands/upload-project+.d.ts +5 -0
- package/dist/commands/upload-project+.d.ts.map +1 -0
- package/dist/commands/upload-project+.js +40 -0
- package/dist/commands/upload-project+.js.map +1 -0
- package/dist/commands/upload-project.d.ts +5 -0
- package/dist/commands/upload-project.d.ts.map +1 -0
- package/dist/commands/upload-project.js +29 -0
- package/dist/commands/upload-project.js.map +1 -0
- package/dist/commands/view-timeline.d.ts +5 -0
- package/dist/commands/view-timeline.d.ts.map +1 -0
- package/dist/commands/view-timeline.js +39 -0
- package/dist/commands/view-timeline.js.map +1 -0
- package/dist/commands/view-versions.d.ts +5 -0
- package/dist/commands/view-versions.d.ts.map +1 -0
- package/dist/commands/view-versions.js +45 -0
- package/dist/commands/view-versions.js.map +1 -0
- package/dist/git/helpers.d.ts +10 -0
- package/dist/git/helpers.d.ts.map +1 -0
- package/dist/git/helpers.js +300 -0
- package/dist/git/helpers.js.map +1 -0
- package/dist/git/sync-repo.d.ts +2 -0
- package/dist/git/sync-repo.d.ts.map +1 -0
- package/dist/git/sync-repo.js +17 -0
- package/dist/git/sync-repo.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/box.d.ts +11 -0
- package/dist/utils/box.d.ts.map +1 -0
- package/dist/utils/box.js +158 -0
- package/dist/utils/box.js.map +1 -0
- package/ideas.md +46 -0
- package/package.json +53 -0
- package/src/commands/add-source.js +72 -0
- package/src/commands/baldr.js +38 -0
- package/src/commands/combine-timelines.js +65 -0
- package/src/commands/create-project.js +216 -0
- package/src/commands/create-timeline.js +60 -0
- package/src/commands/delete-project.js +54 -0
- package/src/commands/delete-source.js +63 -0
- package/src/commands/delete-timeline.js +63 -0
- package/src/commands/delete-version.js +74 -0
- package/src/commands/download-file.js +101 -0
- package/src/commands/download-folder.js +123 -0
- package/src/commands/download-source.js +51 -0
- package/src/commands/gh-setup.js +77 -0
- package/src/commands/load-project.js +63 -0
- package/src/commands/menu.js +46 -0
- package/src/commands/midgardr.js +25 -0
- package/src/commands/publish-project.js +167 -0
- package/src/commands/replace-timeline.js +76 -0
- package/src/commands/restore-version.js +80 -0
- package/src/commands/save-project.js +48 -0
- package/src/commands/set-source.js +65 -0
- package/src/commands/switch-timeline.js +69 -0
- package/src/commands/sync-source.js +32 -0
- package/src/commands/upload-project+++.js +34 -0
- package/src/commands/upload-project++.js +35 -0
- package/src/commands/upload-project+.js +47 -0
- package/src/commands/upload-project.js +31 -0
- package/src/commands/view-timeline.js +43 -0
- package/src/commands/view-versions.js +50 -0
- package/src/git/helpers.js +333 -0
- package/src/git/sync-repo.js +16 -0
- package/src/index.js +2 -0
- package/src/utils/box.js +282 -0
- package/tsconfig.json +23 -0
package/src/utils/box.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import readline from 'readline';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
let lines = [];
|
|
5
|
+
let width = 120;
|
|
6
|
+
let title = '';
|
|
7
|
+
|
|
8
|
+
const BORDERS = {
|
|
9
|
+
topLeft: '╭',
|
|
10
|
+
topRight: '╮',
|
|
11
|
+
bottomLeft: '╰',
|
|
12
|
+
bottomRight: '╯',
|
|
13
|
+
horizontal: '─',
|
|
14
|
+
vertical: '│',
|
|
15
|
+
leftT: '├',
|
|
16
|
+
rightT: '┤'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function render() {
|
|
20
|
+
console.clear();
|
|
21
|
+
|
|
22
|
+
const titlePadding = Math.floor((width - title.length - 2) / 2);
|
|
23
|
+
const titleLine = ' '.repeat(titlePadding) + title + ' '.repeat(width - title.length - titlePadding - 2);
|
|
24
|
+
|
|
25
|
+
console.log(chalk.cyan(BORDERS.topLeft + BORDERS.horizontal.repeat(width - 2) + BORDERS.topRight));
|
|
26
|
+
console.log(chalk.cyan(BORDERS.vertical) + chalk.bold.white(titleLine) + chalk.cyan(BORDERS.vertical));
|
|
27
|
+
|
|
28
|
+
lines.forEach(line => {
|
|
29
|
+
console.log(line);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
console.log(chalk.cyan(BORDERS.bottomLeft + BORDERS.horizontal.repeat(width - 2) + BORDERS.bottomRight));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function boxStart(boxTitle) {
|
|
36
|
+
title = boxTitle;
|
|
37
|
+
lines = [];
|
|
38
|
+
render();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function boxLine(message, type = 'info') {
|
|
42
|
+
let coloredMessage = message;
|
|
43
|
+
|
|
44
|
+
switch(type) {
|
|
45
|
+
case 'success':
|
|
46
|
+
coloredMessage = chalk.green(message);
|
|
47
|
+
break;
|
|
48
|
+
case 'error':
|
|
49
|
+
coloredMessage = chalk.red(message);
|
|
50
|
+
break;
|
|
51
|
+
case 'warning':
|
|
52
|
+
coloredMessage = chalk.yellow(message);
|
|
53
|
+
break;
|
|
54
|
+
case 'info':
|
|
55
|
+
coloredMessage = chalk.blue(message);
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
coloredMessage = message;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const maxWidth = width - 4;
|
|
62
|
+
if (message.length > maxWidth) {
|
|
63
|
+
const chunks = [];
|
|
64
|
+
for (let i = 0; i < message.length; i += maxWidth) {
|
|
65
|
+
chunks.push(message.substring(i, i + maxWidth));
|
|
66
|
+
}
|
|
67
|
+
chunks.forEach(chunk => {
|
|
68
|
+
const padding = width - chunk.length - 2;
|
|
69
|
+
const coloredChunk = type !== 'default' ? chalk[type === 'success' ? 'green' : type === 'error' ? 'red' : type === 'warning' ? 'yellow' : 'blue'](chunk) : chunk;
|
|
70
|
+
lines.push(chalk.cyan(BORDERS.vertical) + ' ' + coloredChunk + ' '.repeat(Math.max(0, padding - 1)) + chalk.cyan(BORDERS.vertical));
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
const padding = width - message.length - 2;
|
|
74
|
+
lines.push(chalk.cyan(BORDERS.vertical) + ' ' + coloredMessage + ' '.repeat(Math.max(0, padding - 1)) + chalk.cyan(BORDERS.vertical));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
render();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function boxDivider() {
|
|
81
|
+
lines.push(chalk.cyan(BORDERS.leftT + BORDERS.horizontal.repeat(width - 2) + BORDERS.rightT));
|
|
82
|
+
render();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function boxEnd(success = true, message = '') {
|
|
86
|
+
if (message) {
|
|
87
|
+
const text = message;
|
|
88
|
+
const coloredText = success ? chalk.green(message) : chalk.red(message);
|
|
89
|
+
const padding = width - text.length - 2;
|
|
90
|
+
lines.push(chalk.cyan(BORDERS.vertical) + ' ' + coloredText + ' '.repeat(padding - 1) + chalk.cyan(BORDERS.vertical));
|
|
91
|
+
}
|
|
92
|
+
render();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function boxList(message, choices) {
|
|
96
|
+
let selected = 0;
|
|
97
|
+
let isActive = true;
|
|
98
|
+
|
|
99
|
+
const renderList = () => {
|
|
100
|
+
const tempLines = [...lines];
|
|
101
|
+
|
|
102
|
+
choices.forEach((choice, i) => {
|
|
103
|
+
const prefix = i === selected ? '▶ ' : ' ';
|
|
104
|
+
const text = i === selected ? chalk.bold.white(prefix + choice) : chalk.gray(prefix + choice);
|
|
105
|
+
const plainText = prefix + choice;
|
|
106
|
+
const padding = width - plainText.length - 2;
|
|
107
|
+
tempLines.push(chalk.cyan(BORDERS.vertical) + ' ' + text + ' '.repeat(padding - 1) + chalk.cyan(BORDERS.vertical));
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
console.clear();
|
|
111
|
+
|
|
112
|
+
const titlePadding = Math.floor((width - title.length - 2) / 2);
|
|
113
|
+
const titleLine = ' '.repeat(titlePadding) + title + ' '.repeat(width - title.length - titlePadding - 2);
|
|
114
|
+
|
|
115
|
+
console.log(chalk.cyan(BORDERS.topLeft + BORDERS.horizontal.repeat(width - 2) + BORDERS.topRight));
|
|
116
|
+
console.log(chalk.cyan(BORDERS.vertical) + chalk.bold.white(titleLine) + chalk.cyan(BORDERS.vertical));
|
|
117
|
+
|
|
118
|
+
tempLines.forEach(line => console.log(line));
|
|
119
|
+
|
|
120
|
+
console.log(chalk.cyan(BORDERS.bottomLeft + BORDERS.horizontal.repeat(width - 2) + BORDERS.bottomRight));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return new Promise((resolve) => {
|
|
124
|
+
process.stdin.resume();
|
|
125
|
+
readline.emitKeypressEvents(process.stdin);
|
|
126
|
+
if (process.stdin.isTTY) {
|
|
127
|
+
process.stdin.setRawMode(true);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
renderList();
|
|
131
|
+
|
|
132
|
+
const onKeypress = (str, key) => {
|
|
133
|
+
if (!isActive) return;
|
|
134
|
+
|
|
135
|
+
if (key.name === 'up' && selected > 0) {
|
|
136
|
+
selected--;
|
|
137
|
+
renderList();
|
|
138
|
+
} else if (key.name === 'down' && selected < choices.length - 1) {
|
|
139
|
+
selected++;
|
|
140
|
+
renderList();
|
|
141
|
+
} else if (key.name === 'return') {
|
|
142
|
+
isActive = false;
|
|
143
|
+
if (process.stdin.isTTY) {
|
|
144
|
+
process.stdin.setRawMode(false);
|
|
145
|
+
}
|
|
146
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
147
|
+
|
|
148
|
+
const prefix = '▶ ';
|
|
149
|
+
const text = chalk.bold.white(prefix + choices[selected]);
|
|
150
|
+
const plainText = prefix + choices[selected];
|
|
151
|
+
const padding = width - plainText.length - 2;
|
|
152
|
+
lines.push(chalk.cyan(BORDERS.vertical) + ' ' + text + ' '.repeat(padding - 1) + chalk.cyan(BORDERS.vertical));
|
|
153
|
+
|
|
154
|
+
render();
|
|
155
|
+
resolve({ value: selected, label: choices[selected] });
|
|
156
|
+
} else if (key.ctrl && key.name === 'c') {
|
|
157
|
+
isActive = false;
|
|
158
|
+
if (process.stdin.isTTY) {
|
|
159
|
+
process.stdin.setRawMode(false);
|
|
160
|
+
}
|
|
161
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
162
|
+
render();
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
process.stdin.on('keypress', onKeypress);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export async function boxPrompt(message) {
|
|
172
|
+
return new Promise((resolve) => {
|
|
173
|
+
const promptText = chalk.yellow(message + ' › ');
|
|
174
|
+
const plainPromptText = message + ' › ';
|
|
175
|
+
|
|
176
|
+
const tempLines = [...lines];
|
|
177
|
+
tempLines.push(chalk.cyan(BORDERS.vertical) + ' ' + promptText);
|
|
178
|
+
|
|
179
|
+
console.clear();
|
|
180
|
+
|
|
181
|
+
const titlePadding = Math.floor((width - title.length - 2) / 2);
|
|
182
|
+
const titleLine = ' '.repeat(titlePadding) + title + ' '.repeat(width - title.length - titlePadding - 2);
|
|
183
|
+
|
|
184
|
+
console.log(chalk.cyan(BORDERS.topLeft + BORDERS.horizontal.repeat(width - 2) + BORDERS.topRight));
|
|
185
|
+
console.log(chalk.cyan(BORDERS.vertical) + chalk.bold.white(titleLine) + chalk.cyan(BORDERS.vertical));
|
|
186
|
+
|
|
187
|
+
tempLines.forEach(line => console.log(line));
|
|
188
|
+
console.log(chalk.cyan(BORDERS.bottomLeft + BORDERS.horizontal.repeat(width - 2) + BORDERS.bottomRight));
|
|
189
|
+
|
|
190
|
+
readline.cursorTo(process.stdout, plainPromptText.length + 2);
|
|
191
|
+
|
|
192
|
+
let input = '';
|
|
193
|
+
|
|
194
|
+
process.stdin.resume();
|
|
195
|
+
readline.emitKeypressEvents(process.stdin);
|
|
196
|
+
if (process.stdin.isTTY) {
|
|
197
|
+
process.stdin.setRawMode(true);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const onKeypress = (str, key) => {
|
|
201
|
+
if (key.ctrl && key.name === 'c') {
|
|
202
|
+
if (process.stdin.isTTY) {
|
|
203
|
+
process.stdin.setRawMode(false);
|
|
204
|
+
}
|
|
205
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
206
|
+
render();
|
|
207
|
+
process.exit(0);
|
|
208
|
+
} else if (key.name === 'return') {
|
|
209
|
+
if (process.stdin.isTTY) {
|
|
210
|
+
process.stdin.setRawMode(false);
|
|
211
|
+
}
|
|
212
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
213
|
+
|
|
214
|
+
const fullText = plainPromptText + input;
|
|
215
|
+
const padding = width - fullText.length - 2;
|
|
216
|
+
lines.push(chalk.cyan(BORDERS.vertical) + ' ' + promptText + chalk.white(input) + ' '.repeat(padding - 1) + chalk.cyan(BORDERS.vertical));
|
|
217
|
+
|
|
218
|
+
render();
|
|
219
|
+
resolve(input);
|
|
220
|
+
} else if (key.name === 'backspace') {
|
|
221
|
+
if (input.length > 0) {
|
|
222
|
+
input = input.slice(0, -1);
|
|
223
|
+
readline.cursorTo(process.stdout, plainPromptText.length + 2);
|
|
224
|
+
readline.clearLine(process.stdout, 1);
|
|
225
|
+
process.stdout.write(input);
|
|
226
|
+
}
|
|
227
|
+
} else if (str && !key.ctrl && !key.meta) {
|
|
228
|
+
input += str;
|
|
229
|
+
process.stdout.write(str);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
process.stdin.on('keypress', onKeypress);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function error(message) {
|
|
238
|
+
boxLine(message, 'error');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function success(message) {
|
|
242
|
+
boxLine(message, 'success');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function info(message) {
|
|
246
|
+
boxLine(message, 'info');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function warning(message) {
|
|
250
|
+
boxLine(message, 'warning');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
export async function boxWaitForEnter() {
|
|
256
|
+
return new Promise((resolve) => {
|
|
257
|
+
process.stdin.setRawMode(true);
|
|
258
|
+
process.stdin.resume();
|
|
259
|
+
|
|
260
|
+
readline.emitKeypressEvents(process.stdin);
|
|
261
|
+
|
|
262
|
+
const onKeypress = (str, key) => {
|
|
263
|
+
if (key.name === 'return') {
|
|
264
|
+
if (process.stdin.isTTY) {
|
|
265
|
+
process.stdin.setRawMode(false);
|
|
266
|
+
}
|
|
267
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
268
|
+
process.stdin.pause();
|
|
269
|
+
resolve();
|
|
270
|
+
} else if (key.ctrl && key.name === 'c') {
|
|
271
|
+
if (process.stdin.isTTY) {
|
|
272
|
+
process.stdin.setRawMode(false);
|
|
273
|
+
}
|
|
274
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
275
|
+
render();
|
|
276
|
+
process.exit(0);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
process.stdin.on('keypress', onKeypress);
|
|
281
|
+
});
|
|
282
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"moduleResolution": "NodeNext",
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"strict": false,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"outDir": "./dist",
|
|
14
|
+
"rootDir": "./src",
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"checkJs": false
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist"]
|
|
23
|
+
}
|