[build] Add build that verifies the submodule pin is up-to-date
This commit is contained in:
28
scripts/nitpick/index.js
Normal file
28
scripts/nitpick/index.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var failed = false;
|
||||
|
||||
process.on('exit', function() {
|
||||
if (failed) {
|
||||
process.exitCode = 1;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = function(status, str, desc) {
|
||||
if (status) {
|
||||
console.warn(`\x1b[1m\x1b[32m✔︎ ${str}\x1b[0m`);
|
||||
} else {
|
||||
console.warn(`\x1b[1m\x1b[31m✘ ${str}\x1b[0m`);
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if (desc) {
|
||||
console.warn(`${desc.split('\n').map((line) => '| ' + line).join('\n')}\n`);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.ok = function(str, desc) {
|
||||
module.exports(true, str, desc);
|
||||
};
|
||||
|
||||
module.exports.fail = function(str, desc) {
|
||||
module.exports(false, str, desc);
|
||||
};
|
||||
13
scripts/nitpick/submodule-pin.js
Executable file
13
scripts/nitpick/submodule-pin.js
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
const nitpick = require('.');
|
||||
const child_process = require('child_process');
|
||||
|
||||
// Make sure that the mapbox-gl-js submodule pin is up to date
|
||||
const head = child_process.execSync('git -C mapbox-gl-js rev-parse HEAD').toString().trim();
|
||||
const revs = child_process.execSync(`git -C mapbox-gl-js branch -a --contains ${head}`).toString().split('\n');
|
||||
|
||||
if (revs.indexOf(' remotes/origin/master') >= 0) {
|
||||
nitpick.ok(`mapbox-gl-js submodule pin is merged to master`);
|
||||
} else {
|
||||
nitpick.fail(`mapbox-gl-js submodule is pinned to ${head}, which isn't merged to master`);
|
||||
}
|
||||
Reference in New Issue
Block a user