Set NPM Auth Token?
See original GitHub issueI’m new to CircleCI, and I’m trying to use the Cypress CircleCI Orb. To build my application, I need to install private NPM packages (using Yarn). So I need to be able to run a command like this somewhere in config.yml
:
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
I don’t know where to put it though. The install
job’s build
parameter runs after yarn install
. Is it possible to set the NPM auth token somewhere? Maybe @eddiewebb would have a suggestion? I think one approach would be to add a parameter called pre
to the install
job.
Alternatively, I’d imagine I could write out my config.yml
with all the settings I need (except for the NPM token). Then, I could “eject” using circleci config process config.yml
and figure out where to add the NPM auth token.
Side Note
This Orb seems really cool! We’ve been using the Cypress Dashboard and Travis CI to run our Cypress tests in CI for the past several months. We never found a way to avoid installing Cypress on every machine when running the tests in parallel. That introduces a huge bottleneck. We could run our test suite so much more efficiently with this orb!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@nmchaves, all orb jobs have a built in
pre-steps
andpost-steps
The first could be used in your call to the test job to run and commands to want to occur before Cypress steps
@nmchaves I would always strive to avoid duplicate work. So I would install NPM dependencies and build the server in the
cypress/install
job, then it will attach the workspace and pass everything intocypress/run
jobs (which can run in parallel). The example https://github.com/cypress-io/circleci-orb/blob/master/docs/examples.md#build-app shows thisBut you can also just look at the effective config, either on CircleCI web application or using CLI command https://github.com/cypress-io/circleci-orb#effective-config to see what exactly is going on.
To close this issue I will add an example of setting NPM auth token using
pre-
job step like @eddiewebb has shown to the documentation, it is a good one.