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 a Justfile #5636

Closed
wants to merge 1 commit into from
Closed

Add a Justfile #5636

wants to merge 1 commit into from

Conversation

neongreen
Copy link
Contributor

This lets us run common commands as just <foo> and reference them in the docs.

just is a popular alternative to managing project-specific commands in Makefiles. The nice parts are:

  • Fewer syntax footguns
  • Command descriptions and groups

Example:

❯ just
Available recipes:
    format               # Format all code
    update-cli-reference # Update generated CLI help (cli/tests/[email protected])

    [docs]
    build-docs           # Build documentation into rendered-docs/ for offline use
    serve-docs           # Preview documentation with live reloading

If there is agreement, I will also update the docs to reference just for builds-docs, serve-docs, and update-cli-reference.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

This lets us run common commands as `just <foo>` and reference them in the
docs.

`just` is a popular alternative to managing project-specific commands
in Makefiles. The nice parts are:

- Fewer syntax footguns
- Command descriptions and groups

Example:

```
❯ just
Available recipes:
    format               # Format all code
    update-cli-reference # Update generated CLI help (cli/tests/[email protected])

    [docs]
    build-docs           # Build documentation into rendered-docs/ for offline use
    serve-docs           # Preview documentation with live reloading
```
@neongreen neongreen force-pushed the emily/jj-pputszxxkttu branch from b023b12 to d841e91 Compare February 10, 2025 03:24
@arxanas
Copy link
Contributor

arxanas commented Feb 10, 2025

How about mise instead? In addition to functioning as a task runner, it should also solve certain problems of installing cross-language tooling (particularly formatters and doc website tooling). This was a problem in #3757 (cc @ilyagr).

In this case it would also be able to provision uv for the user. We could probably leverage it to also install dprint/treefmt and/or any language-specific formatters. It seems to work straightforwardly in CI as well.

@neongreen
Copy link
Contributor Author

Could be mise, I've never heard of it (other than here) but either works for me

@wjv
Copy link

wjv commented Feb 10, 2025

Big fan of just myself. Since I'm just a jj user and not developer, I can't really comment on whether this particular Justfile will make a jj developer's life easier (though it looks fine to me!)

At the very least, though, adding a Justfile can surely not break anything!

@PhilipMetzger
Copy link
Contributor

I'm no particular fan of doing this, since it is similar in spirit to adding a editor-specific configuration folder or supporting a Buck2 (#1997) or Bazel build. I don't intend to block it if a majority likes it.

@ilyagr
Copy link
Contributor

ilyagr commented Feb 10, 2025

Indeed, as Waleed said, there was a related conversation around #3757 (comment).

The trouble with just is that it doesn't help the user install any of the tools it relies on. I'm also not sure it's easy to set up on Windows. (It might need to be pointed to Git Bash's sh?)

I would not change contributing.md to rely on just, because that would make just one more tool that the user needs to install.

There were a few discussions on Discord about possible tools that could do a better job. I don't think we've discussed mise, but it might be great, especially if Waleed had some good experience with it. Other possible tools are proto or moon from https://moonrepo.dev, or trying to overload uv to do everything. My hope is that one of these tools would help install everything else, including uv and any future tools we might want to use a dev tools (NodeJS-based, especially). One of these tools could be just, though any of mise/moon/uv might provide their own command runners for the tools they install.

(The advantage of uv is that, I think, more and more people will have uv already installed as time goes by. I'm not sure mise will become as popular)

# Format all code
format:
cargo +nightly fmt

Copy link
Member

Choose a reason for hiding this comment

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

A clippy alias matching CI would also be helpful:

cargo +stable clippy --all-features --workspace --all-targets

@emesterhazy
Copy link
Member

I'm generally in favor of something like this and don't have an opinion about the specific tool we use. It would be nice to have simple ways to run cargo commands (fmt, clippy) using the same flags as the CI pipeline, assuming we can't accomplish that with .rustfmt.toml and .clippy.toml.

@emesterhazy
Copy link
Member

Actually, I do have an opinion about what tool to use :D

Even if just has simpler syntax and command descriptions, everyone already has make installed, so from that perspective make is simpler than just. With that in mind, I'd suggest either using something that solves the tool provisioning issue that ilyagr and arxanas mentioned, or just using make for now. Hopefully we aren't adding so many commands that command descriptions become necessary.

@PhilipMetzger
Copy link
Contributor

PhilipMetzger commented Feb 12, 2025

Actually, I do have an opinion about what tool to use :D

Even if just has simpler syntax and command descriptions, everyone already has make installed, so from that perspective make is simpler than just. With that in mind, I'd suggest either using something that solves the tool provisioning issue that ilyagr and arxanas mentioned, or just using make for now. Hopefully we aren't adding so many commands that command descriptions become necessary.

Make doesn't exist on Windows, so it would hinder portability between OSes. Also I have a heavy personal dislike for it.

@neongreen
Copy link
Contributor Author

I ended up trying mise a couple days ago and I’m sold. I will close this PR and create a new one for mise.

A rather neat thing is that mise tasks can just be .sh scripts, which mise will autodetect.

@neongreen neongreen closed this Feb 12, 2025
@ilyagr
Copy link
Contributor

ilyagr commented Feb 12, 2025

A rather neat thing is that mise tasks can just be .sh scripts, which mise will autodetect.

Does this work on Windows? Can mise install mingw or git for windows or something?

We really need help with polishing jj on Windows, so I think it's important to make developing there as simple as possible and to not have Windows devs feel like they are an afterthought.

@steveklabnik
Copy link
Contributor

Yes, I would really encourage minimizing the use of shell scripts. mingw and friends really make me as a windows user feel like a second class citizen. I don't have them on my computer even.

Normally I would say that Just would make the most sense for all of these tools, but mise seems like a huge advantage so that you can maintain other tools' environments too, since jj depends on python as well.

@neongreen
Copy link
Contributor Author

Does this work on Windows? Can mise install mingw or git for windows or something?

I assume it could be some kind of "sh or powershell" situation, where each script is present as a sh version and a powershell version and mise can choose between them.

Ie. what I'd like is "if you choose, you can run things without needing to install just/mise/etc at all", which can hopefully be orthogonal to the shell choice

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.

7 participants