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
This commit is contained in:
Michel Weststrate
2020-03-10 10:37:51 -07:00
committed by Facebook Github Bot
parent 82881b7463
commit 4ada403841
2 changed files with 10 additions and 6 deletions

View File

@@ -11,3 +11,4 @@ lib
dist
website/build
react-native/ReactNativeFlipperExample
scripts/generate-changelog.js

View File

@@ -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