Switch to build script (#121)

* 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
This commit is contained in:
Will Hunt 2022-01-04 00:04:27 +00:00 committed by GitHub
parent f452cc7ed2
commit 4388930a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 2 deletions

1
changelog.d/111.bugfix Normal file
View File

@ -0,0 +1 @@
Fix an issue introduced in #111 that would cause the build to fail in CI.

View File

@ -12,6 +12,7 @@
} }
.warning { .warning {
color: black;
border: 2px solid #dda02f; border: 2px solid #dda02f;
border-left-width: 2px; border-left-width: 2px;
border-left-width: 5px; border-left-width: 5px;

View File

@ -20,7 +20,7 @@
"build:app:fix-defs": "ts-node scripts/definitions-fixer.ts src/libRs.d.ts", "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", "build:docs": "ts-node scripts/build-metrics-docs.ts > docs/metrics.md && mdbook build",
"dev:web": "snowpack dev", "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", "prepare": "yarn build",
"start": "node --require source-map-support/register lib/App/BridgeApp.js", "start": "node --require source-map-support/register lib/App/BridgeApp.js",
"start:app": "node --require source-map-support/register lib/App/BridgeApp.js", "start:app": "node --require source-map-support/register lib/App/BridgeApp.js",

13
scripts/build-app.sh Executable file
View File

@ -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

View File

@ -4,13 +4,15 @@ import { promises as fs } from "fs";
async function processDefFile() { async function processDefFile() {
const path = process.argv[process.argv.length-1]; const path = process.argv[process.argv.length-1];
// Read the whole file in to prevent us writing over ourselves. // Read the whole file in to prevent us writing over ourselves.
const file = await fs.readFile(path, "utf-8"); const file = await fs.readFile(path, "utf-8");
const out = await fs.open(path, 'w'); const out = await fs.open(path, 'w');
for (const line of file.split('\n')) { for (const line of file.split('\n')) {
const match = / {2}(\w+\.[\w.-]+):/g.exec(line); 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) => { processDefFile().catch((ex) => {