diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45710153..de244842 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives + key: apt-gtk-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }} + restore-keys: apt-gtk-${{ runner.os }}- + - name: Install GTK development dependencies - run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf pkg-config + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf pkg-config - name: Setup pnpm uses: pnpm/action-setup@v4 @@ -36,17 +45,11 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile --ignore-scripts - name: Build run: pnpm exec turbo run build - - name: Lint - run: pnpm exec turbo run lint - - - name: Typecheck - run: pnpm exec turbo run typecheck - - name: Install Rust stable uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/release-cli-binary.yml b/.github/workflows/release-cli-binary.yml index 299e8cbc..8aa52bd7 100644 --- a/.github/workflows/release-cli-binary.yml +++ b/.github/workflows/release-cli-binary.yml @@ -77,7 +77,7 @@ jobs: - name: Install & bundle plugin-runtime shell: bash run: | - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile --ignore-scripts pnpm exec turbo run build --filter=@truenine/memory-sync-cli... ls -la cli/dist/plugin-runtime.mjs diff --git a/.github/workflows/release-cli-napi.yml b/.github/workflows/release-cli-napi.yml index cf35bed8..e9e6fa84 100644 --- a/.github/workflows/release-cli-napi.yml +++ b/.github/workflows/release-cli-napi.yml @@ -69,7 +69,7 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile --ignore-scripts - name: Install Rust stable uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 0831db45..a9fcb422 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -82,7 +82,7 @@ jobs: - name: Install & Build run: | - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile --ignore-scripts pnpm exec turbo run build --filter=@truenine/memory-sync-cli... - name: Publish to npm diff --git a/.github/workflows/release-gui.yml b/.github/workflows/release-gui.yml index e86b0a2e..735ab467 100644 --- a/.github/workflows/release-gui.yml +++ b/.github/workflows/release-gui.yml @@ -27,7 +27,7 @@ jobs: matrix: include: - platform: 'macos-14' - args: '' + args: '--target universal-apple-darwin' rust_targets: 'aarch64-apple-darwin,x86_64-apple-darwin' - platform: 'ubuntu-24.04' args: '' @@ -64,6 +64,7 @@ jobs: - name: Install Rust stable uses: dtolnay/rust-toolchain@stable with: + toolchain: stable targets: ${{ matrix.rust_targets }} - name: Get Cargo deps hash (exclude root package version for stable cache key) @@ -86,6 +87,14 @@ jobs: restore-keys: | ${{ runner.os }}-cargo- + - name: Cache apt packages + if: matrix.platform == 'ubuntu-24.04' + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives + key: apt-gtk-${{ runner.os }}-${{ hashFiles('.github/workflows/release-gui.yml') }} + restore-keys: apt-gtk-${{ runner.os }}- + - name: Install dependencies (ubuntu x86_64) if: matrix.platform == 'ubuntu-24.04' run: | @@ -93,7 +102,7 @@ jobs: sudo apt-get install -y --no-install-recommends libgtk-3-dev libglib2.0-dev pkg-config libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf - name: Install workspace dependencies - run: pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile --ignore-scripts - name: Sync Tauri version from CLI shell: bash @@ -118,7 +127,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: gui-${{ matrix.platform }}${{ matrix.args && format('-{0}', matrix.args) || '' }} + name: gui-${{ matrix.platform }} path: | gui/src-tauri/target/**/bundle/**/*.dmg gui/src-tauri/target/**/bundle/**/*.exe diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8e14f99..56925a9c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,8 +11,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives + key: apt-gtk-${{ runner.os }}-${{ hashFiles('.github/workflows/test.yml') }} + restore-keys: apt-gtk-${{ runner.os }}- + - name: Install GTK development dependencies - run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf pkg-config + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf pkg-config - name: Setup pnpm uses: pnpm/action-setup@v4 @@ -36,7 +45,7 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile --ignore-scripts - name: Install Rust stable uses: dtolnay/rust-toolchain@stable @@ -55,6 +64,9 @@ jobs: - name: Generate Tauri icons run: pnpm -F @truenine/memory-sync-gui run generate:icons + - name: Generate route tree + run: pnpm -F @truenine/memory-sync-gui run generate:routes + - name: Run tests run: pnpm exec turbo run test diff --git a/gui/.gitignore b/gui/.gitignore index 810ab68e..19d12e51 100644 --- a/gui/.gitignore +++ b/gui/.gitignore @@ -26,8 +26,6 @@ Thumbs.db # TypeScript *.tsbuildinfo -# TanStack Router (auto-generated route tree) -src/routeTree.gen.ts # Test coverage/ diff --git a/gui/package.json b/gui/package.json index 4221127d..ca11a2df 100644 --- a/gui/package.json +++ b/gui/package.json @@ -16,6 +16,7 @@ "tauri": "tauri", "tauri:dev": "tauri dev", "tauri:build": "tauri build", + "generate:routes": "tsx scripts/generate-routes.ts", "typecheck": "tsc --noEmit", "test:ui": "vitest --run", "test:tauri": "cargo test --manifest-path src-tauri/Cargo.toml", @@ -40,6 +41,7 @@ }, "devDependencies": { "@tailwindcss/vite": "catalog:", + "@tanstack/router-generator": "^1.162.2", "@tauri-apps/cli": "catalog:", "@types/react": "catalog:", "@types/react-dom": "catalog:", diff --git a/gui/scripts/generate-routes.ts b/gui/scripts/generate-routes.ts new file mode 100644 index 00000000..1a30e010 --- /dev/null +++ b/gui/scripts/generate-routes.ts @@ -0,0 +1,16 @@ +#!/usr/bin/env tsx +import { Generator, getConfig } from '@tanstack/router-generator' +import { resolve } from 'node:path' + +const root = resolve(import.meta.dirname, '..') + +const config = await getConfig({ + routesDirectory: resolve(root, 'src/routes'), + generatedRouteTree: resolve(root, 'src/routeTree.gen.ts'), + quoteStyle: 'single', + routeFileIgnorePattern: '.*\.test\.tsx?$|.*\.spec\.tsx?$', +}) + +const gen = new Generator({ config, root }) +await gen.run() +console.log('[generate-routes] routeTree.gen.ts updated') diff --git a/gui/src/routeTree.gen.ts b/gui/src/routeTree.gen.ts new file mode 100644 index 00000000..f4d4a675 --- /dev/null +++ b/gui/src/routeTree.gen.ts @@ -0,0 +1,189 @@ +/* eslint-disable */ + +// @ts-nocheck + +// noinspection JSUnusedGlobalSymbols + +// This file was automatically generated by TanStack Router. +// You should NOT make any changes in this file as it will be overwritten. +// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. + +import { Route as rootRouteImport } from './routes/__root' +import { Route as SettingsRouteImport } from './routes/settings' +import { Route as PluginsRouteImport } from './routes/plugins' +import { Route as PipelineRouteImport } from './routes/pipeline' +import { Route as LogsRouteImport } from './routes/logs' +import { Route as FilesRouteImport } from './routes/files' +import { Route as ConfigRouteImport } from './routes/config' +import { Route as IndexRouteImport } from './routes/index' + +const SettingsRoute = SettingsRouteImport.update({ + id: '/settings', + path: '/settings', + getParentRoute: () => rootRouteImport, +} as any) +const PluginsRoute = PluginsRouteImport.update({ + id: '/plugins', + path: '/plugins', + getParentRoute: () => rootRouteImport, +} as any) +const PipelineRoute = PipelineRouteImport.update({ + id: '/pipeline', + path: '/pipeline', + getParentRoute: () => rootRouteImport, +} as any) +const LogsRoute = LogsRouteImport.update({ + id: '/logs', + path: '/logs', + getParentRoute: () => rootRouteImport, +} as any) +const FilesRoute = FilesRouteImport.update({ + id: '/files', + path: '/files', + getParentRoute: () => rootRouteImport, +} as any) +const ConfigRoute = ConfigRouteImport.update({ + id: '/config', + path: '/config', + getParentRoute: () => rootRouteImport, +} as any) +const IndexRoute = IndexRouteImport.update({ + id: '/', + path: '/', + getParentRoute: () => rootRouteImport, +} as any) + +export interface FileRoutesByFullPath { + '/': typeof IndexRoute + '/config': typeof ConfigRoute + '/files': typeof FilesRoute + '/logs': typeof LogsRoute + '/pipeline': typeof PipelineRoute + '/plugins': typeof PluginsRoute + '/settings': typeof SettingsRoute +} +export interface FileRoutesByTo { + '/': typeof IndexRoute + '/config': typeof ConfigRoute + '/files': typeof FilesRoute + '/logs': typeof LogsRoute + '/pipeline': typeof PipelineRoute + '/plugins': typeof PluginsRoute + '/settings': typeof SettingsRoute +} +export interface FileRoutesById { + __root__: typeof rootRouteImport + '/': typeof IndexRoute + '/config': typeof ConfigRoute + '/files': typeof FilesRoute + '/logs': typeof LogsRoute + '/pipeline': typeof PipelineRoute + '/plugins': typeof PluginsRoute + '/settings': typeof SettingsRoute +} +export interface FileRouteTypes { + fileRoutesByFullPath: FileRoutesByFullPath + fullPaths: + | '/' + | '/config' + | '/files' + | '/logs' + | '/pipeline' + | '/plugins' + | '/settings' + fileRoutesByTo: FileRoutesByTo + to: + | '/' + | '/config' + | '/files' + | '/logs' + | '/pipeline' + | '/plugins' + | '/settings' + id: + | '__root__' + | '/' + | '/config' + | '/files' + | '/logs' + | '/pipeline' + | '/plugins' + | '/settings' + fileRoutesById: FileRoutesById +} +export interface RootRouteChildren { + IndexRoute: typeof IndexRoute + ConfigRoute: typeof ConfigRoute + FilesRoute: typeof FilesRoute + LogsRoute: typeof LogsRoute + PipelineRoute: typeof PipelineRoute + PluginsRoute: typeof PluginsRoute + SettingsRoute: typeof SettingsRoute +} + +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/settings': { + id: '/settings' + path: '/settings' + fullPath: '/settings' + preLoaderRoute: typeof SettingsRouteImport + parentRoute: typeof rootRouteImport + } + '/plugins': { + id: '/plugins' + path: '/plugins' + fullPath: '/plugins' + preLoaderRoute: typeof PluginsRouteImport + parentRoute: typeof rootRouteImport + } + '/pipeline': { + id: '/pipeline' + path: '/pipeline' + fullPath: '/pipeline' + preLoaderRoute: typeof PipelineRouteImport + parentRoute: typeof rootRouteImport + } + '/logs': { + id: '/logs' + path: '/logs' + fullPath: '/logs' + preLoaderRoute: typeof LogsRouteImport + parentRoute: typeof rootRouteImport + } + '/files': { + id: '/files' + path: '/files' + fullPath: '/files' + preLoaderRoute: typeof FilesRouteImport + parentRoute: typeof rootRouteImport + } + '/config': { + id: '/config' + path: '/config' + fullPath: '/config' + preLoaderRoute: typeof ConfigRouteImport + parentRoute: typeof rootRouteImport + } + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexRouteImport + parentRoute: typeof rootRouteImport + } + } +} + +const rootRouteChildren: RootRouteChildren = { + IndexRoute: IndexRoute, + ConfigRoute: ConfigRoute, + FilesRoute: FilesRoute, + LogsRoute: LogsRoute, + PipelineRoute: PipelineRoute, + PluginsRoute: PluginsRoute, + SettingsRoute: SettingsRoute, +} +export const routeTree = rootRouteImport + ._addFileChildren(rootRouteChildren) + ._addFileTypes() diff --git a/gui/vite.config.ts b/gui/vite.config.ts index 35fd5d83..bac0a550 100644 --- a/gui/vite.config.ts +++ b/gui/vite.config.ts @@ -14,6 +14,7 @@ export default defineConfig({ routesDirectory: './src/routes', generatedRouteTree: './src/routeTree.gen.ts', quoteStyle: 'single', + routeFileIgnorePattern: '.*\.test\.tsx?$|.*\.spec\.tsx?$', }), tailwindcss(), react(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6ac0a4f9..1dca6cc1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -514,6 +514,9 @@ importers: '@tailwindcss/vite': specifier: 'catalog:' version: 4.2.0(vite@7.3.1(@types/node@25.3.0)(jiti@2.6.1)(lightningcss@1.31.1)(tsx@4.21.0)(yaml@2.8.2)) + '@tanstack/router-generator': + specifier: ^1.162.2 + version: 1.162.2 '@tauri-apps/cli': specifier: 'catalog:' version: 2.10.0 diff --git a/turbo.json b/turbo.json index ebd0ee8d..4ca4c1ed 100644 --- a/turbo.json +++ b/turbo.json @@ -6,10 +6,11 @@ "outputs": ["dist/**", "*.node"] }, "test": { - "dependsOn": ["build"], + "dependsOn": ["build", "lint", "typecheck"], "outputs": [] }, "lint": { + "dependsOn": ["^build"], "outputs": [] }, "lintfix": {