Files
polaris-react/scripts/readme-update-version.js
Ben Scott 9e5196a850 Tidy up some eslint ignore lines
* Stop ignoring /tests and /playground as plugins no longer crash on
  those files
* Remove folder-specific eslint files as they don't do anything
* Use `eslint-ignore no-console` at the top of scripts to avoid having
 to add it to every line
* Add an override targeting the playground to avoid needing to include
the eslint-disable in the file (and thus in the PR template)
2018-10-23 13:21:21 -07:00

22 lines
732 B
JavaScript

/* eslint-disable no-console */
const {execSync} = require('child_process');
const {writeFileSync, readFileSync} = require('fs-extra');
const {resolve} = require('path');
const {version: newVersion} = require('../package.json');
const {semverRegExp, readmes} = require('./utilities');
const root = resolve(__dirname, '..');
console.log(`🆕 Updating version in ${readmes.join(', ')}...`);
readmes.map((readme) => resolve(root, readme)).forEach((file) => {
writeFileSync(
file,
readFileSync(file, 'utf8').replace(semverRegExp, newVersion),
);
});
console.log(`🏃‍♂️ Running \`git add -A ${readmes.join(' ')}\`...`);
const execOpts = {stdio: 'inherit'};
execSync(`git add -A ${readmes.join(' ')}`, execOpts);