Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AvrAlexandra committed Oct 24, 2024
1 parent f3d1b07 commit 6eded5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/commands/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function processCommitForPlugins(commit: any, folder: string, selectedPlug
.filter((file) => (plugin.extractor.filter ? plugin.extractor.filter(file) : true))
.filter((file) => plugin.extractor.files.some((pattern) => minimatch(file, pattern, { matchBase: true })));

if (filteredFiles.includes('package.json') || filteredFiles.includes('package-lock.json') || filteredFiles.includes('manifest.json')) {
if (filteredFiles.includes('package.json') || filteredFiles.includes('package-lock.json')) {
if (!filteredFiles.includes('package.json')) {
filteredFiles.push('package.json');
}
Expand Down
17 changes: 10 additions & 7 deletions src/plugins/javascript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ import fs from 'fs'
import {log} from '../../utils/logging'

const extractor: Extractor = {
files: ['package.json', 'package-lock.json', 'yarn.lock'],
createContexts: files => {
const lockFileContexts = files.filter(it => it.endsWith('package-lock.json') || it.endsWith('yarn.lock')).map(it => ({
root: path.dirname(it),
lockFile: path.basename(it),
manifestFile: files.find(manifest => path.dirname(manifest) === path.dirname(it) && manifest.endsWith('package.json')),
} as DependencyFileContext))
files: ['package.json', 'package-lock.json', 'yarn.lock'],
createContexts: files => {
const lockFileContexts = files.filter(it => it.endsWith('package-lock.json') || it.endsWith('yarn.lock')).map(it => {
const manifest = files.find(manifest => path.dirname(manifest) === path.dirname(it) && manifest.endsWith('package.json'));
return {
root: path.dirname(it),
lockFile: path.basename(it),
manifestFile: manifest ? path.basename(manifest) : 'package.json', // Use the basename if found, else default to 'package.json'
} as DependencyFileContext;
});

const packageJsonWithLockInParent = files.filter(it => it.endsWith('package.json'))
.filter(packageFile => !lockFileContexts.some(it => it.root == path.dirname(packageFile)))
Expand Down

0 comments on commit 6eded5e

Please sign in to comment.