forked from nodejs/nodejs-dist-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add security release column to index
Parse the release notes for a release to determine if it is a security release. Refs: nodejs/Release#437
- Loading branch information
1 parent
2f69e9c
commit 3fea07f
Showing
5 changed files
with
1,807 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const notesre = /Version \d+\.\d+\.\d+.*\n(?!\w+<\/title>)\n(.*)\n/m | ||
, securityre = /This is a security release\./ | ||
|
||
|
||
function isSecurityRelease (notes) { | ||
const m = notes.match(notesre) | ||
if (m && securityre.test(m[1])) | ||
return true | ||
|
||
return false | ||
} | ||
|
||
|
||
module.exports = isSecurityRelease | ||
|
||
|
||
if (module === require.main) { | ||
const assert = require('assert') | ||
const fs = require('fs') | ||
const path = require('path') | ||
const fixturespath = path.join(__dirname, 'test', 'fixtures', 'release-notes') | ||
const tests = [ | ||
{ fixture: 'v10.14.0.atom', expected: true } | ||
, { fixture: 'v10.14.1.atom', expected: false } | ||
, { fixture: 'v11.3.0.atom' , expected: true } | ||
] | ||
|
||
tests.forEach(function (test) { | ||
console.log(`testing ${test.fixture} -> ${test.expected}`) | ||
const fixture = path.join(fixturespath, test.fixture) | ||
const notes = fs.readFileSync(fixture, { encoding: 'utf8' }) | ||
assert.equal(isSecurityRelease(notes), test.expected) | ||
}) | ||
} |
Oops, something went wrong.