Skip to content

Commit

Permalink
feat: support filtering files
Browse files Browse the repository at this point in the history
  • Loading branch information
jzhangdev committed May 30, 2024
1 parent 2067140 commit 2333674
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feat: support filtering files",
"packageName": "@rightcapital/verdaccio-package-diff",
"email": "[email protected]",
"dependentChangeType": "patch"
}
3 changes: 2 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
const name = params.get('name');
const from = params.get('from');
const to = params.get('to');
const filter = params.get('filter');

if (name && from && to) {
fetch(`/-/npm/package-diff/data?name=${name}&from=${from}&to=${to}`, {
fetch(`/-/npm/package-diff/data?name=${name}&from=${from}&to=${to}&filter=${filter}`, {
headers: {
Authorization: typeof token === 'string' && `Bearer ${token}`,
},
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class VerdaccioMiddlewarePlugin
const router = Router();

router.get('/data', (req: Request, res: Response, next: NextFunction) => {
const { name, from, to } = req.query;
const { name, from, to, filter = '.' } = req.query;
const authorizationToken = req.get('Authorization');

if (!name || !from || !to) {
Expand Down Expand Up @@ -110,6 +110,7 @@ export default class VerdaccioMiddlewarePlugin
'npm',
[
'diff',
filter as string,
`--diff=${name as string}@${from as string}`,
`--diff=${name as string}@${to as string}`,
],
Expand Down

0 comments on commit 2333674

Please sign in to comment.