Basic pnpm preparation task
For cases where development is not done with pnpm, but rather just the usage of a specific tool from the ecosystem, there is a task to prepare such an environment.
build.gradle
import org.ysb33r.gradle.jse.pnpm.tasks.PnpmPrepareTask
import org.ysb33r.gradle.jse.pnpm.toolchains.JsePnpmToolchain
import org.ysb33r.gradle.jsecosystem.packages.PackageDescriptor
jsEcosystem {
toolchains {
pnpm(JsePnpmToolchain) {
withPnpmNode()
}
}
}
tasks.register('pnpmPrepare', PnpmPrepareTask) {
workdir = project.layout.buildDirectory.dir('myWorkdir') (1)
toolchain = jsEcosystem.toolchains.named('pnpm', JsePnpmToolchain) (2)
packages = project.provider { -> (3)
[
PackageDescriptor.of('downdoc', '1.2.3'), (4)
PackageDescriptor.of('asciidoctor', 'cli', '4.5.6') (5)
]
}
}
| 1 | Provide the directory where work will be done within |
| 2 | Associate a toolchain with the task. |
| 3 | Provider a list of packages. |
| 4 | An example of a classic package without a scope, but with a version. |
| 5 | A package with a scope, name and version. |