ulogger-server/.githooks/build-status.js

32 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-04-07 19:21:29 +02:00
/*
* μlogger
*
* Copyright(C) 2020 Bartek Fabiszewski (www.fabiszewski.net)
*
* This is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
const exec = require('child_process').execSync;
const sourcesModified = () => {
const lastBuildCommit = exec('git log -1 --pretty="format:%H" js/dist/*bundle*js*').toString();
const output = exec(`git diff --name-only ${lastBuildCommit} HEAD js/src`).toString();
return !!output && output.split('\n').length > 0;
2020-04-07 19:21:29 +02:00
};
if (sourcesModified()) {
console.log('\nPlease update and commit distribution bundle first!\nYou may still push using --no-verify option.\n');
process.exitCode = 1;
}