Fail commit if docs changed

This commit is contained in:
Sidharth Vinod 2022-09-03 09:52:29 +05:30
parent f45c0e3617
commit b6d0d7fe15
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
1 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import { readFileSync, writeFileSync, mkdirSync, copyFileSync, existsSync } from
import flatmap from 'unist-util-flatmap';
import { globby } from 'globby';
import { join, dirname } from 'path';
import { exec } from 'child_process';
let fileChanged = false;
// Possible Improvement: combine with lint-staged to only copy files that have changed
@ -61,6 +62,7 @@ const transform = (file: string) => {
});
if (fileChanged) {
console.log('Please commit the changes to the docs folder');
exec('git add docs');
process.exit(1);
}
})();