mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Add Taskfile for unified dev workflow across all components (#6080)
## Add Taskfile for unified dev workflow ### Summary - Introduces [Taskfile](https://taskfile.dev/) as the single CLI entry point for all development workflows across backend, frontend, engine, Docker, and desktop - ~80 tasks organized into 6 namespaces: `backend:`, `frontend:`, `engine:`, `docker:`, `desktop:`, plus root-level composites - All CI workflows migrated to use Task - Deletes `engine/Makefile` and `scripts/build-tauri-jlink.{sh,bat}` — replaced by Task equivalents - Removes redundant npm scripts (`dev`, `build`, `prep`, `lint`, `test`, `typecheck:all`) from `package.json` - Smart dependency caching: `sources`/`status`/`generates` fingerprinting, CI-aware `npm ci` vs `npm install`, `run: once` for parallel dep deduplication ### What this does NOT do - Does not replace Gradle, npm, or Docker — Taskfile is a thin orchestration wrapper - Does not change application code or behavior ### Install ``` npm install -g @go-task/cli # or: brew install go-task, winget install Task.Task ``` ### Quick start ``` task --list # discover all tasks task install # install all deps task dev # start backend + frontend task dev:all # also start AI engine task test # run all tests task check # quick quality gate (local dev) task check:all # full CI quality gate ``` ### Test plan - [ ] Install `task` CLI and run `task --list` — verify all tasks display - [ ] Run `task install` — verify frontend + engine deps install - [ ] Run `task dev` — verify backend + frontend start, Ctrl+C exits cleanly - [ ] Run `task frontend:check` — verify typecheck + lint + test pass - [ ] Run `task desktop:dev` — verify jlink builds are cached on second run - [ ] Verify CI passes on all workflows --------- Co-authored-by: James Brunton <[email protected]>
This commit is contained in:
co-authored by
James Brunton
parent
4cf797ab75
commit
702f4e5c2c
+50
-116
@@ -1,145 +1,79 @@
|
||||
# Frontend
|
||||
|
||||
All frontend commands are run from the repository root using [Task](https://taskfile.dev/):
|
||||
|
||||
- `task frontend:dev` — start Vite dev server (localhost:5173)
|
||||
- `task frontend:build` — production build
|
||||
- `task frontend:test` — run tests
|
||||
- `task frontend:test:watch` — run tests in watch mode
|
||||
- `task frontend:lint` — run ESLint + cycle detection
|
||||
- `task frontend:typecheck` — run TypeScript type checking
|
||||
- `task frontend:check` — run typecheck + lint + test
|
||||
- `task frontend:install` — install npm dependencies
|
||||
|
||||
For desktop app development, see the [Tauri](#tauri) section below.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
The frontend requires environment variables to be set before running. `npm run dev` will create a `.env` file for you automatically on first run using the defaults from `config/.env.example` - for most development work this is all you need.
|
||||
The frontend requires environment variables to be set before running. `task frontend:dev` will create a `.env` file for you automatically on first run using the defaults from `config/.env.example` - for most development work this is all you need.
|
||||
|
||||
If you need to configure specific services (Google Drive, Supabase, Stripe, PostHog), edit your local `.env` file. The values in `config/.env.example` show what each variable does and provides sensible defaults where applicable.
|
||||
|
||||
For desktop (Tauri) development, `npm run tauri-dev` will additionally create a `.env.desktop` file from `config/.env.desktop.example`.
|
||||
For desktop (Tauri) development, `task desktop:dev` will additionally create a `.env.desktop` file from `config/.env.desktop.example`.
|
||||
|
||||
## Docker Setup
|
||||
|
||||
For Docker deployments and configuration, see the [Docker README](../docker/README.md).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||
|
||||
|
||||
## Tauri
|
||||
In order to run Tauri, you first have to build the Java backend for Tauri to use.
|
||||
|
||||
**macOS/Linux:**
|
||||
|
||||
From the root of the repo, run:
|
||||
|
||||
```bash
|
||||
./gradlew clean build
|
||||
./scripts/build-tauri-jlink.sh
|
||||
```
|
||||
|
||||
**Windows**
|
||||
|
||||
From the root of the repo, run:
|
||||
|
||||
```batch
|
||||
gradlew clean build
|
||||
scripts\build-tauri-jlink.bat
|
||||
```
|
||||
|
||||
### Testing the Bundled Runtime
|
||||
|
||||
Before building the full Tauri app, you can test the bundled runtime:
|
||||
|
||||
**macOS/Linux:**
|
||||
```bash
|
||||
./frontend/src-tauri/runtime/launch-stirling.sh
|
||||
```
|
||||
|
||||
**Windows:**
|
||||
```cmd
|
||||
frontend\src-tauri\runtime\launch-stirling.bat
|
||||
```
|
||||
|
||||
This will start Stirling-PDF using the bundled JRE, accessible at http://localhost:8080
|
||||
All desktop tasks are available via [Task](https://taskfile.dev). From the root of the repo:
|
||||
|
||||
### Dev
|
||||
To run Tauri in development. Use the command in the `frontend` folder:
|
||||
|
||||
```bash
|
||||
npm run tauri-dev
|
||||
task desktop:dev
|
||||
```
|
||||
|
||||
This will run the gradle runboot command and the tauri dev command concurrently, starting the app once both are stable.
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> Desktop builds require additional environment variables. See [Environment Variables](#environment-variables)
|
||||
> above - `npm run tauri-dev` will set these up automatically from `config/.env.desktop.example` on first run.
|
||||
This ensures the JLink runtime and backend JAR exist (skipping if already built), then starts Tauri in dev mode.
|
||||
|
||||
### Build
|
||||
To build a deployment of the Tauri app. Use this command in the `frontend` folder:
|
||||
|
||||
```bash
|
||||
npm run tauri-build
|
||||
task desktop:build
|
||||
```
|
||||
|
||||
This will bundle the backend and frontend into one executable for each target. Targets can be set within the `tauri.conf.json` file.
|
||||
This does a full clean rebuild of the backend JAR and JLink runtime, then builds the Tauri app for production.
|
||||
|
||||
Platform-specific dev builds are also available:
|
||||
|
||||
```bash
|
||||
task desktop:build:dev # No bundling
|
||||
task desktop:build:dev:mac # macOS .app bundle
|
||||
task desktop:build:dev:windows # Windows NSIS installer
|
||||
task desktop:build:dev:linux # Linux AppImage
|
||||
```
|
||||
|
||||
### JLink Tasks
|
||||
|
||||
You can also run JLink steps individually:
|
||||
|
||||
```bash
|
||||
task desktop:jlink # Build JAR + create JLink runtime
|
||||
task desktop:jlink:jar # Build backend JAR only
|
||||
task desktop:jlink:runtime # Create JLink custom JRE only
|
||||
task desktop:jlink:clean # Remove JLink artifacts
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
task desktop:clean
|
||||
```
|
||||
|
||||
Removes all desktop build artifacts including JLink runtime, bundled JARs, Cargo build, and dist/build directories.
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> Desktop builds require additional environment variables. See [Environment Variables](#environment-variables)
|
||||
> above - `npm run tauri-build` will set these up automatically from `config/.env.desktop.example` on first run.
|
||||
> above - `task desktop:dev` will set these up automatically from `config/.env.desktop.example` on first run.
|
||||
|
||||
@@ -79,58 +79,6 @@
|
||||
"web-vitals": "^5.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prep": "tsx scripts/setup-env.ts && npm run generate-icons",
|
||||
"prep:saas": "tsx scripts/setup-env.ts --saas && npm run generate-icons",
|
||||
"prep:desktop": "tsx scripts/setup-env.ts --desktop && npm run generate-icons",
|
||||
"prep:desktop-build": "node scripts/build-provisioner.mjs && npm run prep:desktop",
|
||||
"dev": "npm run prep && vite",
|
||||
"dev:core": "npm run prep && vite --mode core",
|
||||
"dev:proprietary": "npm run prep && vite --mode proprietary",
|
||||
"dev:saas": "npm run prep:saas && vite --mode saas",
|
||||
"dev:desktop": "npm run prep:desktop && vite --mode desktop",
|
||||
"dev:prototypes": "npm run prep && vite --mode prototypes",
|
||||
"fix": "npm run format && npm run lint:fix",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"lint": "npm run lint:eslint && npm run lint:cycles",
|
||||
"lint:eslint": "eslint --max-warnings=0",
|
||||
"lint:fix": "eslint --fix",
|
||||
"lint:cycles": "dpdm src --circular --no-warning --no-tree --exit-code circular:1",
|
||||
"build": "npm run prep && vite build",
|
||||
"build:core": "npm run prep && vite build --mode core",
|
||||
"build:proprietary": "npm run prep && vite build --mode proprietary",
|
||||
"build:saas": "npm run prep:saas && vite build --mode saas",
|
||||
"build:desktop": "npm run prep:desktop && vite build --mode desktop",
|
||||
"build:prototypes": "npm run prep && vite build --mode prototypes",
|
||||
"preview": "vite preview",
|
||||
"tauri-dev": "npm run prep:desktop && tauri dev --no-watch",
|
||||
"tauri-build": "npm run prep:desktop-build && tauri build",
|
||||
"_tauri-build-dev": "npm run prep:desktop && tauri build",
|
||||
"tauri-build-dev": "npm run _tauri-build-dev -- --no-bundle",
|
||||
"tauri-build-dev-mac": "npm run _tauri-build-dev -- --bundles app",
|
||||
"tauri-build-dev-windows": "npm run _tauri-build-dev -- --bundles nsis",
|
||||
"tauri-build-dev-linux": "npm run _tauri-build-dev -- --bundles appimage",
|
||||
"tauri-clean": "cd src-tauri && cargo clean && cd .. && rm -rf dist build",
|
||||
"typecheck": "npm run typecheck:proprietary",
|
||||
"typecheck:core": "tsc --noEmit --project src/core/tsconfig.json",
|
||||
"typecheck:proprietary": "tsc --noEmit --project src/proprietary/tsconfig.json",
|
||||
"typecheck:saas": "tsc --noEmit --project src/saas/tsconfig.json",
|
||||
"typecheck:desktop": "tsc --noEmit --project src/desktop/tsconfig.json",
|
||||
"typecheck:prototypes": "tsc --noEmit --project src/prototypes/tsconfig.json",
|
||||
"typecheck:scripts": "tsc --noEmit --project scripts/tsconfig.json",
|
||||
"typecheck:all": "npm run typecheck:core && npm run typecheck:proprietary && npm run typecheck:saas && npm run typecheck:desktop && npm run typecheck:prototypes && npm run typecheck:scripts",
|
||||
"check": "npm run typecheck && npm run lint && npm run test:run",
|
||||
"generate-licenses": "node scripts/generate-licenses.js",
|
||||
"generate-icons": "node scripts/generate-icons.js",
|
||||
"generate-icons:verbose": "node scripts/generate-icons.js --verbose",
|
||||
"generate-sample-pdf": "node scripts/sample-pdf/generate.mjs",
|
||||
"test": "vitest",
|
||||
"test:run": "vitest run",
|
||||
"test:watch": "vitest --watch",
|
||||
"test:coverage": "vitest --coverage",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:install": "playwright install",
|
||||
"update:minor": "npm outdated || npm update --before=$(date -v-7d +%Y-%m-%d) && (npm audit fix --before=$(date -v-7d +%Y-%m-%d) || true) && npm test",
|
||||
"update:major": "npx npm-check-updates -u && npm install",
|
||||
"update:interactive": "npx npm-check-updates -i",
|
||||
|
||||
@@ -68,7 +68,7 @@ export default defineConfig({
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: {
|
||||
command: "npm run dev",
|
||||
command: "npx vite",
|
||||
url: "http://localhost:5173",
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173",
|
||||
"beforeDevCommand": "npm run dev -- --mode desktop",
|
||||
"beforeBuildCommand": "node scripts/build-provisioner.mjs && npm run build -- --mode desktop"
|
||||
"beforeDevCommand": "npx vite --mode desktop",
|
||||
"beforeBuildCommand": "npx vite build --mode desktop"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
|
||||
Reference in New Issue
Block a user