Replace npm build script with new cargo run tool (#3832)

* move nix flake to root

* cargo run tool

* use thiserror in third-party-licenses tool

* prefere panic over exit

* Add automatic dependency check to cargo run tool

* Skip dependecies that are not needed for the current task

* Fixup

* Fixup

* fix windows

* Fixup

* improve usage text

* Fix linux bundle

* add graphen-cli

* fix build profile

* fix

* release profile should not include debug infos

* Review

* remove profiling profile

was redundent with release

* rename to cargo-run tool

* improve consistency

* rename deps to requirements

* fix

* return success when showing usage
This commit is contained in:
Timon
2026-03-07 14:26:19 +01:00
committed by GitHub
parent 50ef6e15cb
commit 5d22292072
39 changed files with 664 additions and 404 deletions

View File

@@ -12,21 +12,10 @@ To begin working with the Graphite codebase, you will need to set up the project
## Dependencies
Graphite is built with Rust and web technologies, which means you will need to install:
- [Node.js](https://nodejs.org/) (the latest LTS version)
- [Rust](https://www.rust-lang.org/) (the latest stable release)
- [Node.js](https://nodejs.org/) (the latest LTS version)
- [Git](https://git-scm.com/) (any recent version)
Next, install the dependencies required for development builds:
```sh
cargo install -f wasm-bindgen-cli@0.2.100
cargo install wasm-pack
cargo install cargo-watch
cargo install cargo-about
```
Regarding the last one: you'll likely get faster build times if you manually install that specific version of `wasm-bindgen-cli`. It is supposed to be installed automatically but a version mismatch causes it to reinstall every single recompilation. It may need to be manually updated periodically to match the version of the `wasm-bindgen` dependency in [`Cargo.toml`](https://github.com/GraphiteEditor/Graphite/blob/master/Cargo.toml).
## Repository
Clone the project to a convenient location:
@@ -40,7 +29,7 @@ git clone https://github.com/GraphiteEditor/Graphite.git
From either the `/` (root) or `/frontend` directories, you can run the project by executing:
```sh
npm start
cargo run
```
This spins up the dev server at <http://localhost:8080> with a file watcher that performs hot reloading of the web page. You should be able to start the server, edit and save web and Rust code, and shut it down by double pressing <kbd>Ctrl</kbd><kbd>C</kbd>. TypeScript and HTML changes require a manual page reload to fix broken state.
@@ -53,28 +42,9 @@ This method compiles Graphite code in debug mode which includes debug symbols fo
On rare occasions (like while running advanced performance profiles or proxying the dev server connection over a slow network where the >100 MB unoptimized binary size would pose an issue), you may need to run the dev server with release optimizations. To do that while keeping debug symbols:
```sh
npm run profiling
cargo run release
```
To run the dev server without debug symbols, using the same release optimizations as production builds:
```sh
npm run production
```
</details>
<details>
<summary>Production build instructions: click here</summary>
You'll rarely need to compile your own production builds because our CI/CD system takes care of deployments. However, you can compile a production build with full optimizations by running:
```sh
npm run build
```
This produces the `/frontend/dist` directory containing the static site files that must be served by your own web server.
</details>
## Development tooling