Skip to content

Commit

Permalink
fix: do not add gecko to manifest.json
Browse files Browse the repository at this point in the history
  • Loading branch information
northword committed Sep 29, 2024
1 parent dc26768 commit 5fa7a2d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { replaceInFileSync } from "replace-in-file";
import webext from "web-ext";
import { generateHashSync } from "../utils/crypto.js";
import { patchWebExtLogger } from "../utils/log.js";
import { getValidatedManifest } from "../utils/manifest.js";
import { dateFormat, toArray } from "../utils/string.js";
import { Base } from "./base.js";

Expand Down Expand Up @@ -119,11 +120,6 @@ export default class Build extends Base {
id,
update_url: updateURL,
},
gecko: {
id,
update_url: updateURL,
strict_min_version: "102",
},
},
};

Expand Down Expand Up @@ -319,6 +315,8 @@ export default class Build extends Base {
artifactsDir: dist,
filename: `${xpiName}.xpi`,
overwriteDest: true,
}, {
manifestData: getValidatedManifest(),
});
}
}
2 changes: 2 additions & 0 deletions src/core/server/runner-web-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { resolve } from "node:path";
import { env } from "node:process";
import webext from "web-ext";
import { patchWebExtLogger } from "../../utils/log.js";
import { getValidatedManifest } from "../../utils/manifest.js";
import { ServeBase } from "./base.js";

export default class RunnerWebExt extends ServeBase {
Expand Down Expand Up @@ -41,6 +42,7 @@ export default class RunnerWebExt extends ServeBase {
// You need to specify this one so that your NodeJS application
// can continue running after web-ext is finished.
shouldExitProgram: false,
getValidatedManifest,
},
);
this._runner = runner;
Expand Down
12 changes: 12 additions & 0 deletions src/utils/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Patch web-ext's getValidatedManifest
* @see https://github.com/mozilla/web-ext?tab=readme-ov-file#using-web-ext-in-nodejs-code
* @see https://github.com/mozilla/web-ext/blob/master/src/util/manifest.js#L15
*/
export function getValidatedManifest(_sourceDir?: string) {
return {
manifest_version: 2,
name: "zoterp-plugin-scaffold-fake-name",
version: "0.0.0.0",
};
}

3 comments on commit 5fa7a2d

@volatile-static
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是要有什么大动作吗

@northword
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

啊?没有,只是看到这样可以跳过 web-ext 对 manifest 的验证,确实没必要加 gecko 这个对 zotero 没有用的属性。

你想要什么动作? 😂

@volatile-static
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

算了,我想多了

Please sign in to comment.