mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
feat(server): add Phoenix priv/static to project icon search directories
This commit is contained in:
@@ -44,6 +44,10 @@ describe("findProjectIcon", () => {
|
||||
expect(PRIORITY_DIRS).toContain("static");
|
||||
expect(PRIORITY_DIRS).toContain("assets");
|
||||
});
|
||||
|
||||
it("includes Phoenix static assets directory", () => {
|
||||
expect(PRIORITY_DIRS).toContain("priv/static");
|
||||
});
|
||||
});
|
||||
|
||||
describe("IGNORED_DIRS", () => {
|
||||
@@ -97,6 +101,14 @@ describe("findProjectIcon", () => {
|
||||
expect(result).toBe(join(tempDir, "static", "favicon.svg"));
|
||||
});
|
||||
|
||||
it("finds icon in Phoenix priv/static directory", async () => {
|
||||
mkdirSync(join(tempDir, "priv", "static"), { recursive: true });
|
||||
writeFileSync(join(tempDir, "priv", "static", "favicon.ico"), "icon content");
|
||||
|
||||
const result = await findProjectIcon(tempDir);
|
||||
expect(result).toBe(join(tempDir, "priv", "static", "favicon.ico"));
|
||||
});
|
||||
|
||||
it("finds icon in assets directory (priority dir)", async () => {
|
||||
mkdirSync(join(tempDir, "assets"));
|
||||
writeFileSync(join(tempDir, "assets", "logo.png"), "icon content");
|
||||
@@ -208,6 +220,14 @@ describe("findProjectIcon", () => {
|
||||
expect(result).toBe(join(tempDir, "packages", "ui", "logo.svg"));
|
||||
});
|
||||
|
||||
it("finds icon in Phoenix app priv/static directory inside monorepo", async () => {
|
||||
mkdirSync(join(tempDir, "apps", "api", "priv", "static"), { recursive: true });
|
||||
writeFileSync(join(tempDir, "apps", "api", "priv", "static", "favicon.ico"), "icon");
|
||||
|
||||
const result = await findProjectIcon(tempDir);
|
||||
expect(result).toBe(join(tempDir, "apps", "api", "priv", "static", "favicon.ico"));
|
||||
});
|
||||
|
||||
it("prioritizes root priority dirs over monorepo dirs", async () => {
|
||||
mkdirSync(join(tempDir, "public"), { recursive: true });
|
||||
mkdirSync(join(tempDir, "packages", "app", "public"), { recursive: true });
|
||||
|
||||
@@ -23,9 +23,16 @@ export const ICON_PATTERNS = [
|
||||
];
|
||||
|
||||
/**
|
||||
* Directories to search first (in priority order).
|
||||
* Directories or directory paths to search first (in priority order).
|
||||
*/
|
||||
export const PRIORITY_DIRS = ["public", "static", "assets", "images", "img"];
|
||||
export const PRIORITY_DIRS = [
|
||||
"public",
|
||||
"static",
|
||||
"priv/static",
|
||||
"assets",
|
||||
"images",
|
||||
"img",
|
||||
];
|
||||
|
||||
/**
|
||||
* Monorepo package directory patterns to scan (e.g., packages/app, apps/web).
|
||||
|
||||
Reference in New Issue
Block a user