fix: devtool startup
This commit is contained in:
parent
57028c7ba8
commit
032aa74f6e
@ -68,10 +68,7 @@ async function main() {
|
||||
await build();
|
||||
|
||||
// start Zotero
|
||||
startZotero();
|
||||
setTimeout(() => {
|
||||
openDevTool();
|
||||
}, 5000);
|
||||
startZotero(openDevTool);
|
||||
|
||||
// watch
|
||||
await watch();
|
||||
|
@ -10,6 +10,9 @@ import { exit } from "process";
|
||||
const { addonID } = details.config;
|
||||
const { zoteroBinPath, profilePath, dataDir } = cmd.exec;
|
||||
|
||||
// Keep in sync with the addon's onStartup
|
||||
const loadDevToolWhen = `Plugin ${addonID} startup`;
|
||||
|
||||
const logPath = "logs";
|
||||
const logFilePath = path.join(logPath, "zotero.log");
|
||||
|
||||
@ -68,7 +71,9 @@ function prepareLog() {
|
||||
writeFileSync(logFilePath, "");
|
||||
}
|
||||
|
||||
export function main() {
|
||||
export function main(callback) {
|
||||
let isZoteroReady = false;
|
||||
|
||||
prepareDevEnv();
|
||||
|
||||
prepareLog();
|
||||
@ -81,6 +86,10 @@ export function main() {
|
||||
]);
|
||||
|
||||
zoteroProcess.stdout.on("data", (data) => {
|
||||
if (!isZoteroReady && data.toString().includes(loadDevToolWhen)) {
|
||||
isZoteroReady = true;
|
||||
callback();
|
||||
}
|
||||
writeFileSync(logFilePath, data, {
|
||||
flag: "a",
|
||||
});
|
||||
|
@ -16,6 +16,14 @@ async function onStartup() {
|
||||
Zotero.unlockPromise,
|
||||
Zotero.uiReadyPromise,
|
||||
]);
|
||||
|
||||
// TODO: Remove this after zotero#3387 is merged
|
||||
if (__env__ === "development") {
|
||||
// Keep in sync with the scripts/startup.mjs
|
||||
const loadDevToolWhen = `Plugin ${config.addonID} startup`;
|
||||
ztoolkit.log(loadDevToolWhen);
|
||||
}
|
||||
|
||||
initLocale();
|
||||
|
||||
BasicExampleFactory.registerPrefs();
|
||||
|
Loading…
x
Reference in New Issue
Block a user