Skip to content

Commit 4047d02

Browse files
authored
chore: address restructure PR review feedback (Stirling-Tools#6423)
1 parent 5f78083 commit 4047d02

7 files changed

Lines changed: 57 additions & 32 deletions

File tree

.taskfiles/desktop.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,52 +31,60 @@ tasks:
3131
provisioner:
3232
desc: "Build installer provisioner"
3333
platforms: [windows]
34+
dir: editor
3435
cmds:
35-
- node editor/scripts/build-provisioner.mjs
36+
- node scripts/build-provisioner.mjs
3637

3738
dev:
3839
desc: "Start Tauri desktop dev mode"
3940
deps: [prepare]
4041
ignore_error: true
42+
dir: editor
4143
cmds:
42-
- cd editor && npx tauri dev --no-watch
44+
- npx tauri dev --no-watch
4345

4446
build:
4547
desc: "Build Tauri desktop app (production)"
4648
deps: [prepare]
49+
dir: editor
4750
cmds:
48-
- cd editor && npx tauri build
51+
- npx tauri build
4952

5053
build:dev:
5154
desc: "Build Tauri desktop app (dev, no bundling)"
5255
deps: [prepare]
56+
dir: editor
5357
cmds:
54-
- cd editor && npx tauri build --no-bundle
58+
- npx tauri build --no-bundle
5559

5660
build:dev:mac:
5761
desc: "Build Tauri desktop .app bundle (macOS)"
5862
deps: [prepare]
63+
dir: editor
5964
cmds:
60-
- cd editor && npx tauri build --bundles app
65+
- npx tauri build --bundles app
6166

6267
build:dev:windows:
6368
desc: "Build Tauri desktop NSIS installer (Windows)"
6469
deps: [prepare]
70+
dir: editor
6571
cmds:
66-
- cd editor && npx tauri build --bundles nsis
72+
- npx tauri build --bundles nsis
6773

6874
build:dev:linux:
6975
desc: "Build Tauri desktop AppImage (Linux)"
7076
deps: [prepare]
77+
dir: editor
7178
cmds:
72-
- cd editor && npx tauri build --bundles appimage
79+
- npx tauri build --bundles appimage
7380

7481
clean:
7582
desc: "Clean Tauri/Cargo build artifacts"
83+
dir: editor
7684
cmds:
7785
- task: jlink:clean
78-
- cd editor/src-tauri && cargo clean
79-
- rm -rf editor/dist editor/build
86+
- cd src-tauri && cargo clean
87+
- rm -rf dist build
8088

8189
# ============================================================
8290
# JLink — Build bundled Java runtime for Tauri
@@ -106,24 +114,26 @@ tasks:
106114
jlink:runtime:
107115
desc: "Create custom JRE with jlink"
108116
deps: [jlink:jar]
117+
dir: editor/src-tauri
109118
cmds:
110-
- rm -rf editor/src-tauri/runtime/jre
111-
- mkdir -p editor/src-tauri/runtime
119+
- rm -rf runtime/jre
120+
- mkdir -p runtime
112121
- >-
113122
jlink
114123
--add-modules {{.JLINK_MODULES}}
115124
--strip-debug
116125
--compress=zip-6
117126
--no-header-files
118127
--no-man-pages
119-
--output editor/src-tauri/runtime/jre
128+
--output runtime/jre
120129
status:
121130
- test -d editor/src-tauri/runtime/jre
122131

123132
jlink:clean:
124133
desc: "Remove JLink runtime and bundled JARs"
134+
dir: editor/src-tauri
125135
cmds:
126-
- rm -rf editor/src-tauri/libs editor/src-tauri/runtime
136+
- rm -rf libs runtime
127137

128138
# macOS-only. Replaces jlink:runtime's single-arch JRE with a universal
129139
# (arm64 + x86_64) one for the universal Tauri shell. Runs the x86_64
@@ -134,8 +144,9 @@ tasks:
134144
desc: "Create universal (arm64+x86_64) JRE for the macOS Tauri build"
135145
deps: [jlink:jar]
136146
platforms: [darwin]
147+
dir: editor
137148
env:
138149
JLINK_MODULES: "{{.JLINK_MODULES}}"
139-
OUTPUT_DIR: editor/src-tauri/runtime/jre
150+
OUTPUT_DIR: src-tauri/runtime/jre
140151
cmds:
141-
- editor/scripts/build-universal-mac-jre.sh
152+
- scripts/build-universal-mac-jre.sh

app/core/build.gradle

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,13 @@ if (buildPrototypes) {
196196
}
197197
def frontendBuildTask = "frontend:build:${frontendMode}"
198198

199+
// Workspace root holds package.json and node_modules (shared across editor /
200+
// future portal). Editor-specific paths (src, public, dist, tauri) live one
201+
// level deeper under frontend/editor/. When the portal lands as an embedded
202+
// app, add a sibling frontendPortalDir / frontendPortalDistDir alongside.
199203
def frontendDir = file('../../frontend')
200204
def frontendEditorDir = file('../../frontend/editor')
201-
def frontendDistDir = file('../../frontend/editor/dist')
205+
def frontendEditorDistDir = file('../../frontend/editor/dist')
202206
def resourcesStaticDir = file('src/main/resources/static')
203207
def generatedFrontendPaths = [
204208
'assets',
@@ -263,13 +267,13 @@ tasks.register('npmBuild', Exec) {
263267
doNotTrackState("Frontend build depends on untracked npmInstall task")
264268
enabled = buildWithFrontend
265269
group = 'frontend'
266-
description = 'Build frontend application'
270+
description = 'Build editor frontend application'
267271
workingDir file('../..')
268272
commandLine = ['task', frontendBuildTask]
269273
inputs.dir(new File(frontendEditorDir, 'src'))
270274
inputs.dir(new File(frontendEditorDir, 'public'))
271275
inputs.file(new File(frontendDir, 'package.json'))
272-
outputs.dir(frontendDistDir)
276+
outputs.dir(frontendEditorDistDir)
273277

274278
// Show live output
275279
standardOutput = System.out
@@ -280,25 +284,25 @@ tasks.register('npmBuild', Exec) {
280284
environment 'VITE_API_BASE_URL', '/'
281285

282286
doFirst {
283-
println "Building frontend application for production (mode=${frontendMode}, VITE_API_BASE_URL=/)"
287+
println "Building editor frontend application for production (mode=${frontendMode}, VITE_API_BASE_URL=/)"
284288
}
285289
}
286290

287291
tasks.register('copyFrontendAssets', Copy) {
288292
enabled = buildWithFrontend
289293
group = 'frontend'
290-
description = 'Copy frontend build to static resources'
294+
description = 'Copy editor frontend build to static resources'
291295
dependsOn npmBuild
292296
dependsOn cleanFrontendAssets
293-
from(frontendDistDir) {
297+
from(frontendEditorDistDir) {
294298
// Exclude files that conflict with backend static resources
295299
exclude 'robots.txt' // Backend already has this
296300
exclude 'favicon.ico' // Backend already has this
297301
}
298302
into resourcesStaticDir
299303
duplicatesStrategy = DuplicatesStrategy.INCLUDE // Let frontend overwrite when needed
300304
doFirst {
301-
println "Copying frontend build from ${frontendDistDir} to ${resourcesStaticDir}..."
305+
println "Copying frontend build from ${frontendEditorDistDir} to ${resourcesStaticDir}..."
302306
println "Backend static resources will be preserved"
303307
}
304308
doLast {
@@ -330,7 +334,7 @@ tasks.named('copyFrontendAssets').configure {
330334
}
331335

332336
if (buildWithFrontend) {
333-
println "Frontend build enabled - JAR will include React frontend (mode=${frontendMode})"
337+
println "Editor frontend build enabled - JAR will include React frontend (mode=${frontendMode})"
334338
processResources.dependsOn copyFrontendAssets
335339
} else {
336340
println "Frontend build disabled - JAR will be backend-only with API landing page"

frontend/.prettierignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
dist/
22
dist-portal/
33
editor/dist/
4-
# Tauri/Cargo build output (binary assets named *.js etc. confuse Prettier)
5-
editor/src-tauri/target/
4+
# Tauri/Cargo build output (binary assets named *.js etc. confuse Prettier).
5+
# Match nested target/ dirs too — provisioner/ and thumbnail-handler/ each
6+
# have their own Cargo workspace under src-tauri/.
7+
editor/src-tauri/**/target/
68
editor/src-tauri/gen/
79
node_modules/
810
editor/public/vendor/

frontend/editor/scripts/setup-env.mts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66
* Vite automatically layers these `.local` files on top of the committed ones.
77
*
88
* Usage:
9-
* tsx scripts/setup-env.ts # ensures .env.local
10-
* tsx scripts/setup-env.ts --desktop # also ensures .env.desktop.local
11-
* tsx scripts/setup-env.ts --saas # also ensures .env.saas.local
9+
* tsx scripts/setup-env.mts # ensures .env.local
10+
* tsx scripts/setup-env.mts --desktop # also ensures .env.desktop.local
11+
* tsx scripts/setup-env.mts --saas # also ensures .env.saas.local
12+
*
13+
* Why .mts (and not .ts)?
14+
* This script needs `import.meta.url` to resolve paths relative to itself,
15+
* because Task invokes it from the workspace root (frontend/) but the .env
16+
* files live one level deeper at frontend/editor/. `import.meta` is only
17+
* valid in ESM output; `editor/scripts/tsconfig.json` extends the editor
18+
* tsconfig which uses `module: node16`, treating plain .ts as CommonJS
19+
* (TS1470 error on `import.meta`). The .mts extension explicitly marks
20+
* the file as ESM, which tsx already runs at runtime anyway.
1221
*/
1322

1423
import { existsSync, writeFileSync } from "fs";
@@ -17,8 +26,6 @@ import { fileURLToPath } from "url";
1726

1827
// .env files live next to the editor's vite.config.ts (frontend/editor/).
1928
// Resolve relative to this script regardless of where the build was invoked.
20-
// `import.meta.dirname` would be tidier but isn't available under tsx's CJS
21-
// transpilation today, so go via fileURLToPath for portability.
2229
const scriptDir = dirname(fileURLToPath(import.meta.url));
2330
const root = resolve(scriptDir, "..");
2431
const args = process.argv.slice(2);

frontend/eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import tseslint from "typescript-eslint";
77

88
const srcGlobs = ["editor/src/**/*.{js,mjs,jsx,ts,tsx}"];
99
const nodeGlobs = [
10-
"editor/scripts/**/*.{js,ts,mjs}",
10+
"scripts/**/*.{js,ts,mjs,mts}",
11+
"editor/scripts/**/*.{js,ts,mjs,mts}",
1112
"editor/*.config.{js,ts,mjs}",
1213
"*.config.{js,ts,mjs}",
1314
];

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"web-vitals": "^5.1.0"
8383
},
8484
"scripts": {
85-
"update:minor": "node editor/scripts/update-minor.js",
85+
"update:minor": "node scripts/update-minor.js",
8686
"update:major": "npx npm-check-updates -u && npm install",
8787
"update:interactive": "npx npm-check-updates -i",
8888
"update:minor-strict": "npx npm-check-updates -u --target minor && npm install"

0 commit comments

Comments
 (0)