Skip to content

Commit

Permalink
fix: Fix not to include publication.json itself in its resources prop…
Browse files Browse the repository at this point in the history
…erty

fix #523
  • Loading branch information
spring-raining committed Oct 6, 2024
1 parent ea882d1 commit 0c55356
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/output/webbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,11 @@ export async function copyWebPublicationAssets({
manifest.resources = [
...[manifest.resources || []].flat(),
...resources.flatMap((file) => {
if (preDefinedResources.includes(file)) {
if (
preDefinedResources.includes(file) ||
// Omit publication.json itself
pathEquals(file, upath.relative(outputDir, actualManifestPath))
) {
return [];
}
return file;
Expand Down
5 changes: 1 addition & 4 deletions tests/__snapshots__/webbook.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,7 @@ Object {
"url": "foo.html",
},
],
"resources": Array [
"publication.json",
],
"resources": Array [],
"type": "Book",
}
`;
Expand Down Expand Up @@ -349,7 +347,6 @@ Object {
"rel": "cover",
"url": "cover.png",
},
"publication.json",
"style%20sheet.css",
"themes/packages/mytheme/%25style%25.css",
],
Expand Down

0 comments on commit 0c55356

Please sign in to comment.