mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
chore: address restructure PR review feedback (#6423)
This commit is contained in:
+26
-15
@@ -31,52 +31,60 @@ tasks:
|
|||||||
provisioner:
|
provisioner:
|
||||||
desc: "Build installer provisioner"
|
desc: "Build installer provisioner"
|
||||||
platforms: [windows]
|
platforms: [windows]
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- node editor/scripts/build-provisioner.mjs
|
- node scripts/build-provisioner.mjs
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
desc: "Start Tauri desktop dev mode"
|
desc: "Start Tauri desktop dev mode"
|
||||||
deps: [prepare]
|
deps: [prepare]
|
||||||
ignore_error: true
|
ignore_error: true
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- cd editor && npx tauri dev --no-watch
|
- npx tauri dev --no-watch
|
||||||
|
|
||||||
build:
|
build:
|
||||||
desc: "Build Tauri desktop app (production)"
|
desc: "Build Tauri desktop app (production)"
|
||||||
deps: [prepare]
|
deps: [prepare]
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- cd editor && npx tauri build
|
- npx tauri build
|
||||||
|
|
||||||
build:dev:
|
build:dev:
|
||||||
desc: "Build Tauri desktop app (dev, no bundling)"
|
desc: "Build Tauri desktop app (dev, no bundling)"
|
||||||
deps: [prepare]
|
deps: [prepare]
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- cd editor && npx tauri build --no-bundle
|
- npx tauri build --no-bundle
|
||||||
|
|
||||||
build:dev:mac:
|
build:dev:mac:
|
||||||
desc: "Build Tauri desktop .app bundle (macOS)"
|
desc: "Build Tauri desktop .app bundle (macOS)"
|
||||||
deps: [prepare]
|
deps: [prepare]
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- cd editor && npx tauri build --bundles app
|
- npx tauri build --bundles app
|
||||||
|
|
||||||
build:dev:windows:
|
build:dev:windows:
|
||||||
desc: "Build Tauri desktop NSIS installer (Windows)"
|
desc: "Build Tauri desktop NSIS installer (Windows)"
|
||||||
deps: [prepare]
|
deps: [prepare]
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- cd editor && npx tauri build --bundles nsis
|
- npx tauri build --bundles nsis
|
||||||
|
|
||||||
build:dev:linux:
|
build:dev:linux:
|
||||||
desc: "Build Tauri desktop AppImage (Linux)"
|
desc: "Build Tauri desktop AppImage (Linux)"
|
||||||
deps: [prepare]
|
deps: [prepare]
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- cd editor && npx tauri build --bundles appimage
|
- npx tauri build --bundles appimage
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
desc: "Clean Tauri/Cargo build artifacts"
|
desc: "Clean Tauri/Cargo build artifacts"
|
||||||
|
dir: editor
|
||||||
cmds:
|
cmds:
|
||||||
- task: jlink:clean
|
- task: jlink:clean
|
||||||
- cd editor/src-tauri && cargo clean
|
- cd src-tauri && cargo clean
|
||||||
- rm -rf editor/dist editor/build
|
- rm -rf dist build
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# JLink — Build bundled Java runtime for Tauri
|
# JLink — Build bundled Java runtime for Tauri
|
||||||
@@ -106,9 +114,10 @@ tasks:
|
|||||||
jlink:runtime:
|
jlink:runtime:
|
||||||
desc: "Create custom JRE with jlink"
|
desc: "Create custom JRE with jlink"
|
||||||
deps: [jlink:jar]
|
deps: [jlink:jar]
|
||||||
|
dir: editor/src-tauri
|
||||||
cmds:
|
cmds:
|
||||||
- rm -rf editor/src-tauri/runtime/jre
|
- rm -rf runtime/jre
|
||||||
- mkdir -p editor/src-tauri/runtime
|
- mkdir -p runtime
|
||||||
- >-
|
- >-
|
||||||
jlink
|
jlink
|
||||||
--add-modules {{.JLINK_MODULES}}
|
--add-modules {{.JLINK_MODULES}}
|
||||||
@@ -116,14 +125,15 @@ tasks:
|
|||||||
--compress=zip-6
|
--compress=zip-6
|
||||||
--no-header-files
|
--no-header-files
|
||||||
--no-man-pages
|
--no-man-pages
|
||||||
--output editor/src-tauri/runtime/jre
|
--output runtime/jre
|
||||||
status:
|
status:
|
||||||
- test -d editor/src-tauri/runtime/jre
|
- test -d editor/src-tauri/runtime/jre
|
||||||
|
|
||||||
jlink:clean:
|
jlink:clean:
|
||||||
desc: "Remove JLink runtime and bundled JARs"
|
desc: "Remove JLink runtime and bundled JARs"
|
||||||
|
dir: editor/src-tauri
|
||||||
cmds:
|
cmds:
|
||||||
- rm -rf editor/src-tauri/libs editor/src-tauri/runtime
|
- rm -rf libs runtime
|
||||||
|
|
||||||
# macOS-only. Replaces jlink:runtime's single-arch JRE with a universal
|
# macOS-only. Replaces jlink:runtime's single-arch JRE with a universal
|
||||||
# (arm64 + x86_64) one for the universal Tauri shell. Runs the x86_64
|
# (arm64 + x86_64) one for the universal Tauri shell. Runs the x86_64
|
||||||
@@ -134,8 +144,9 @@ tasks:
|
|||||||
desc: "Create universal (arm64+x86_64) JRE for the macOS Tauri build"
|
desc: "Create universal (arm64+x86_64) JRE for the macOS Tauri build"
|
||||||
deps: [jlink:jar]
|
deps: [jlink:jar]
|
||||||
platforms: [darwin]
|
platforms: [darwin]
|
||||||
|
dir: editor
|
||||||
env:
|
env:
|
||||||
JLINK_MODULES: "{{.JLINK_MODULES}}"
|
JLINK_MODULES: "{{.JLINK_MODULES}}"
|
||||||
OUTPUT_DIR: editor/src-tauri/runtime/jre
|
OUTPUT_DIR: src-tauri/runtime/jre
|
||||||
cmds:
|
cmds:
|
||||||
- editor/scripts/build-universal-mac-jre.sh
|
- scripts/build-universal-mac-jre.sh
|
||||||
|
|||||||
+12
-8
@@ -196,9 +196,13 @@ if (buildPrototypes) {
|
|||||||
}
|
}
|
||||||
def frontendBuildTask = "frontend:build:${frontendMode}"
|
def frontendBuildTask = "frontend:build:${frontendMode}"
|
||||||
|
|
||||||
|
// Workspace root holds package.json and node_modules (shared across editor /
|
||||||
|
// future portal). Editor-specific paths (src, public, dist, tauri) live one
|
||||||
|
// level deeper under frontend/editor/. When the portal lands as an embedded
|
||||||
|
// app, add a sibling frontendPortalDir / frontendPortalDistDir alongside.
|
||||||
def frontendDir = file('../../frontend')
|
def frontendDir = file('../../frontend')
|
||||||
def frontendEditorDir = file('../../frontend/editor')
|
def frontendEditorDir = file('../../frontend/editor')
|
||||||
def frontendDistDir = file('../../frontend/editor/dist')
|
def frontendEditorDistDir = file('../../frontend/editor/dist')
|
||||||
def resourcesStaticDir = file('src/main/resources/static')
|
def resourcesStaticDir = file('src/main/resources/static')
|
||||||
def generatedFrontendPaths = [
|
def generatedFrontendPaths = [
|
||||||
'assets',
|
'assets',
|
||||||
@@ -263,13 +267,13 @@ tasks.register('npmBuild', Exec) {
|
|||||||
doNotTrackState("Frontend build depends on untracked npmInstall task")
|
doNotTrackState("Frontend build depends on untracked npmInstall task")
|
||||||
enabled = buildWithFrontend
|
enabled = buildWithFrontend
|
||||||
group = 'frontend'
|
group = 'frontend'
|
||||||
description = 'Build frontend application'
|
description = 'Build editor frontend application'
|
||||||
workingDir file('../..')
|
workingDir file('../..')
|
||||||
commandLine = ['task', frontendBuildTask]
|
commandLine = ['task', frontendBuildTask]
|
||||||
inputs.dir(new File(frontendEditorDir, 'src'))
|
inputs.dir(new File(frontendEditorDir, 'src'))
|
||||||
inputs.dir(new File(frontendEditorDir, 'public'))
|
inputs.dir(new File(frontendEditorDir, 'public'))
|
||||||
inputs.file(new File(frontendDir, 'package.json'))
|
inputs.file(new File(frontendDir, 'package.json'))
|
||||||
outputs.dir(frontendDistDir)
|
outputs.dir(frontendEditorDistDir)
|
||||||
|
|
||||||
// Show live output
|
// Show live output
|
||||||
standardOutput = System.out
|
standardOutput = System.out
|
||||||
@@ -280,17 +284,17 @@ tasks.register('npmBuild', Exec) {
|
|||||||
environment 'VITE_API_BASE_URL', '/'
|
environment 'VITE_API_BASE_URL', '/'
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
println "Building frontend application for production (mode=${frontendMode}, VITE_API_BASE_URL=/)"
|
println "Building editor frontend application for production (mode=${frontendMode}, VITE_API_BASE_URL=/)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('copyFrontendAssets', Copy) {
|
tasks.register('copyFrontendAssets', Copy) {
|
||||||
enabled = buildWithFrontend
|
enabled = buildWithFrontend
|
||||||
group = 'frontend'
|
group = 'frontend'
|
||||||
description = 'Copy frontend build to static resources'
|
description = 'Copy editor frontend build to static resources'
|
||||||
dependsOn npmBuild
|
dependsOn npmBuild
|
||||||
dependsOn cleanFrontendAssets
|
dependsOn cleanFrontendAssets
|
||||||
from(frontendDistDir) {
|
from(frontendEditorDistDir) {
|
||||||
// Exclude files that conflict with backend static resources
|
// Exclude files that conflict with backend static resources
|
||||||
exclude 'robots.txt' // Backend already has this
|
exclude 'robots.txt' // Backend already has this
|
||||||
exclude 'favicon.ico' // Backend already has this
|
exclude 'favicon.ico' // Backend already has this
|
||||||
@@ -298,7 +302,7 @@ tasks.register('copyFrontendAssets', Copy) {
|
|||||||
into resourcesStaticDir
|
into resourcesStaticDir
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE // Let frontend overwrite when needed
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE // Let frontend overwrite when needed
|
||||||
doFirst {
|
doFirst {
|
||||||
println "Copying frontend build from ${frontendDistDir} to ${resourcesStaticDir}..."
|
println "Copying frontend build from ${frontendEditorDistDir} to ${resourcesStaticDir}..."
|
||||||
println "Backend static resources will be preserved"
|
println "Backend static resources will be preserved"
|
||||||
}
|
}
|
||||||
doLast {
|
doLast {
|
||||||
@@ -330,7 +334,7 @@ tasks.named('copyFrontendAssets').configure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buildWithFrontend) {
|
if (buildWithFrontend) {
|
||||||
println "Frontend build enabled - JAR will include React frontend (mode=${frontendMode})"
|
println "Editor frontend build enabled - JAR will include React frontend (mode=${frontendMode})"
|
||||||
processResources.dependsOn copyFrontendAssets
|
processResources.dependsOn copyFrontendAssets
|
||||||
} else {
|
} else {
|
||||||
println "Frontend build disabled - JAR will be backend-only with API landing page"
|
println "Frontend build disabled - JAR will be backend-only with API landing page"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
dist/
|
dist/
|
||||||
dist-portal/
|
dist-portal/
|
||||||
editor/dist/
|
editor/dist/
|
||||||
# Tauri/Cargo build output (binary assets named *.js etc. confuse Prettier)
|
# Tauri/Cargo build output (binary assets named *.js etc. confuse Prettier).
|
||||||
editor/src-tauri/target/
|
# Match nested target/ dirs too — provisioner/ and thumbnail-handler/ each
|
||||||
|
# have their own Cargo workspace under src-tauri/.
|
||||||
|
editor/src-tauri/**/target/
|
||||||
editor/src-tauri/gen/
|
editor/src-tauri/gen/
|
||||||
node_modules/
|
node_modules/
|
||||||
editor/public/vendor/
|
editor/public/vendor/
|
||||||
|
|||||||
@@ -6,9 +6,18 @@
|
|||||||
* Vite automatically layers these `.local` files on top of the committed ones.
|
* Vite automatically layers these `.local` files on top of the committed ones.
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* tsx scripts/setup-env.ts # ensures .env.local
|
* tsx scripts/setup-env.mts # ensures .env.local
|
||||||
* tsx scripts/setup-env.ts --desktop # also ensures .env.desktop.local
|
* tsx scripts/setup-env.mts --desktop # also ensures .env.desktop.local
|
||||||
* tsx scripts/setup-env.ts --saas # also ensures .env.saas.local
|
* tsx scripts/setup-env.mts --saas # also ensures .env.saas.local
|
||||||
|
*
|
||||||
|
* Why .mts (and not .ts)?
|
||||||
|
* This script needs `import.meta.url` to resolve paths relative to itself,
|
||||||
|
* because Task invokes it from the workspace root (frontend/) but the .env
|
||||||
|
* files live one level deeper at frontend/editor/. `import.meta` is only
|
||||||
|
* valid in ESM output; `editor/scripts/tsconfig.json` extends the editor
|
||||||
|
* tsconfig which uses `module: node16`, treating plain .ts as CommonJS
|
||||||
|
* (TS1470 error on `import.meta`). The .mts extension explicitly marks
|
||||||
|
* the file as ESM, which tsx already runs at runtime anyway.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { existsSync, writeFileSync } from "fs";
|
import { existsSync, writeFileSync } from "fs";
|
||||||
@@ -17,8 +26,6 @@ import { fileURLToPath } from "url";
|
|||||||
|
|
||||||
// .env files live next to the editor's vite.config.ts (frontend/editor/).
|
// .env files live next to the editor's vite.config.ts (frontend/editor/).
|
||||||
// Resolve relative to this script regardless of where the build was invoked.
|
// Resolve relative to this script regardless of where the build was invoked.
|
||||||
// `import.meta.dirname` would be tidier but isn't available under tsx's CJS
|
|
||||||
// transpilation today, so go via fileURLToPath for portability.
|
|
||||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||||
const root = resolve(scriptDir, "..");
|
const root = resolve(scriptDir, "..");
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import tseslint from "typescript-eslint";
|
|||||||
|
|
||||||
const srcGlobs = ["editor/src/**/*.{js,mjs,jsx,ts,tsx}"];
|
const srcGlobs = ["editor/src/**/*.{js,mjs,jsx,ts,tsx}"];
|
||||||
const nodeGlobs = [
|
const nodeGlobs = [
|
||||||
"editor/scripts/**/*.{js,ts,mjs}",
|
"scripts/**/*.{js,ts,mjs,mts}",
|
||||||
|
"editor/scripts/**/*.{js,ts,mjs,mts}",
|
||||||
"editor/*.config.{js,ts,mjs}",
|
"editor/*.config.{js,ts,mjs}",
|
||||||
"*.config.{js,ts,mjs}",
|
"*.config.{js,ts,mjs}",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"web-vitals": "^5.1.0"
|
"web-vitals": "^5.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"update:minor": "node editor/scripts/update-minor.js",
|
"update:minor": "node scripts/update-minor.js",
|
||||||
"update:major": "npx npm-check-updates -u && npm install",
|
"update:major": "npx npm-check-updates -u && npm install",
|
||||||
"update:interactive": "npx npm-check-updates -i",
|
"update:interactive": "npx npm-check-updates -i",
|
||||||
"update:minor-strict": "npx npm-check-updates -u --target minor && npm install"
|
"update:minor-strict": "npx npm-check-updates -u --target minor && npm install"
|
||||||
|
|||||||
Reference in New Issue
Block a user