ensure up to date readme

This commit is contained in:
Timo Hocker 2020-05-12 09:50:57 +02:00
parent 86aa9103ac
commit 1bd7125c84
2 changed files with 24 additions and 17 deletions

View File

@ -25,12 +25,16 @@ child_process.execSync ('yarn lint', { stdio: 'inherit' });
child_process.execSync ('yarn test', { stdio: 'inherit' });
child_process.execSync ('yarn compile', { stdio: 'inherit' });
child_process.exec ('git log -1 | grep \\'\\\\[no publish\\\\]\\'')
.addListener ('exit', (code) => {
if (code === 0) {
console.log ('build not marked for deployment');
process.exit (1);
}
else { child_process.execSync ('yarn publish --access public'); }
});
if (fs.existsSync ('README.md')) {
const readme = fs.readFileSync ('README.md', 'utf-8');
// eslint-disable-next-line prefer-named-capture-group
const version = (/version: ([0-9.]+)/ui).exec (readme);
if (
typeof version === 'undefined'
|| version[1] !== pkg.version
)
console.log ('readme version does not match package version');
else
child_process.execSync ('yarn publish --access public');
}
`;

View File

@ -16,12 +16,15 @@ child_process.execSync ('yarn lint', { stdio: 'inherit' });
child_process.execSync ('yarn test', { stdio: 'inherit' });
child_process.execSync ('yarn compile', { stdio: 'inherit' });
child_process.exec ('git log -1 | grep \'\\[no publish\\]\'')
.addListener ('exit', (code) => {
if (code === 0) {
console.log ('build not marked for deployment');
process.exit (1);
}
else { child_process.execSync ('yarn publish --access public'); }
});
if (fs.existsSync ('README.md')) {
const readme = fs.readFileSync ('README.md', 'utf-8');
// eslint-disable-next-line prefer-named-capture-group
const version = (/version: ([0-9.]+)/ui).exec (readme);
if (
typeof version === 'undefined'
|| version[1] !== pkg.version
)
console.log ('readme version does not match package version');
else
child_process.execSync ('yarn publish --access public');
}