Fix build scripts so a failure returns a nonzero exit code

This commit is contained in:
Keavon Chambers 2023-01-02 22:04:13 -08:00
parent de5d02da00
commit 5ca6b3fafa
4 changed files with 35 additions and 23 deletions

View File

@ -1,17 +1,20 @@
#!/bin/sh
# Switch to the correct branch
if [[ -z "${CF_PAGES_BRANCH}" ]]; then
git switch master || git switch -c unknown-branch
else
git switch $CF_PAGES_BRANCH || git switch -c $CF_PAGES_BRANCH
fi
# Install the latest version of the Rust toolchain
echo 🔧 Install Rust
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:/opt/buildhome/.cargo/bin
echo rustc version:
rustc --version
# Install the project's Node dependencies through npm
echo 🚧 Install Node dependencies
echo node version:
node --version
@ -20,9 +23,11 @@ npm --version
cd frontend
npm ci
# Install the cargo-about Rust dependency that's used during the Webpack build process (in `vue.config.js`)
echo 📦 Install cargo-about
cargo install cargo-about
# Build for production
echo 👷 Build Graphite web client
export NODE_ENV=production
npm run build

View File

@ -14,7 +14,6 @@ accepted = [
]
ignore-build-dependencies = true
ignore-dev-dependencies = true
workarounds = ["ring"]
# https://raw.githubusercontent.com/briansmith/webpki/main/LICENSE

View File

@ -1,23 +1,19 @@
{
"name": "graphite-web-frontend",
"description": "Graphite's web app frontend. Planned to be replaced by a native GUI written in Rust in the future.",
"private": true,
"scripts": {
"start": "vue-cli-service serve",
"serve": "vue-cli-service serve || echo 'Graphite project failed to build. Did you remember to `npm install` the dependencies?'",
"build": "vue-cli-service build || echo 'Graphite project failed to build. Did you remember to `npm install` the dependencies?'",
"lint": "vue-cli-service lint || echo 'Graphite project had lint errors or otherwise failed. In the latter case, did you remember to `npm install` the dependencies?'",
"lint-no-fix": "vue-cli-service lint --no-fix || echo 'Graphite project had lint errors or otherwise failed. In the latter case, did you remember to `npm install` the dependencies?'",
"tauri:build": "vue-cli-service tauri:build",
"tauri:serve": "vue-cli-service tauri:serve"
},
"repository": {
"type": "git",
"url": "git+https://github.com/GraphiteEditor/Graphite.git"
},
"description": "Graphite's web app frontend. Planned to be replaced by a native GUI written in Rust in the future.",
"author": "Graphite Authors <contact@graphite.rs>",
"license": "Apache-2.0",
"homepage": "https://graphite.rs",
"scripts": {
"start": "npm run serve",
"serve": "vue-cli-service serve || (npm run print-building-help && exit 1)",
"build": "vue-cli-service build || (npm run print-building-help && exit 1)",
"lint": "vue-cli-service lint || (npm run print-linting-help && exit 1)",
"lint-no-fix": "vue-cli-service lint --no-fix || (npm run print-linting-help && exit 1)",
"tauri:build": "vue-cli-service tauri:build",
"tauri:serve": "vue-cli-service tauri:serve",
"print-building-help": "echo 'Graphite project failed to build. Did you remember to `npm install` the dependencies in `/frontend`?'",
"print-linting-help": "echo 'Graphite project had lint errors, or may have otherwise failed. In the latter case, did you remember to `npm install` the dependencies in `/frontend`?'"
},
"dependencies": {
"@tauri-apps/api": "^1.2.0",
"class-transformer": "^0.5.1",
@ -49,8 +45,14 @@
"vue-loader": "^17.0.1",
"vue-template-compiler": "^2.7.14"
},
"//": "Notes about dependency issues and incompatibilities should be added here when needed.",
"homepage": "https://graphite.rs",
"license": "Apache-2.0",
"optionalDependencies": {
"wasm-pack": "^0.10.3"
},
"//": "Notes about dependency issues and incompatibilities should be added here when needed."
"repository": {
"type": "git",
"url": "git+https://github.com/GraphiteEditor/Graphite.git"
}
}

View File

@ -85,11 +85,17 @@ function formatThirdPartyLicenses(jsLicenses) {
if (rustLicenses === undefined) {
// This is probably caused by cargo about not being installed
console.error(`
Could not run \`cargo about\`, which is required to generate license information.
To install cargo-about on your system, you can run:
cargo install cargo-about
License information is required on production builds. Aborting.`);
console.error(
`
Could not run \`cargo about\`, which is required to generate license information.
To install cargo-about on your system, you can run \`cargo install cargo-about\`.
License information is required on production builds. Aborting.
`
.trim()
.split("\n")
.map((line) => line.trim())
.join("\n")
);
process.exit(1);
}
}