break things up, do some proper mediawiki API stuff to support editing
This commit is contained in:
parent
64eb4da894
commit
e3af35a68e
4 changed files with 260 additions and 101 deletions
20
util.mjs
Normal file
20
util.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// misc helpers
|
||||
|
||||
import {execSync} from 'node:child_process';
|
||||
|
||||
/**
|
||||
* terrible terrible terrible string diff helper for debugging
|
||||
* @param {string} a
|
||||
* @param {string} b
|
||||
*/
|
||||
export function diff (a, b) {
|
||||
// base64 input strings before passing to shell to avoid escaping issues
|
||||
// https://stackoverflow.com/a/60221847
|
||||
// also use `|| true` to not throw an error when `diff` returns non-zero
|
||||
execSync(`bash -c '
|
||||
diff --color -u <(echo ${btoa(a)} | base64 -d) <(echo ${btoa(b)} | base64 -d)
|
||||
' || true`, {
|
||||
// display result directly in terminal
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue