Use pnpm instead of npm (#1375)

Pnpm is like npm except instead of keeping multiple copies of
dependencies, it shares a single copy for multiple dependencies
significantly reducing build time and the space needed to hold all the
dependencies. Read [here](https://pnpm.io/motivation) for more info.

This changes our CI to use pnpm and allows developers to choose to use
pnpm instead of npm. Also, pnpm has a built-in node version manager so
devs no longer need to use nvm to work on photonvision. All npm
functionality (including photon-server gradle tasks) still functions
using npm so this isn't breaking. We should make a docs change to
suggest to use pnpm.
This commit is contained in:
Sriman Achanta
2024-07-24 00:45:19 -04:00
committed by GitHub
parent 9ad9b8288a
commit 3c58b05af7
9 changed files with 3754 additions and 5286 deletions

View File

@@ -1,7 +1,7 @@
plugins {
id "application"
id 'com.github.johnrengelman.shadow' version '8.1.1'
id "com.github.node-gradle.node" version "7.0.1"
id "com.github.node-gradle.node" version "7.0.2"
id "org.hidetake.ssh" version "2.11.2"
id 'edu.wpi.first.WpilibTools' version '1.3.0'
}
@@ -32,17 +32,23 @@ shadowJar {
}
node {
download = true
version = "18.20.4"
nodeProjectDir = file("${projectDir}/../photon-client")
}
tasks.register('copyClientUIToResources', Copy) {
tasks.register('buildUI', PnpmTask) {
args = ["run", "build"]
}
tasks.register('copyUIToResources', Copy) {
from "${projectDir}/../photon-client/dist/"
into "${projectDir}/src/main/resources/web/"
}
tasks.register("buildAndCopyUI") {
dependsOn "npm_run_build"
finalizedBy "copyClientUIToResources"
dependsOn "buildUI"
finalizedBy "copyUIToResources"
}
run {