Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build-adapter command to compile with ESBuild #101

Merged
merged 7 commits into from
Feb 15, 2022

Conversation

AlCalzone
Copy link
Collaborator

@AlCalzone AlCalzone commented Jan 31, 2022

This PR adds support for a custom build command that uses ESBuild under the hood.
Because ESBuild does not do type checking (hence why it is so frigging fast), tsc is executed in check mode after each successful build.

In addition, there is a watch mode where both ESBuild and tsc are executed in parallel, compiling and checking files whenever they change.

@AlCalzone AlCalzone changed the title feat: add build-adapter command to compile with ESBuild/Estrella feat: add build-adapter command to compile with ESBuild Feb 1, 2022
@AlCalzone AlCalzone marked this pull request as ready for review February 1, 2022 22:15
Copy link
Collaborator

@UncleSamSwiss UncleSamSwiss left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, please check my comments for improvements.

src/build-adapter-handlers.ts Outdated Show resolved Hide resolved
if (watch) {
// In watch mode, we start the ESBuild and TSC processes in parallel
// and wait until they end
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why have the build variable here if it is not needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I initially had it in use and called stop() on it, but it seems that esbuild checks for SIGINT itself. Until I'm sure if this is a bug in esbuild or intended, I wanted to leave it in for easy access:
evanw/esbuild#2007

if (watch) {
// In watch mode, we start the ESBuild and TSC processes in parallel
// and wait until they end
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above

// In watch mode, we start the ESBuild and TSC processes in parallel
// and wait until they end
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { build: buildReact, check: checkReact } = await watchReact();
Copy link
Collaborator

Choose a reason for hiding this comment

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

... and again 2x

src/build-adapter.ts Outdated Show resolved Hide resolved
src/build-adapter.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@UncleSamSwiss UncleSamSwiss left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@UncleSamSwiss UncleSamSwiss merged commit b6036c6 into ioBroker:main Feb 15, 2022
@AlCalzone AlCalzone deleted the build-script branch March 1, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants