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

Add first class Javascript/Typescript support to the Mill build tool (4500 Bounty) #3927

Open
8 of 30 tasks
lihaoyi opened this issue Nov 9, 2024 · 11 comments
Open
8 of 30 tasks
Labels

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Nov 9, 2024


From the maintainer Li Haoyi: I'm putting a 4500USD bounty on this issue, payable by bank transfer on merged PRs implementing this. Standard bounty terms apply


Mill is a multi-language build tool that provides automatic caching and parallelism of build tasks related to local development (see What Makes Mill Unique?). Traditionally it targeted JVM languages, but we think that JS/TS projects could benefit from automatic caching and parallelism as well, especially the larger multi-language codebases with both JVM and JS/TS modules that would benefit from having a single build tool able to build code in both languages incrementally and in parallel.

The goal of this ticket is to generate a set of Typescript build examples that match the Java/Scala/Kotlin equivalents. We already have an example TypescriptModule for demo purposes, but we would need to flesh it out using the equivalent Typescript tools and libraries.

For the purposes of this ticket, each examples should match as closely as possible the Java/Scala/Kotlin equivalents, to provide a useful minimal-but-still-educational code example, along with associated english documentation and explanations. You should read through the relevant sections of the Building Java with Mill documentation before proceeding, even if you don't know Java, just to get a feel for what the documentation and examples for each section should cover.

  • example/jslib/basic/ (500USD)

    • 1-simple/: A minimal Typescript module demonstrating typechecking/running/testing/bundling of a Node CLI tool
    • 2-react/: A minimal Typescript module demonstrating typechecking/running/testing/bundling of a React-based web application, served using a static HTML page
    • 3-custom-build-logic/: A Typescript module with custom build logic
  • example/jslib/basic/: (500USD)

    • 4-multi-modules/: Multiple inter-related Typescript modules
    • 5-client-server-hello/: Demonstrate a client-server application with two modules, one a minimal JS server and one a minimal JS client, wired up and interacting
    • 6-client-server-realistic/: Demonstrate a client-server application with two modules, one an Express server and one an React.js client, wired up and interacting, implementing a TodoMVC application
  • example/jslib/dependencies/ (500USD)

    • 1-npm-deps/
    • 2-unmanaged-packages/
    • 3-downloading-unmanaged-packages/
    • 4-repository-config/: examples of how to use alternate NPM mirrors or repositories
  • example/jslib/linting/ (1000USD)

    • 1-autoformatting/: equivalent to 1-scalafmt but using some Typescript autoformatter
    • 2-code-coverage/: not sure what the popular Typescript code coverage lib is, but they should have something
    • 3-linting/: using some popular Typescript linter
  • example/jslib/module/ (500USD)

    • 1-common-config/
    • 2-custom-tasks/
    • 3-override-tasks/
    • 4-compilation-execution-flags/
    • 5-resources/
    • 6-executable-config/
  • example/jslib/testing/ (500USD)

    • 1-test-suite/: we should demonstrate usage of at least 2 Javascript testing frameworks mocha and jest
    • 2-test-deps/
  • example/jslib/testing/ (500USD)

    • 3-integration-suite/: we should demonstrate usage of at least 2 Javascript integration testing frameworks cypress and playwright
  • example/jslib/publishing/1-publish-module/, example/jslib/basic/2-realistic/ (500USD)

    • publishing/1-publish-module/ should demonstrate how to publish a Typescript module to NPM
@lihaoyi lihaoyi changed the title First class Javascript/Typescript support First class Javascript/Typescript support (??? Bounty) Nov 10, 2024
@lihaoyi lihaoyi changed the title First class Javascript/Typescript support (??? Bounty) First class Javascript/Typescript support (3500 Bounty) Nov 13, 2024
@lihaoyi lihaoyi added the bounty label Nov 13, 2024
@lihaoyi lihaoyi changed the title First class Javascript/Typescript support (3500 Bounty) First class Javascript/Typescript support (3000 Bounty) Nov 13, 2024
@lihaoyi lihaoyi changed the title First class Javascript/Typescript support (3000 Bounty) First class Javascript/Typescript support (4500 Bounty) Nov 13, 2024
@lihaoyi lihaoyi changed the title First class Javascript/Typescript support (4500 Bounty) Add first class Javascript/Typescript support to the Mill build tool (4500 Bounty) Nov 13, 2024
@ayewo
Copy link
Contributor

ayewo commented Nov 13, 2024

Hi @lihaoyi

As a first-time contributor, I will be going over CONTRIBUTING.adoc.

