I try to redesign my component lib into a monorepo. I chose lerna for this. All worked fine until I tried to connect it to Travis CI.
There is one trick I do on Travis you need to be aware of first. I use private NPM registry for one of the dependencies, I also store my lib in the same place.
So for the development purposes I have a token stored in .npmrc file with read-only access in the code base. The token with publish rights is kept in Travis and when the jobs are run there I override the .npmrc content with the Travis token.
It all worked fine (for NPM publish) until I switched to lerna.
Now when I run lerna publish, I can see a message that:
lerna ERR! EUNCOMMIT Working tree has uncommitted changes,
please commit or remove the following changes before continuing:
lerna ERR! EUNCOMMIT M .npmrc
I tried to add .npmrc to .gitignore but it's undoable. I need to modify this file, I don't want to keep it in repo. How to solve this?
Thanks in advance.
You can commit in your Travis-build, as illustrated by this Gist.
You only need to be careful, and not create a Travis CI fork bomb(!): see travis-ci/travis-ci
issue 1701.
The other approach is a to add a "prepare": "git update-index --skip-worktree -- .npmrc",
script step in your package.json
, in order to force a file to ignore its modification.
See here.