Add `pnpm` support to JFrog modules (`jfrog-token`, `jfrog-oauth`)
- Dominant language
- HCL
- Stars
- 79
- Forks
- 161
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 38
Description
## Summary
JFrog CLI now natively supports pnpm via `jf pnpm` (install/publish with build-info tracking). We should add `pnpm` as a first-class package manager to the `jfrog-token` and `jfrog-oauth` modules in `coder/registry`, alongside the existing `npm`, `go`, `pypi`, `docker`, `conda`, and `maven` support.
## References
- JFrog CLI PR: https://github.com/jfrog/jfrog-cli/pull/3390
- jfrog-cli-artifactory PR: https://github.com/jfrog/jfrog-cli-artifactory/pull/393
- Shipped in: https://github.com/jfrog/jfrog-cli/releases/tag/v2.98.0
- Docs: https://docs.jfrog.com/artifactory/docs/use-pnpm-with-jfrog-cli
- Supported versions (pnpm 10.x / 11.x, 11.x requires jf CLI >= 2.116.0): https://docs.jfrog.com/artifactory/docs/package-manager-compatibility-matrix
## Requirements
- pnpm 10.x or 11.x (11.x needs JFrog CLI >= 2.116.0)
- Node.js 20+
- An npm-type Artifactory repository (reused for pnpm)
- `.npmrc` with registry URL + auth (same file pnpm reads)
## Proposed changes
Apply to both `registry/coder/modules/jfrog-token` and `registry/coder/modules/jfrog-oauth`:
1. Extend the `package_managers` variable with a new optional `pnpm` list:
```hcl
pnpm = optional(list(string), [])
```
2. Reuse the existing `.npmrc.tftpl` template for pnpm (same registry + auth format). If both `npm` and `pnpm` are provided pointing to different repos, decide behavior: either (a) require they resolve to the same repo, or (b) generate a merged `.npmrc` with the pnpm entries scoped appropriately.
3. In `run.sh`, add a `pnpm` block mirroring the `npm` block:
```bash
if [ -z "${HAS_PNPM}" ]; then
not_configured pnpm
else
echo "📦 Configuring pnpm..."
jf pnpmc --global --repo-resolve "${REPOSITORY_PNPM}"
cat << EOF > ~/.npmrc
${NPMRC}
EOF
config_complete
fi
```
Note: verify the exact config subcommand name (`jf pnpmc` vs `jf pnpm-config`) against the shipped CLI.
4. Pass `HAS_PNPM`, `REPOSITORY_PNPM` into the `templatefile(...)` call in `main.tf`.
5. Update `README.md` examples to include `pnpm = ["npm-local"]` (or a dedicated repo) and show `jf pnpm install ` usage.
6. Add a `pnpm` case in `*.tftest.hcl` to assert the script contains the `jf pnpmc` invocation.
7. Bump module versions and note the new input in the changelog/README.
## Notes / open questions
- pnpm uses the same npm-type Artifactory repo, so we may not need a separate variable — but a dedicated `pnpm` key keeps the UX consistent and future-proofs it if JFrog diverges.
- The module doesn't install pnpm itself (matches existing behavior for `npm`, `go`, etc.) — document this in the README.
- Confirm minimum `jf` CLI version we should recommend (>= 2.98.0 for pnpm 10.x, >= 2.116.0 for pnpm 11.x).
Created on behalf of @matifali
Contributor guide
Assessment
This issue has not been assessed yet.