From 13d27c700e4b0590c4f1c365bfa36cf2a07c437d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 10 Jan 2018 16:04:06 -0800 Subject: [build] Always use style-code's writeIfModified to unify file updates --- scripts/generate-style-code.js | 1 + scripts/style-code.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/generate-style-code.js (limited to 'scripts') diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js old mode 100644 new mode 100755 index 3d805b058a..ff40244f98 --- 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}'`); }; -- cgit v1.2.1