Skip to content

Commit

Permalink
[meta] improve npm run since to include docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 10, 2018
1 parent a1092d4 commit bbbd6ea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions since.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ const { spawnSync } = require('child_process');
const glob = require('glob-gitignore');

const packagesDir = path.join(__dirname, 'packages');
const docsDir = path.join(__dirname, 'docs');

const packages = (process.argv.length > 2 ? [process.argv[2]] : glob.sync('*', { cwd: packagesDir }))
.map(name => JSON.parse(fs.readFileSync(path.join(packagesDir, name, 'package.json'))))
.filter(x => !x.private && x.name !== 'enzyme-example-mocha');

packages.forEach((pkg) => {
const tag = `${pkg.name}@${pkg.version}`;
const log = spawnSync('git', ['log', '--oneline', `${tag}..HEAD`, path.join(packagesDir, pkg.name)], { stdio: 'pipe' });
const tag = `${pkg.name === 'docs' ? 'enzyme' : pkg.name}@${pkg.version}`;
const dir = path.join(packagesDir, pkg.name);
const logArgs = ['log', '--oneline', `${tag}..HEAD`, dir].concat(pkg.name === 'enzyme' ? docsDir : []);
const log = spawnSync('git', logArgs, { stdio: 'pipe' });
if (log.stdout.length > 0 || log.stderr.length > 0) {
console.log(tag);
spawnSync('git', ['log', '--oneline', `${tag}..HEAD`, path.join(packagesDir, pkg.name)], { stdio: 'inherit' });
spawnSync('git', logArgs, { stdio: 'inherit' });
console.log('\n');
}
});

0 comments on commit bbbd6ea

Please sign in to comment.