summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-01-10 16:04:06 -0800
committerKonstantin Käfer <mail@kkaefer.com>2018-01-24 08:35:31 -0800
commit13d27c700e4b0590c4f1c365bfa36cf2a07c437d (patch)
treecade6aa820a3f516963e2c01c16d3e91b32a6b43 /scripts
parent9d1fa508a34f013573294794028f4ffa5a5f5f3d (diff)
downloadqtlocation-mapboxgl-13d27c700e4b0590c4f1c365bfa36cf2a07c437d.tar.gz
[build] Always use style-code's writeIfModified to unify file updates
Diffstat (limited to 'scripts')
-rwxr-xr-x[-rw-r--r--]scripts/generate-style-code.js1
-rw-r--r--scripts/style-code.js6
2 files changed, 5 insertions, 2 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js
index 3d805b058a..ff40244f98 100644..100755
--- a/scripts/generate-style-code.js
+++ b/scripts/generate-style-code.js
@@ -1,3 +1,4 @@
+#!/usr/bin/env node
'use strict';
const fs = require('fs');
diff --git a/scripts/style-code.js b/scripts/style-code.js
index 70914c5fb6..7e53ebb6be 100644
--- a/scripts/style-code.js
+++ b/scripts/style-code.js
@@ -30,11 +30,13 @@ global.writeIfModified = function(filename, newContent) {
try {
const oldContent = fs.readFileSync(filename, 'utf8');
if (oldContent == newContent) {
- console.warn(`* Skipping current file '${filename}'`);
+ console.warn(`* Skipping file '${filename}' because it is up-to-date`);
return;
}
} catch(err) {
}
- fs.writeFileSync(filename, newContent);
+ if (['0', 'false'].indexOf(process.env.DRY_RUN || '0') !== -1) {
+ fs.writeFileSync(filename, newContent);
+ }
console.warn(`* Updating outdated file '${filename}'`);
};