UNPKG

@codibre/confs

Version:

A simple package to centralize IDE configuration of all codibre's projects

28 lines (24 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateChangelog = void 0; const fs_1 = require("./fs"); async function updateChangelog() { console.log('Reading package.json'); const v = JSON.parse((await fs_1.readFile('package.json')).toString()).version; const changeLogFile = 'CHANGELOG.md'; let content = (await fs_1.exists(changeLogFile)) ? (await fs_1.readFile(changeLogFile)).toString() : ''; if (content.replace(/[\r\n]/g, '') === '') { content = `# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Next Release `; } const c = content.replace(/(Next Release\n-*)/i, '$1\n\n\n-'.padStart(v.length, '-') + `v${v}`); await fs_1.writeFile(changeLogFile, c); console.log(c); } exports.updateChangelog = updateChangelog;