Skip to content

Commit

Permalink
fix(vulnerability): issue with xml2js #25
Browse files Browse the repository at this point in the history
  • Loading branch information
kucherenko committed Apr 27, 2023
1 parent 521eead commit b0fb0e1
Show file tree
Hide file tree
Showing 6 changed files with 1,131 additions and 1,029 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blamer",
"version": "1.0.1",
"version": "1.0.2",
"description": "blamer is a tool for getting information about author of code from version control system",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
Expand Down Expand Up @@ -51,8 +51,7 @@
},
"dependencies": {
"execa": "^4.0.0",
"which": "^2.0.2",
"xml2js": "^0.5.0"
"which": "^2.0.2"
},
"devDependencies": {
"@bitjson/npm-scripts-info": "^1.0.0",
Expand Down
8 changes: 1 addition & 7 deletions src/blamer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ const mockedResult: BlameResult = {
};
stub.returns(mockedResult);
const { Blamer } = proxyquire('./blamer', {
'./vcs/git': { git: stub },
'./vcs/svn': { svn: stub }
'./vcs/git': { git: stub }
});

test('should show authors of code in file under git', async (t: ExecutionContext) => {
const blamer = new Blamer();
t.deepEqual(await blamer.blameByFile(path), mockedResult);
});

test('should show authors of code in file under svn', async (t: ExecutionContext) => {
const blamer = new Blamer('svn');
t.deepEqual(await blamer.blameByFile(path), mockedResult);
});
12 changes: 0 additions & 12 deletions src/blamer.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
import { BlameResult } from './blame-result.interface';
import { git } from './vcs/git';
import { svn } from './vcs/svn';

type VCSType = 'git' | 'svn';

export class Blamer {
private readonly type: VCSType = 'git';

constructor(type: VCSType = 'git') {
this.type = type;
}

public async blameByFile(path: string): Promise<BlameResult> {
return this.getVCSBlamer()(path);
}

private getVCSBlamer(): (path: string) => {} {
if (this.type === 'svn') {
return svn;
}
return git;
}
}
42 changes: 0 additions & 42 deletions src/vcs/svn.spec.ts

This file was deleted.

28 changes: 0 additions & 28 deletions src/vcs/svn.ts

This file was deleted.

Loading

0 comments on commit b0fb0e1

Please sign in to comment.