Skip to content

Commit

Permalink
chore: update esbuild, fix worker thread definition (#4326)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Mar 15, 2022
1 parent 25f5393 commit fdfd66c
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
"automerge": true
}
],
"ignoreDeps": ["node", "esbuild"]
"ignoreDeps": ["node"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"commitizen": "^4.2.4",
"coveralls": "^3.1.1",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@zwave-js/maintenance": "workspace:*",
"axios": "^0.26.0",
"comment-json": "^4.2.2",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"js-levenshtein": "^1.1.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@types/jest": "^27.4.1",
"@types/node": "^15.12.5",
"@types/triple-beam": "^1.3.2",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"typescript": "4.6.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/maintenance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@zwave-js/shared": "workspace:*",
"ansi-colors": "^4.1.1",
"clipboardy": "^2.3.0",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"fs-extra": "^10.0.1",
"jest-extended": "^2.0.0",
Expand Down
46 changes: 21 additions & 25 deletions packages/maintenance/src/generateTypedDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,33 +500,29 @@ async function main(): Promise<void> {
}
}

if (isMainThread) {
if (require.main === module) {
void main();
}
} else {
// Worker thread, export the available methods
let _program: Project | undefined;
function getProgram(): Project {
if (!_program) {
_program = new Project({ tsConfigFilePath });
}
return _program;
// To be able to use this as a worker thread, export the available methods
let _program: Project | undefined;
function getProgram(): Project {
if (!_program) {
_program = new Project({ tsConfigFilePath });
}
return _program;
}

function processImport(filename: string): Promise<boolean> {
return processDocFile(getProgram(), filename);
}
export function processImport(filename: string): Promise<boolean> {
return processDocFile(getProgram(), filename);
}

function processCC(
filename: string,
): Promise<{ generatedIndex: string; generatedSidebar: any } | undefined> {
const sourceFile = getProgram().getSourceFileOrThrow(filename);
return processCCDocFile(sourceFile);
}
export function processCC(
filename: string,
): Promise<{ generatedIndex: string; generatedSidebar: any } | undefined> {
const sourceFile = getProgram().getSourceFileOrThrow(filename);
return processCCDocFile(sourceFile);
}

module.exports = {
processImport,
processCC,
};
// If this is NOT run as a worker thread, execute the main function
if (isMainThread) {
if (require.main === module) {
void main();
}
}
2 changes: 1 addition & 1 deletion packages/nvmedit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@types/node": "^15.12.5",
"@types/semver": "^7.3.9",
"@types/yargs": "^17.0.9",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"typescript": "4.6.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/serial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@types/node": "^15.12.5",
"@zwave-js/testing": "workspace:*",
"ansi-colors": "^4.1.1",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"typescript": "4.6.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.1",
"@types/node": "^15.12.5",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"typescript": "4.6.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/triple-beam": "^1.3.2",
"@zwave-js/core": "workspace:*",
"ansi-colors": "^4.1.1",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"triple-beam": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/zwave-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@xstate/test": "^0.5.1",
"@zwave-js/maintenance": "workspace:*",
"@zwave-js/testing": "workspace:*",
"esbuild": "0.14.1",
"esbuild": "0.14.27",
"esbuild-register": "^3.3.2",
"jest-extended": "^2.0.0",
"mockdate": "^3.0.5",
Expand Down
Loading

0 comments on commit fdfd66c

Please sign in to comment.