From 4ada4038416be91c3b05f14ab595e7ce05376296 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Tue, 10 Mar 2020 10:37:51 -0700 Subject: [PATCH] generate-changelog.js should be Node 6 compatible Summary: Node on SandCastle is ancient, this change makes sure we can use the node version of `www`. Node 6 can't parse dangling comma's in argument lists, which is what prettier automatically inserts by fbsource standards Reviewed By: passy Differential Revision: D20366026 fbshipit-source-id: 1b2a0c1506e8671fa268fab7a8d3bfcd5064bb0b --- .eslintignore | 1 + scripts/generate-changelog.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.eslintignore b/.eslintignore index bc83375c4..28b3ea114 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,3 +11,4 @@ lib dist website/build react-native/ReactNativeFlipperExample +scripts/generate-changelog.js diff --git a/scripts/generate-changelog.js b/scripts/generate-changelog.js index f20543011..e8ff6d4a8 100755 --- a/scripts/generate-changelog.js +++ b/scripts/generate-changelog.js @@ -5,7 +5,12 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat + */ + +/** + * WARNING: this file should be able to run on node v6.16.0, which is used at SandCastle. + * Please run `nvm use 6.16.0` before testing changes in this file! */ const path = require('path'); @@ -14,9 +19,7 @@ const cp = require('child_process'); const root = path.join(__dirname, '..'); -const version = JSON.parse( - fs.readFileSync(path.join(root, 'package.json'), 'utf8'), -).version; +const version = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version; const now = new Date(); const date = `${now.getDate()}/${now.getMonth() + 1}/${now.getFullYear()}`; @@ -29,12 +32,12 @@ const lastCommit = cp const firstCommit = cp .execSync( `hg log --limit 1 --template '{node}' --keyword 'Flipper Release: v'`, - {cwd: root}, + {cwd: root} ) .toString(); console.log( - `Generating changelog for version ${version} based on ${firstCommit}..${lastCommit}`, + `Generating changelog for version ${version} based on ${firstCommit}..${lastCommit}` ); // # get all commit summaries since last release | find all changelog entries, but make sure there is only one line per commit by temporarily replacing newlines