Skip to content

Add pnpm support to JFrog modules (jfrog-token, jfrog-oauth) #1074

Description

@blinkagent

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

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:
    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:
    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 <pkg> 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions