Skip to content

Commit

Permalink
Drop changelog
Browse files Browse the repository at this point in the history
Closes gh-5
  • Loading branch information
philwebb committed Mar 21, 2024
1 parent 8ecb652 commit 9f0f4c7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
17 changes: 0 additions & 17 deletions CHANGELOG.adoc

This file was deleted.

19 changes: 0 additions & 19 deletions npm/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,10 @@ const { promises: fsp } = require('fs')
const ospath = require('path')

const PROJECT_ROOT_DIR = ospath.join(__dirname, '..')
const CHANGELOG_FILE = ospath.join(PROJECT_ROOT_DIR, 'CHANGELOG.adoc')
const PACKAGE_LOCK_FILE = ospath.join(PROJECT_ROOT_DIR, 'package-lock.json')
const PACKAGES_DIR = ospath.join(PROJECT_ROOT_DIR, 'packages')
const VERSION = process.env.npm_package_version

function getCurrentDate (now = new Date()) {
return new Date(now.getTime() - now.getTimezoneOffset() * 60000)
}

function updateChangelog (releaseDate) {
return fsp.readFile(CHANGELOG_FILE, 'utf8').then((changelog) =>
fsp.writeFile(
CHANGELOG_FILE,
changelog.replace(/^== (?:(Unreleased)|\d.*)$/m, (currentLine, replace) => {
const newLine = `== ${VERSION} (${releaseDate})`
return replace ? newLine : [newLine, '_No changes since previous release._', currentLine].join('\n\n')
})
)
)
}

function updatePackageLock () {
return fsp.readdir(PACKAGES_DIR, { withFileTypes: true }).then((dirents) => {
const packageNames = dirents.filter((dirent) => dirent.isDirectory()).map(({ name }) => name)
Expand Down Expand Up @@ -64,7 +47,5 @@ function updatePackageLock () {
}

;(async () => {
const releaseDate = getCurrentDate().toISOString().split('T')[0]
await updateChangelog(releaseDate)
await updatePackageLock()
})()

0 comments on commit 9f0f4c7

Please sign in to comment.