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

JavaScriptLib Restructure #4647

Merged
merged 24 commits into from
Mar 10, 2025
Merged

Conversation

monyedavid
Copy link
Contributor

@monyedavid monyedavid commented Mar 4, 2025

The goal of the pr is to allow existing Ts projects run with mill, it takes into considerations the fluidity of Ts project structure and removes the reliance on ts-paths as the only means to access module dependencies.

This pr refactors TscModule formerly (TypeScriptModule ), it aims to introduce the features:

  • package RootModule with TscModule
  • relative paths
  • esm support; use swc-core for compiling

Key changes:

  • compile task has been modified, these modifications:
    • change how sources, mod-sources, resources and generated sources are grouped, allowing for the use of relative paths
    • these changes also taking into consideration RootModule use, the top level src feature now works along side TscModule
    • Due to this restructuring, implementation of PublishModule has been significantly altered as TscModule compilations output now prepares source files internal and external (source files generated via a task that would end up in the out/) in a manner that nodes npm publishing tool will understand and work with.
    • The restructuring also consequentially fixes the need for TscModule to violate the new writing to path during execution phase restrictions. As the previous implementation would require files (mostly test config files and build scripts) to be created within or moved to compile.dest during execution phases.
  • It also provides minimal support of esm.

Additional examples

  • module/7-root-module for RootModule

base pr for #4425 @lihaoyi

 - allow use of `package` RootModule with TscModule
 - allow use of relative paths
 - add esm support; use swc-core for compiling
# Conflicts:
#	javascriptlib/src/mill/javascriptlib/PublishModule.scala
#	javascriptlib/src/mill/javascriptlib/TestModule.scala
#	javascriptlib/src/mill/javascriptlib/TypeScriptModule.scala
- basic/3-custom-build-logic
- testing/1-test-suite(bar/baz)
causes `Writing to "destination" not allowed during execution phase` error
when running jslib tests.
@lihaoyi
Copy link
Member

lihaoyi commented Mar 6, 2025

@monyedavid I think let's wait a few days for #4645 to land before we come back to this; that PR aims to solve a lot of the os.Checker problems you encountered, so hopefully once we merge that and you rebase on top of it those problems you hit will go away

@monyedavid
Copy link
Contributor Author

@monyedavid I think let's wait a few days for #4645 to land before we come back to this; that PR aims to solve a lot of the os.Checker problems you encountered, so hopefully once we merge that and you rebase on top of it those problems you hit will go away

Fixed the problems in this pr @lihaoyi

@lihaoyi
Copy link
Member

lihaoyi commented Mar 7, 2025

@monyedavid I've said this before, but can you write a proper explanation in the PR description of the changes this PR does and why they are necessary? I do not want to have to reverse engineer your intentions from reading the code, likely getting it wrong, and causing unnecessary confusion and misunderstandings

@monyedavid monyedavid changed the title Jslib Restructure Javascriptlib[TscModule] Restructure Mar 7, 2025
@monyedavid monyedavid changed the title Javascriptlib[TscModule] Restructure JavaScriptlib Restructure Mar 7, 2025
@monyedavid monyedavid changed the title JavaScriptlib Restructure JavaScriptLib Restructure Mar 7, 2025
@monyedavid monyedavid requested a review from lihaoyi March 7, 2025 13:18
@monyedavid monyedavid requested a review from lihaoyi March 10, 2025 00:34
@lihaoyi
Copy link
Member

lihaoyi commented Mar 10, 2025

I think this looks good, thanks @monyedavid

@lihaoyi lihaoyi merged commit abdee90 into com-lihaoyi:main Mar 10, 2025
32 of 33 checks passed
@lefou lefou added this to the 0.13.0 milestone Mar 10, 2025
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.

3 participants