Skip to content

[docker] Install tsc so that --emit-tsc works inside the container #1371

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

merceyz
Copy link

@merceyz merceyz commented Apr 12, 2024

Install tsc during Docker build to support the --emit-tsd flag.

Fixes: #1370

@merceyz merceyz changed the title feat(docker): install npm dependencies feat(docker): install npm dependencies of emscripten Apr 12, 2024
@@ -50,6 +50,12 @@ RUN echo "## Aggressive optimization: Remove debug symbols" \
&& find ${EMSDK}/upstream/bin -type f -exec strip -s {} + || true \
&& echo "## Done"

RUN echo "## Installing npm dependencies" \
Copy link
Collaborator

@sbc100 sbc100 Apr 12, 2024

Choose a reason for hiding this comment

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

The emsdk build script uses does install npm dependencies, just no the devDependencies. It uses npm ci --production --no-optional.

How about emsdk install tsc so that we its more obvious why we are doing this here?

Copy link
Author

Choose a reason for hiding this comment

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

Hm, in that case perhaps emscripten should move typescript to dependencies instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We decided we didn't want to add the tsc dependency for all users, and instead make it an optional dependencies that certain users can opt into.

We can possibly revisit that decision at a later date.

Copy link

@s-h-a-d-o-w s-h-a-d-o-w Apr 10, 2025

Choose a reason for hiding this comment

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

Fair enough but why not merge this? Docker says the image is currently 2.76 GB. The difference between just production and all dependencies is ~70 MB.

(An example for something that's currently broken is compiling the tree-sitter WASM library with --emit-tsd.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just logically it makes sense that we are simply adding 'tsc'. Other dependencies should already exist. There is no need to install other dev dependencies here.

So maybe change the to "echo Installing" tsc and then npm install tsc?

Choose a reason for hiding this comment

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

I'm not the original author, so I can't change it but that makes sense to me. (I'm not familiar with how emscripten uses TS, hence my broad suggestion. Just installing tsc is of course ideal.)

But if @merceyz isn't around any more (been inactive for a while), I'm happy to submit a new PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we just update this PR.. let me see if I can do that.

@sbc100 sbc100 changed the title feat(docker): install npm dependencies of emscripten [docker] Install tsc so that --emit-tsc works inside the container Apr 10, 2025
@sbc100 sbc100 enabled auto-merge (squash) April 10, 2025 16:47
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.

Support --emit-tsd in Docker container by default
3 participants