conventional-changelog-core
Advanced tools
Comparing version
@@ -12,2 +12,4 @@ 'use strict' | ||
function conventionalChangelog (options, context, gitRawCommitsOpts, parserOpts, writerOpts, gitRawExecOpts) { | ||
const cwd = options?.cwd | ||
writerOpts = writerOpts || {} | ||
@@ -30,5 +32,5 @@ | ||
...gitRawCommitsOpts, | ||
from: from, | ||
to: to | ||
}) | ||
from, | ||
to | ||
}, { cwd }) | ||
.on('error', function (err) { | ||
@@ -53,2 +55,3 @@ if (!commitsErrorThrown) { | ||
execFileSync('git', ['rev-parse', '--verify', 'HEAD'], { | ||
cwd, | ||
stdio: 'ignore' | ||
@@ -55,0 +58,0 @@ }) |
'use strict' | ||
const { promisify } = require('util') | ||
const dateFormat = require('dateformat') | ||
const getPkgRepo = require('get-pkg-repo') | ||
const fs = require('fs/promises') | ||
const hostedGitInfo = require('hosted-git-info') | ||
const parseRepositoryUrl = require('@hutson/parse-repository-url') | ||
const gitSemverTags = require('git-semver-tags') | ||
@@ -13,7 +13,9 @@ const normalizePackageData = require('normalize-package-data') | ||
} | ||
const readPkg = require('read-pkg') | ||
const readPkgUp = require('read-pkg-up') | ||
const { URL } = require('url') | ||
const rhosts = /github|bitbucket|gitlab/i | ||
// sv-SEis used for yyyy-mm-dd format | ||
const dateFormatter = Intl.DateTimeFormat('sv-SE', { | ||
timeZone: 'UTC' | ||
}) | ||
@@ -26,3 +28,4 @@ function semverTagsPromise (options) { | ||
tagPrefix: options.tagPrefix, | ||
skipUnstable: options.skipUnstable | ||
skipUnstable: options.skipUnstable, | ||
cwd: options.cwd | ||
}, (err, result) => { | ||
@@ -75,3 +78,2 @@ if (err) { | ||
async function mergeConfig (options, context, gitRawCommitsOpts, parserOpts, writerOpts, gitRawExecOpts) { | ||
let configPromise | ||
let pkgPromise | ||
@@ -82,3 +84,6 @@ | ||
gitRawCommitsOpts = gitRawCommitsOpts || {} | ||
gitRawExecOpts = gitRawExecOpts || {} | ||
gitRawExecOpts = { | ||
cwd: options?.cwd, | ||
...gitRawExecOpts || {} | ||
} | ||
@@ -103,3 +108,3 @@ const rtag = options && options.tagPrefix ? new RegExp(`tag:\\s*[=]?${options.tagPrefix}(.+?)[,)]`, 'gi') : /tag:\s*[v=]?(.+?)[,)]/gi | ||
if (commit.committerDate) { | ||
commit.committerDate = dateFormat(commit.committerDate, 'yyyy-mm-dd', true) | ||
commit.committerDate = dateFormatter.format(new Date(commit.committerDate)) | ||
} | ||
@@ -121,19 +126,20 @@ | ||
if (options.config) { | ||
if (typeof options.config === 'function') { | ||
configPromise = promisify(options.config)() | ||
} else { | ||
configPromise = Promise.resolve(options.config) | ||
} | ||
} | ||
if (options.pkg) { | ||
if (options.pkg.path) { | ||
pkgPromise = Promise.resolve(readPkg(options.pkg.path)) | ||
pkgPromise = import('read-pkg').then(async ({ parsePackage }) => { | ||
const json = await fs.readFile(options.pkg.path, 'utf-8') | ||
return parsePackage(json) | ||
}) | ||
} else { | ||
pkgPromise = Promise.resolve(readPkgUp()) | ||
pkgPromise = import('read-pkg-up').then(async ({ readPackageUp }) => { | ||
const { packageJson } = await readPackageUp({ cwd: options.cwd }) | ||
return packageJson | ||
}) | ||
} | ||
} | ||
const gitRemoteOriginUrlPromise = Promise.resolve(gitRemoteOriginUrl()) | ||
const presetConfig = typeof options.config === 'function' ? options.config() : options.config | ||
const gitRemoteOriginUrlPromise = Promise.resolve(gitRemoteOriginUrl(options.cwd)) | ||
const [ | ||
@@ -145,3 +151,3 @@ configObj, | ||
] = await Promise.allSettled([ | ||
configPromise, | ||
presetConfig, | ||
pkgPromise, | ||
@@ -160,7 +166,7 @@ semverTagsPromise(options), | ||
if (configPromise) { | ||
if (options.config) { | ||
if (configObj.status === 'fulfilled') { | ||
config = configObj.value | ||
} else { | ||
options.warn('Error in config' + configObj.reason.toString()) | ||
options.warn(configObj.reason.toString()) | ||
config = {} | ||
@@ -179,8 +185,3 @@ } | ||
if (pkgObj.status === 'fulfilled') { | ||
if (options.pkg.path) { | ||
pkg = pkgObj.value | ||
} else { | ||
pkg = pkgObj.value.pkg || {} | ||
} | ||
pkg = pkgObj.value || {} | ||
pkg = options.pkg.transform(pkg) | ||
@@ -203,3 +204,7 @@ } else if (options.pkg.path) { | ||
try { | ||
repo = getPkgRepo(pkg) | ||
const repositoryURL = typeof pkg.repository === 'string' ? pkg.repository : pkg.repository.url | ||
if (repositoryURL) { | ||
// Remove parseRepositoryUrl when https://github.com/npm/hosted-git-info/issues/39 is fixed | ||
repo = hostedGitInfo.fromUrl(repositoryURL) || parseRepositoryUrl(repositoryURL) | ||
} | ||
} catch (err) { | ||
@@ -375,8 +380,8 @@ repo = {} | ||
return { | ||
options: options, | ||
context: context, | ||
gitRawCommitsOpts: gitRawCommitsOpts, | ||
parserOpts: parserOpts, | ||
writerOpts: writerOpts, | ||
gitRawExecOpts: gitRawExecOpts | ||
options, | ||
context, | ||
gitRawCommitsOpts, | ||
parserOpts, | ||
writerOpts, | ||
gitRawExecOpts | ||
} | ||
@@ -383,0 +388,0 @@ } |
{ | ||
"name": "conventional-changelog-core", | ||
"version": "5.0.2", | ||
"version": "6.0.0", | ||
"description": "conventional-changelog core", | ||
@@ -16,3 +16,3 @@ "repository": { | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=16" | ||
}, | ||
@@ -30,20 +30,17 @@ "license": "MIT", | ||
"dependencies": { | ||
"@hutson/parse-repository-url": "^5.0.0", | ||
"add-stream": "^1.0.0", | ||
"conventional-changelog-writer": "^6.0.0", | ||
"conventional-commits-parser": "^4.0.0", | ||
"dateformat": "^3.0.3", | ||
"get-pkg-repo": "^4.2.1", | ||
"git-raw-commits": "^3.0.0", | ||
"git-remote-origin-url": "^2.0.0", | ||
"git-semver-tags": "^5.0.0", | ||
"normalize-package-data": "^3.0.3", | ||
"read-pkg": "^3.0.0", | ||
"read-pkg-up": "^3.0.0" | ||
"hosted-git-info": "^7.0.0", | ||
"normalize-package-data": "^6.0.0", | ||
"read-pkg": "^8.0.0", | ||
"read-pkg-up": "^10.0.0", | ||
"conventional-changelog-writer": "^7.0.0", | ||
"conventional-commits-parser": "^5.0.0", | ||
"git-raw-commits": "^4.0.0", | ||
"git-semver-tags": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"conventional-changelog-angular": "^6.0.0" | ||
}, | ||
"scripts": { | ||
"test-windows": "mocha --timeout 30000" | ||
"conventional-changelog-angular": "^7.0.0" | ||
} | ||
} |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
26447
1.47%517
1.37%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated