@kud/gh-cockpit 0.4.15 → 0.4.16
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/index.js +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -131,6 +131,8 @@ var processLog = (raw) => {
|
|
|
131
131
|
const jumpTo = firstError >= 0 ? Math.max(0, firstError - 3) : Math.max(0, lines.length - 1);
|
|
132
132
|
return { lines, jumpTo };
|
|
133
133
|
};
|
|
134
|
+
var ANSI = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g;
|
|
135
|
+
var stripAnsi = (s) => s.replace(ANSI, "");
|
|
134
136
|
var CheckLogView = ({
|
|
135
137
|
repo,
|
|
136
138
|
jobId,
|
|
@@ -141,8 +143,11 @@ var CheckLogView = ({
|
|
|
141
143
|
const [state, setState] = useState({ phase: "loading" });
|
|
142
144
|
useEffect(() => {
|
|
143
145
|
let live = true;
|
|
144
|
-
$`gh api repos/${repo}/actions/jobs/${jobId}/logs`.quiet().then(
|
|
145
|
-
(r) => live && setState({
|
|
146
|
+
$`gh api --allow-escape-sequences repos/${repo}/actions/jobs/${jobId}/logs`.quiet().then(
|
|
147
|
+
(r) => live && setState({
|
|
148
|
+
phase: "ready",
|
|
149
|
+
lines: stripAnsi(r.stdout).split("\n")
|
|
150
|
+
})
|
|
146
151
|
).catch(
|
|
147
152
|
(e) => live && setState({ phase: "error", message: e.message })
|
|
148
153
|
);
|
package/package.json
CHANGED