mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 13:17:08 +00:00

* Switch to build script * temp: export the result of the types build * changelog * Get output result * Remove debug code * Fix warning visibility * Move the web build between the rust steps. * Add debugging again * Close file, and await promises * drop the dumb cat
22 lines
694 B
TypeScript
22 lines
694 B
TypeScript
/* eslint-disable no-console */
|
|
// Workaround to https://github.com/napi-rs/napi-rs/issues/986
|
|
import { promises as fs } from "fs";
|
|
|
|
async function processDefFile() {
|
|
const path = process.argv[process.argv.length-1];
|
|
|
|
// Read the whole file in to prevent us writing over ourselves.
|
|
const file = await fs.readFile(path, "utf-8");
|
|
const out = await fs.open(path, 'w');
|
|
for (const line of file.split('\n')) {
|
|
const match = / {2}(\w+\.[\w.-]+):/g.exec(line);
|
|
await out.write((match ? line.replace(match[1], `"${match[1]}"`) : line) + "\n");
|
|
}
|
|
await out.close();
|
|
}
|
|
|
|
processDefFile().catch((ex) => {
|
|
console.error('Failed to process def file!', ex);
|
|
process.exit(1);
|
|
})
|