From bd0ca28e955e48909659d7e56a5ad9cc1df3ccb2 Mon Sep 17 00:00:00 2001 From: Zalmoxisus Date: Tue, 11 Dec 2018 00:16:45 +0200 Subject: [PATCH] Use `lerna run` to test only what was changed since master --- .travis.yml | 7 +++++++ package.json | 6 ++++-- scripts/run-in-packages.js | 21 --------------------- 3 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 scripts/run-in-packages.js diff --git a/.travis.yml b/.travis.yml index d1d9e047..d9f70399 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,3 +3,10 @@ language: node_js node_js: - "lts/*" - "stable" +cache: + yarn: true + directories: + - "node_modules" +script: + - npm run lint + - npm test diff --git a/package.json b/package.json index d9743699..9e2e3768 100644 --- a/package.json +++ b/package.json @@ -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/*" diff --git a/scripts/run-in-packages.js b/scripts/run-in-packages.js deleted file mode 100644 index c675dca3..00000000 --- a/scripts/run-in-packages.js +++ /dev/null @@ -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); -}