#Typescript sdk module inject NPM token

1 messages · Page 1 of 1 (latest)

ripe heron
#

I want my typescript module to be able to access a private npm registry. The typical way of doing that is here: https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow#set-the-token-as-an-environment-variable-on-the-cicd-server

I don't think that is possible is it? Since I can't inject an env variable into the ts runtime. The only thought I had was to copy a .npmrc file into the directory at build time that has the token and registry hard coded...

Documentation for the npm registry, website, and command-line interface

#

Hmm. Though that thread seems to also indicate it isn't possible to use the env atm...

hard blade
#

Hi, I did a node module where I'm handling this usecase with 2 approach.
https://daggerverse.dev/mod/github.com/Dudesons/daggerverse/node@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec#Node.withNpmrcTokenEnv
You can have a npmrc file in your repository and this file is expecting an env var which contains the token.
Or you can inject a file in the container with the token hardcoded or you can generate this file and fetch the token from a vault

ripe heron
#

I wasn’t very clear in the original question

#

Typescript sdk module inject NPM token

ivory basin