diff --git a/changelog.d/111.bugfix b/changelog.d/111.bugfix new file mode 100644 index 00000000..ec420fa1 --- /dev/null +++ b/changelog.d/111.bugfix @@ -0,0 +1 @@ +Fix an issue introduced in #111 that would cause the build to fail in CI. \ No newline at end of file diff --git a/docs/_site/style.css b/docs/_site/style.css index d8cdcc47..7971d15b 100644 --- a/docs/_site/style.css +++ b/docs/_site/style.css @@ -12,6 +12,7 @@ } .warning { + color: black; border: 2px solid #dda02f; border-left-width: 2px; border-left-width: 5px; diff --git a/package.json b/package.json index ee0ca48c..9cbf5690 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build:app:fix-defs": "ts-node scripts/definitions-fixer.ts src/libRs.d.ts", "build:docs": "ts-node scripts/build-metrics-docs.ts > docs/metrics.md && mdbook build", "dev:web": "snowpack dev", - "build": "yarn run build:web && yarn run build:app:rs && yarn run build:app:fix-defs && yarn run build:app", + "build": "scripts/build-app.sh", "prepare": "yarn build", "start": "node --require source-map-support/register lib/App/BridgeApp.js", "start:app": "node --require source-map-support/register lib/App/BridgeApp.js", diff --git a/scripts/build-app.sh b/scripts/build-app.sh new file mode 100755 index 00000000..149d0d5d --- /dev/null +++ b/scripts/build-app.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# exit when any command fails +set -e + +echo "Building web" +yarn run build:web +echo "Building Rust layer" +yarn run build:app:rs +echo "Running rust-typescript definitions fix" +yarn run build:app:fix-defs +echo "Building Typescript layer" +yarn run build:app diff --git a/scripts/definitions-fixer.ts b/scripts/definitions-fixer.ts index 90808c2d..42718e48 100644 --- a/scripts/definitions-fixer.ts +++ b/scripts/definitions-fixer.ts @@ -4,13 +4,15 @@ 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); - out.write((match ? line.replace(match[1], `"${match[1]}"`) : line) + "\n"); + await out.write((match ? line.replace(match[1], `"${match[1]}"`) : line) + "\n"); } + await out.close(); } processDefFile().catch((ex) => {