I need to setup Travis
in a monorepo,
I couldn't find resources.
How can I setup the npm deploy for every package?
I need to setup Travis
in a monorepo,
I couldn't find resources.
How can I setup the npm deploy for every package?
To setup a lerna repository with travis:
Using:
$ node -v
v10.14.2
$ npm -v
6.4.1
With the structure:
packages/
foo
index.js
package.json
package-lock.json
bar
index.js
package.json
package-lock.json
package.json
package-lock.json
lerna.json
.travis.yml
package-lock.json
must be included for all packages.
package.json
{
"name": "my-project-name",
"scripts": {
"postinstall": "lerna bootstrap",
"test": "my-testing-script",
...
},
"dependencies": {
"lerna": "^3.7.1",
...
}
}
NPM script postinstall
to set up the packages before running script test
. Some people install the package globally, but since you already installed it locally, you don't need to.
Since this is the main package.json
, you can put all the dependencies in dependencies
.
The package.json
for the packages can be configured as you need.
lerna.json
{
"packages": [
"packages/*"
]
}
The file can be configured however you need.
.travis.yml
language: node_js
node_js:
- "10.14"
script: npm run test
Here you can configure the testing environment the way you need.
In my case, I needed to transpile some files with babel and I used before_script
to run this process before the testing script is run.