Meanwhile, I have a question.

For the first task, example/jslib/basic/, I take it example/jslib/basic/ is relative to https://github.com/com-lihaoyi/mill/tree/main/example , and this is where the PR will be opened against, correct?

@Myestery
Copy link

Hi @lihaoyi ,
I'll like to work on the linting and testing parts of this bounty

@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 13, 2024

@ayewo so there are two main components to the first task:

  • The examples need to go in the example/ folder. You will need to tweak the package.mill file accordingly
  • The library code supporting the example will need to live in a new jslib/ top-level folder, next to the existing javalib/ kotlinlib/ and scalalib/ folders.

There is existing demo code in https://github.com/com-lihaoyi/mill/blob/main/example/extending/typescript/4-npm-deps-bundle/build.mill that can form the basis of the library code in jslib/, but I expect it will need to be fleshed out (e.g. to include support for at least one JS test-runner)

@digvijay2003
Copy link

Hi @lihaoyi,
I have a solid background in JavaScript and TypeScript and would like to work on this PR. Could you please guide me on how to get started with it?

lihaoyi added a commit that referenced this issue Nov 15, 2024
This sets up the scaffolding for
#3928 and
#3927 to be implemented
@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 15, 2024

For @digvijay2003 and anyone else reading, I merged #3970 which sets up the basic scaffolding:

  • Code in javascriptlib/src/
  • Unit test code in javascriptlib/test/src/, run via ./mill javascriptlib.test
  • Unit test code in example/javascriptlib/, run via ./mill example.javascriptlib.__.local.test

From there you should be able to iterate on the examples necessary for this ticket's bullet points to flesh out the necessary functionality

@lihaoyi
Copy link
Member Author

lihaoyi commented Nov 15, 2024

Also the example typescript module documentation is mandatory reading for anyone who wants to start on this https://mill-build.org/mill/extending/example-typescript-support.html

@monyedavid
Copy link
Contributor

currently working on this

@myyk
Copy link
Contributor

myyk commented Nov 21, 2024

I an extremely simple nextjs app running on mill on this branch on my fork - https://github.com/myyk/mill/tree/example-nextjs.

It's really really really hacky and will need to find a lot of solutions to some of the problems before this is merge ready, but I hope that it might inspire others.

It can be run by making an internal build and using that to run ./mill web.run and then open http://localhost:3000 to see nextjs running.

@myyk
Copy link
Contributor

myyk commented Nov 25, 2024

@lihaoyi I created a PR for this: #4027

This was asked for exactly, but I think this would be a good direction to head for the JS support. I also don't think it will deride @monyedavid's efforts too much as the changes aren't very incompatible. The new TscModule could even be a good home for some of those changes which extend it currently in the build.mill for that draft.

@myyk
Copy link
Contributor

myyk commented Nov 25, 2024

I think there might be sufficient examples for me to build upon to do example/jslib/testing/. I'll try to work on that.

@jodersky
Copy link
Member

Anyone working on this, I'd be curious to hear your thoughts on sharing scalalib.publish.License in this discusssion #4041

lihaoyi pushed a commit that referenced this issue Dec 5, 2024
…4003)

### Related Issues

#3927

### Checklist

- [x] **example/jslib/basic**
- [x] 1-simple/: A minimal Typescript module demonstrating
typechecking/running/testing/bundling of a Node CLI tool
- [x] 2-react/: A minimal Typescript module demonstrating
typechecking/running/testing/bundling of a React-based web application,
served using a static HTML page
- [x] 3-custom-build-logic/: A Typescript module with custom build logic
lihaoyi pushed a commit that referenced this issue Dec 10, 2024
…4022)

### Related Issues

#3927

### Checklist

- [x] **example/jslib/basic**
   - [x] 4-multi-modules/: Multiple inter-related Typescript modules
- [x] 5-client-server-hello/: Demonstrate a client-server application
with two modules, one a minimal JS server and one a minimal JS client,
wired up and interacting
- [x] 6-client-server-realistic/: Demonstrate a client-server
application with two modules, one an Express server and one a React.js
client, wired up and interacting, implementing a TodoMVC application
lihaoyi pushed a commit that referenced this issue Dec 13, 2024
…4098)

#3927

### Checklist
- [x] **example/jslib/testing**
    - [x] 1-test-suite
    - [x] 2-test-deps
lihaoyi pushed a commit that referenced this issue Dec 15, 2024
…4135)

#3927

### Checklist
- [x] **example/jslib/testing/1-test-suite**
    - [x]         vite
    - [x]         Jasmine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants