@jayree/changelog
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -12,47 +12,3 @@ /* | ||
import { marked } from 'marked'; | ||
import semver from 'semver'; | ||
import compare from 'semver-compare'; | ||
// original from https://github.com/salesforcecli/plugin-info/blob/main/src/shared/parseReleaseNotes.ts | ||
const parseChangeLog = (notes, version, currentVersion) => { | ||
let found = false; | ||
let versions = []; | ||
const parsed = marked.lexer(notes); | ||
let tokens = []; | ||
const findVersion = (desiredVersion, localVersion) => { | ||
versions = []; | ||
tokens = parsed.filter((token) => { | ||
if (token.type === 'heading' && token.depth <= 2) { | ||
const coercedVersion = semver.coerce(token.text)?.version; | ||
if (coercedVersion) { | ||
versions.push(coercedVersion); | ||
if ((!localVersion && compare(desiredVersion, coercedVersion) === 0) || | ||
(localVersion && | ||
compare(desiredVersion, coercedVersion) >= 0 && | ||
compare(coercedVersion, localVersion) === 1)) { | ||
found = true; | ||
return token; | ||
} | ||
} | ||
found = false; | ||
} | ||
else if (found === true) { | ||
return token; | ||
} | ||
}); | ||
}; | ||
findVersion(version, currentVersion); | ||
if (!versions.includes(version)) { | ||
const semverRange = `${semver.major(version)}.${semver.minor(version)}.x`; | ||
const closestVersion = semver.maxSatisfying(versions, semverRange); | ||
if (closestVersion !== null) { | ||
findVersion(closestVersion, currentVersion); | ||
if (!tokens.length) | ||
findVersion(closestVersion); | ||
const warning = marked.lexer(`# ATTENTION: Version ${version} was not found. Showing notes for closest patch version ${closestVersion}.`)[0]; | ||
tokens.unshift(warning); | ||
version = closestVersion; | ||
} | ||
} | ||
return { tokens, version }; | ||
}; | ||
import { parseChangeLog } from './shared/parseChangeLog.js'; | ||
export default async function printChangeLog(cacheDir, pluginRootPath, debug) { | ||
@@ -59,0 +15,0 @@ if (!debug) |
{ | ||
"name": "@jayree/changelog", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Parse a CHANGELOG.md file of a package and return the most recent entry", | ||
@@ -9,22 +9,35 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "^17.6.3", | ||
"@salesforce/dev-scripts": "^5.4.2", | ||
"@salesforce/prettier-config": "^0.0.3", | ||
"@types/debug": "^4.1.8", | ||
"@types/fs-extra": "^11.0.1", | ||
"@types/marked": "^4.0.8", | ||
"@types/marked": "^5.0.0", | ||
"@types/marked-terminal": "^3.1.3", | ||
"@types/node": "^20.2.3", | ||
"@types/semver": "^7.3.13", | ||
"@types/semver": "^7.5.0", | ||
"@types/semver-compare": "^1.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.59.7", | ||
"@typescript-eslint/parser": "^5.59.7", | ||
"commitlint": "^17.6.3", | ||
"eslint": "^8.41.0", | ||
"@types/sinon-chai": "^3.2.9", | ||
"@typescript-eslint/eslint-plugin": "^5.59.9", | ||
"@typescript-eslint/parser": "^5.59.9", | ||
"c8": "^7.14.0", | ||
"chai": "^4.3.7", | ||
"commitlint": "^17.6.5", | ||
"eslint": "^8.42.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-config-salesforce": "^2.0.1", | ||
"eslint-config-salesforce-typescript": "^1.1.1", | ||
"eslint-plugin-header": "^3.1.1", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jsdoc": "^46.2.6", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^8.0.3", | ||
"mocha": "^10.2.0", | ||
"patch-package": "^7.0.0", | ||
"prettier": "^2.8.8", | ||
"pretty-quick": "^3.1.3", | ||
"typescript": "^5.0.4", | ||
"sinon": "15.1.0", | ||
"sinon-chai": "^3.7.0", | ||
"ts-node": "^10.9.1", | ||
"typedoc": "0.24.8", | ||
"typedoc-plugin-missing-exports": "2.0.0", | ||
"typescript": "^5.1.3", | ||
"wireit": "^0.9.5" | ||
@@ -35,9 +48,9 @@ }, | ||
"fs-extra": "^11.1.1", | ||
"marked": "^4.3.0", | ||
"marked": "^5.0.5", | ||
"marked-terminal": "^5.2.0", | ||
"semver": "^7.5.0", | ||
"semver": "^7.5.1", | ||
"semver-compare": "^1.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=16.0.0" | ||
}, | ||
@@ -53,5 +66,13 @@ "files": [ | ||
"build": "wireit", | ||
"clean": "sf-clean", | ||
"clean-all": "sf-clean all", | ||
"compile": "wireit", | ||
"docs": "sf-docs", | ||
"format": "wireit", | ||
"lint": "wireit" | ||
"lint": "wireit", | ||
"prepack": "sf-prepack", | ||
"prepare": "patch-package && sf-install", | ||
"test": "wireit", | ||
"test:compile": "wireit", | ||
"test:only": "wireit" | ||
}, | ||
@@ -78,3 +99,4 @@ "publishConfig": { | ||
"src/**/*.ts", | ||
"**/tsconfig.json" | ||
"**/tsconfig.json", | ||
"messages/**" | ||
], | ||
@@ -88,5 +110,8 @@ "output": [ | ||
"format": { | ||
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)\"", | ||
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"", | ||
"files": [ | ||
"src/**/*.ts", | ||
"test/**/*.ts", | ||
"schemas/**/*.json", | ||
"command-snapshot.json", | ||
".prettier*" | ||
@@ -100,2 +125,4 @@ ], | ||
"src/**/*.ts", | ||
"test/**/*.ts", | ||
"messages/**", | ||
"**/.eslint*", | ||
@@ -105,4 +132,33 @@ "**/tsconfig.json" | ||
"output": [] | ||
}, | ||
"test:compile": { | ||
"command": "tsc -p \"./test\" --pretty", | ||
"files": [ | ||
"test/**/*.ts", | ||
"**/tsconfig.json" | ||
], | ||
"output": [] | ||
}, | ||
"test": { | ||
"dependencies": [ | ||
"test:only", | ||
"test:compile" | ||
] | ||
}, | ||
"test:only": { | ||
"command": "c8 mocha \"test/**/*.test.ts\"", | ||
"env": { | ||
"FORCE_COLOR": "2" | ||
}, | ||
"files": [ | ||
"test/**/*.ts", | ||
"src/**/*.ts", | ||
"**/tsconfig.json", | ||
".mocha*", | ||
"!*.nut.ts", | ||
".nycrc" | ||
], | ||
"output": [] | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44726
10
104
34
+ Addedmarked@5.1.2(transitive)
- Removedmarked@4.3.0(transitive)
Updatedmarked@^5.0.5
Updatedsemver@^7.5.1