bimba-cli 0.4.2 → 0.4.4
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/package.json +1 -1
- package/serve.js +20 -29
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -184,9 +184,9 @@ export function serve(entrypoint, flags) {
|
|
|
184
184
|
const sockets = new Set()
|
|
185
185
|
let importMapTag = null
|
|
186
186
|
|
|
187
|
-
let _lastLines = 0
|
|
188
187
|
let _fadeTimers = []
|
|
189
188
|
let _fadeId = 0
|
|
189
|
+
let _statusSaved = false
|
|
190
190
|
|
|
191
191
|
function cancelFade() {
|
|
192
192
|
_fadeTimers.forEach(t => clearTimeout(t))
|
|
@@ -195,45 +195,36 @@ export function serve(entrypoint, flags) {
|
|
|
195
195
|
|
|
196
196
|
function printStatus(file, state, errors) {
|
|
197
197
|
cancelFade()
|
|
198
|
-
if (
|
|
199
|
-
process.stdout.write(
|
|
200
|
-
|
|
198
|
+
if (_statusSaved) {
|
|
199
|
+
process.stdout.write('\x1b[u\x1b[J')
|
|
200
|
+
_statusSaved = false
|
|
201
201
|
}
|
|
202
202
|
const now = new Date().toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' })
|
|
203
203
|
const status = state === 'ok' ? theme.success(' ok ') : theme.failure(' fail ')
|
|
204
|
-
process.stdout.write(
|
|
205
|
-
|
|
204
|
+
process.stdout.write('\x1b[s')
|
|
205
|
+
_statusSaved = true
|
|
206
206
|
if (errors?.length) {
|
|
207
|
+
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}\n`)
|
|
207
208
|
for (const err of errors) {
|
|
208
209
|
printerr(err)
|
|
209
|
-
_lastLines += 5
|
|
210
210
|
}
|
|
211
211
|
} else {
|
|
212
212
|
const myId = ++_fadeId
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
[8000, 242],
|
|
222
|
-
[9000, null],
|
|
223
|
-
].map(([delay, col]) => [delay, col !== null
|
|
224
|
-
? ` ${c(now, col)} ${c(file, col)} ${c('ok', col)}`
|
|
225
|
-
: null
|
|
226
|
-
])
|
|
227
|
-
for (const [delay, line] of steps) {
|
|
213
|
+
const plainLine = ` ${now} ${file} ok `
|
|
214
|
+
const totalLen = plainLine.length
|
|
215
|
+
const startDelay = 5000
|
|
216
|
+
const charDelay = 22
|
|
217
|
+
|
|
218
|
+
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}`)
|
|
219
|
+
|
|
220
|
+
for (let i = 1; i <= totalLen; i++) {
|
|
228
221
|
_fadeTimers.push(setTimeout(() => {
|
|
229
|
-
if (_fadeId !== myId
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
process.stdout.write(`\x1b[1A\x1b[2K`)
|
|
234
|
-
_lastLines = 0
|
|
222
|
+
if (_fadeId !== myId) return
|
|
223
|
+
process.stdout.write('\x1b[1D \x1b[1D')
|
|
224
|
+
if (i === totalLen) {
|
|
225
|
+
_statusSaved = false
|
|
235
226
|
}
|
|
236
|
-
},
|
|
227
|
+
}, startDelay + i * charDelay))
|
|
237
228
|
}
|
|
238
229
|
}
|
|
239
230
|
}
|