Use lerna run to test only what was changed since master

This commit is contained in:
Zalmoxisus 2018-12-11 00:16:45 +02:00
parent 57ce2abc4e
commit ba265e453e
3 changed files with 11 additions and 23 deletions

View File

@ -3,3 +3,10 @@ language: node_js
node_js:
- "lts/*"
- "stable"
cache:
yarn: true
directories:
- "node_modules"
script:
- npm run lint
- npm test

View File

@ -4,8 +4,10 @@
"lerna": "3.4.2"
},
"scripts": {
"lint": "node ./scripts/run-in-packages npm run lint",
"test": "node ./scripts/run-in-packages npm run test"
"lint": "lerna run lint --since master -- --color",
"lint:all": "lerna run lint -- --color",
"test": "lerna run test --since master -- --colors",
"test:all": "lerna run test -- --colors"
},
"workspaces": [
"packages/*"

View File

@ -1,21 +0,0 @@
const path = require("path");
const { readdirSync, statSync } = require('fs');
const { execSync } = require("child_process");
const execArgs = { stdio: "inherit", env: process.env };
const command = process.argv.slice(2).join(' ');
const getDirectories = srcPath => readdirSync(srcPath)
.filter(file => statSync(path.join(srcPath, file)).isDirectory());
if (!command) {
console.error('No command specified.')
} else {
const cwd = process.cwd();
getDirectories('packages').forEach(packageName => {
console.log(packageName, path.resolve(__dirname, "../packages/" + packageName));
process.chdir(path.resolve(__dirname, "../packages/" + packageName));
execSync(command, execArgs);
});
process.chdir(cwd);
}