@code-o-mat/history-cache
Version:
A data object structure that logs all changes using the immutable library
41 lines (32 loc) • 888 B
JavaScript
// ups the version in all necessary places.
//
import fs from 'fs';
import path from 'path';
import jsonfile from 'jsonfile';
import humanDate from 'human-date'
import {
getPackageConfig,
getReadme
} from './methods';
const upPackage = (version) => {
let [pkg, pkgFileName] = getPackageConfig();
pkg.version = version;
// fs.writeFileSync(pkgFileName, JSON.stringify(pkg, null, 2));
}
const upReadme = (version) => {
const readme = getReadme();
const re = /####\sVERSION.+\n/;
const match = re.match(readme);
const prettyDate = humanDate(new Date());
readme =
[
readme.slice(match[1]),
`#### VERSION ${version} : ${prettyDate} \n`,
readme.slice(match[1] + match.length)
].join();
// fs.writeFileSync(readmeFileName, readme);
}
export const up = (version) => {
upPackage(version);
upReadme(version);
}