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

Speedup "npm install" step for npm-based formatters #1480

Closed
simschla opened this issue Jan 10, 2023 · 2 comments · Fixed by #1590
Closed

Speedup "npm install" step for npm-based formatters #1480

simschla opened this issue Jan 10, 2023 · 2 comments · Fixed by #1590

Comments

@simschla
Copy link
Contributor

From discussion in #1453

Npm-based formatters require an npm install call to prepare running the npm process for formatting.
It would be nice if we could speedup that part (or alltogether prevent it, if it is not needed).
Some ideas:

  1. Store the node_modules-directory and package.json somewhere in build-folder and copy/link those on later calls.
  2. Similar, but more longevity: Store these folders/files somewhere in $HOME/.cache/spotless/npm and reuse/copy/link them from there?
  3. Gradle-specific: Leverage gradle's build-cache by creating a gradle task that generates the package.json and node_modules dir as (cachable) output. A second/third run would then just receive these files/folders from the build cache?
@nedtwigg
Copy link
Member

I'm fine with any of the above, but I think you have the order right. I would implement 2, but I would set build/spotless-npm as the root. Make it an option to set something else, such as ~/.cache/spotless-npm to be the root, but I wouldn't start with that as the default.

@nedtwigg
Copy link
Member

Published in plugin-gradle 6.16.0 and plugin-maven 2.34.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants