Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:

- name: Build
run: pnpm run build
env:
VITE_BASE_PATH: /eagle-plugin-mini-map/

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Test fixtures copied to public during build
public/tests

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dev": "vite",
"dev:eagle": "vite build --watch",
"type-check": "tsc --noEmit",
"build": "tsc -b && vite build",
"build": "cp -r tests public/tests && tsc -b && vite build",
"test": "vitest run",
"lint": "eslint --fix .",
"lint:check": "eslint .",
Expand Down
13 changes: 8 additions & 5 deletions src/eagle/mock.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import manifest from "../../public/manifest.json";
import type { Eagle, EagleTheme, Item } from "./types";

// Use BASE_URL to properly handle GitHub Pages deployment
const fixtureUrl = `${import.meta.env.BASE_URL}tests/fixtures/MJXX6FDDBW3FZ.info/DSC02497.jpg`;

const mockItem: Item = {
id: "mock-item",
name: "Test Image",
ext: "jpg",
width: 3681,
height: 5522,
url: "/tests/fixtures/MJXX6FDDBW3FZ.info/DSC02497.jpg",
url: fixtureUrl,
isDeleted: false,
annotation: "Sky tree",
tags: ["travel"],
Expand All @@ -19,10 +22,10 @@ const mockItem: Item = {
modifiedAt: Date.now(),
noThumbnail: false,
noPreview: false,
filePath: "/tests/fixtures/MJXX6FDDBW3FZ.info/DSC02497.jpg",
fileURL: "/tests/fixtures/MJXX6FDDBW3FZ.info/DSC02497.jpg",
thumbnailPath: "/tests/fixtures/MJXX6FDDBW3FZ.info/DSC02497.jpg",
thumbnailURL: "/tests/fixtures/MJXX6FDDBW3FZ.info/DSC02497.jpg",
filePath: fixtureUrl,
fileURL: fixtureUrl,
thumbnailPath: fixtureUrl,
thumbnailURL: fixtureUrl,
metadataFilePath: "",
save: async () => Promise.resolve(true),
moveToTrash: async () => Promise.resolve(true),
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { defineConfig } from "vite";

// https://vite.dev/config/
export default defineConfig({
base: "./", // for Eagle Plugin
base: process.env.VITE_BASE_PATH || "./", // for Eagle Plugin
plugins: [react(), tailwindcss()],
});