From 5f02ca87688481dbcf155e49ca8b61732f30e542 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Wed, 2 Oct 2024 15:56:44 -0700 Subject: [PATCH] Migrate history to GitHub releases --- package.json | 3 +- scripts/version-history.js | 63 -------------------------------------- 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 scripts/version-history.js diff --git a/package.json b/package.json index 44227a0..7f3daa8 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "test": "mocha --reporter spec --bail --check-leaks test/", "test-ci": "nyc --reporter=lcov --reporter=text npm test", "test-cov": "nyc --reporter=html --reporter=text npm test", - "update-bench": "node scripts/update-benchmark.js", - "version": "node scripts/version-history.js && git add HISTORY.md" + "update-bench": "node scripts/update-benchmark.js" } } diff --git a/scripts/version-history.js b/scripts/version-history.js deleted file mode 100644 index c58268a..0000000 --- a/scripts/version-history.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict' - -var fs = require('fs') -var path = require('path') - -var HISTORY_FILE_PATH = path.join(__dirname, '..', 'HISTORY.md') -var MD_HEADER_REGEXP = /^====*$/ -var VERSION = process.env.npm_package_version -var VERSION_PLACEHOLDER_REGEXP = /^(?:unreleased|(\d+\.)+x)$/ - -var historyFileLines = fs.readFileSync(HISTORY_FILE_PATH, 'utf-8').split('\n') - -if (!MD_HEADER_REGEXP.test(historyFileLines[1])) { - console.error('Missing header in HISTORY.md') - process.exit(1) -} - -if (!VERSION_PLACEHOLDER_REGEXP.test(historyFileLines[0])) { - console.error('Missing placeholder version in HISTORY.md') - process.exit(1) -} - -if (historyFileLines[0].indexOf('x') !== -1) { - var versionCheckRegExp = new RegExp('^' + historyFileLines[0].replace('x', '.+') + '$') - - if (!versionCheckRegExp.test(VERSION)) { - console.error('Version %s does not match placeholder %s', VERSION, historyFileLines[0]) - process.exit(1) - } -} - -historyFileLines[0] = VERSION + ' / ' + getLocaleDate() -historyFileLines[1] = repeat('=', historyFileLines[0].length) - -fs.writeFileSync(HISTORY_FILE_PATH, historyFileLines.join('\n')) - -function getLocaleDate () { - var now = new Date() - - return zeroPad(now.getFullYear(), 4) + '-' + - zeroPad(now.getMonth() + 1, 2) + '-' + - zeroPad(now.getDate(), 2) -} - -function repeat (str, length) { - var out = '' - - for (var i = 0; i < length; i++) { - out += str - } - - return out -} - -function zeroPad (number, length) { - var num = number.toString() - - while (num.length < length) { - num = '0' + num - } - - return num -}