Skip to content

Nodeenv demo#3759

Closed
ilyagr wants to merge 1 commit into
jj-vcs:mainfrom
ilyagr:nodeenv
Closed

Nodeenv demo#3759
ilyagr wants to merge 1 commit into
jj-vcs:mainfrom
ilyagr:nodeenv

Conversation

@ilyagr
Copy link
Copy Markdown
Contributor

@ilyagr ilyagr commented May 26, 2024

UPDATE: I'll likely close this soon. I remembered that https://pre-commit.com/ is likely a better option than nodeenv. IIRC, it can install Node+Pretter in a hermetic way, removing the need for a package.json. It should be possible to install pre-commit with Poetry or pipx.

OTOH, I'm not sure pre-commit currently has a working Prettier plugin. pre-commit/pre-commit#3133


This is a demo of using nodeenv to install Prettier for #3757. It may or may not be later fleshed out to a real PR.

Try

poetry install
poetry run -- nodeenv -p
poetry run -- npm install  # After merging this PR with #3757.

If we wanted to use this approach for real, we'd probably want to either use something like https://python-poetry.org/docs/pyproject#scripts or a cargo xtask.

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

@ilyagr ilyagr mentioned this pull request May 26, 2024
4 tasks
@ilyagr ilyagr force-pushed the nodeenv branch 2 times, most recently from 1e422aa to 163bd45 Compare May 26, 2024 04:58
@arxanas
Copy link
Copy Markdown
Contributor

arxanas commented May 26, 2024

Some kind of solution for defining tasks like cargo xtask would be good to add even without the formatting PR (because I generally wouldn't want to figure out the exact invocation to build+serve docs for testing 😅). I think pre-commit as a general "checks" framework is good, but it doesn't seem like it supports general tasks (like a long-running mkdocs server). I would definitely prefer to keep as much as possible in the Rust ecosystem, so cargo xtask seems like a natural choice.

@ilyagr
Copy link
Copy Markdown
Contributor Author

ilyagr commented May 27, 2024

I like the idea of cargo xtask too, but it doesn't solve every problem (e.g. setting up the environment), and I never quite get past setting up the boilerplate I'd need to find out how much more verbose it has to be as compared to a shell script.

Try

```
poetry install
poetry run -- nodeenv -p
poetry run -- npm install  # After merging this PR with jj-vcs#3757.
```


If we wanted to use this approach for real, we'd probably want to either use something like <https://python-poetry.org/docs/pyproject#scripts> or a [`cargo xtask`](https://github.com/matklad/cargo-xtask).
@ilyagr
Copy link
Copy Markdown
Contributor Author

ilyagr commented Jun 3, 2024

I'll close this. I think DPrint is a better option; it can be cargo-installed.

@ilyagr ilyagr closed this Jun 3, 2024
@ilyagr ilyagr deleted the nodeenv branch June 13, 2024 04:35
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.

2 participants