anymd 0.0.5 → 0.0.6
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/src/tui-data.ts +4 -2
- package/tui.tsx +4 -2
package/package.json
CHANGED
package/src/tui-data.ts
CHANGED
|
@@ -6,6 +6,8 @@ import pMap from 'p-map'
|
|
|
6
6
|
import { loadConfig } from '~/config'
|
|
7
7
|
import { getPaths } from '~/paths'
|
|
8
8
|
|
|
9
|
+
const stripAnsi = (s: string): string => s.replaceAll(new RegExp(`${String.fromCodePoint(0x1b)}\\[[0-9;]*m`, 'gu'), '')
|
|
10
|
+
|
|
9
11
|
interface Classification {
|
|
10
12
|
errors: number
|
|
11
13
|
files: { mixed: string[]; native: string[]; scanned: string[] }
|
|
@@ -540,7 +542,7 @@ const fetchStepData = async (): Promise<AllStepsData> => {
|
|
|
540
542
|
|
|
541
543
|
const appendPipelineLog = async (line: string): Promise<void> => {
|
|
542
544
|
try {
|
|
543
|
-
await appendFile(getPaths().pipelineLog, `${line}\n`)
|
|
545
|
+
await appendFile(getPaths().pipelineLog, `${stripAnsi(line)}\n`)
|
|
544
546
|
} catch {
|
|
545
547
|
/* Empty */
|
|
546
548
|
}
|
|
@@ -557,7 +559,7 @@ const clearPipelineLog = async (): Promise<void> => {
|
|
|
557
559
|
const appendErrorLog = async (step: string, message: string): Promise<void> => {
|
|
558
560
|
try {
|
|
559
561
|
const ts = new Date().toISOString()
|
|
560
|
-
await appendFile(getPaths().errorsLog, `[${ts}] [${step}] ${message}\n`)
|
|
562
|
+
await appendFile(getPaths().errorsLog, `[${ts}] [${step}] ${stripAnsi(message)}\n`)
|
|
561
563
|
} catch {
|
|
562
564
|
/* Empty */
|
|
563
565
|
}
|
package/tui.tsx
CHANGED
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
writeNativeFileList
|
|
26
26
|
} from '~/tui-data'
|
|
27
27
|
|
|
28
|
+
const stripAnsi = (s: string): string => s.replaceAll(new RegExp(`${String.fromCodePoint(0x1b)}\\[[0-9;]*m`, 'gu'), '')
|
|
29
|
+
|
|
28
30
|
const DIM = '#888888'
|
|
29
31
|
const SIDEBAR_WIDTH = 38
|
|
30
32
|
|
|
@@ -110,7 +112,7 @@ const initialState: AppState = {
|
|
|
110
112
|
const reducer = (state: AppState, action: Action): AppState => {
|
|
111
113
|
switch (action.type) {
|
|
112
114
|
case 'APPEND_OUTPUT':
|
|
113
|
-
return { ...state, runningLines: [...state.runningLines.slice(-MAX_OUTPUT_LINES), action.line] }
|
|
115
|
+
return { ...state, runningLines: [...state.runningLines.slice(-MAX_OUTPUT_LINES), stripAnsi(action.line)] }
|
|
114
116
|
case 'CLEAR_FAILURE':
|
|
115
117
|
return { ...state, backgroundOcr: false, failed: false, runningCommand: null }
|
|
116
118
|
case 'COMMAND_DONE': {
|
|
@@ -137,7 +139,7 @@ const reducer = (state: AppState, action: Action): AppState => {
|
|
|
137
139
|
case 'SET_DATASET_RESULT':
|
|
138
140
|
return { ...state, datasetResult: action.result }
|
|
139
141
|
case 'SET_LOG':
|
|
140
|
-
return { ...state, logLines: action.lines }
|
|
142
|
+
return { ...state, logLines: action.lines.map(stripAnsi) }
|
|
141
143
|
case 'SET_PREFLIGHT':
|
|
142
144
|
return { ...state, preflightErrors: action.errors, preflightWarnings: action.warnings }
|
|
143
145
|
case 'SET_RUNNING_STATUS':
|