@apexdevtools/git-ops 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # git-ops - Changelog
2
2
 
3
+ ## 1.1.1 - 2023-03-27
4
+
5
+ - Update minimum version to 2.20.0
6
+
3
7
  ## 1.1.0 - 2023-03-21
4
8
 
5
9
  - add new method `getDiffRange`
package/README.md CHANGED
@@ -4,7 +4,7 @@ Library to do git operations to find changed files in a given git repository.
4
4
 
5
5
  ## Prerequisite
6
6
 
7
- Minimum `git` version of `2.30.0` must already be installed on the host machine.
7
+ Minimum `git` version of `2.20.0` must already be installed on the host machine.
8
8
 
9
9
  ## Getting Started
10
10
 
@@ -38,6 +38,9 @@ class Git {
38
38
  const isSupported = version.major >= this.MIN_GIT_VERSION_MAJOR &&
39
39
  version.minor >= this.MIN_GIT_VERSION_MINOR &&
40
40
  version.patch >= this.MIN_GIT_VERSION_PATCH;
41
+ if (!version.installed) {
42
+ throw new Error('"git" is not installed or available on the PATH');
43
+ }
41
44
  if (!isSupported)
42
45
  throw new Error(`Unsupported version of git. Min version must be ${this.MIN_GIT_VERSION_MAJOR}.${this.MIN_GIT_VERSION_MINOR}.${this.MIN_GIT_VERSION_PATCH}`);
43
46
  });
@@ -105,5 +108,5 @@ class Git {
105
108
  }
106
109
  exports.Git = Git;
107
110
  Git.MIN_GIT_VERSION_MAJOR = 2;
108
- Git.MIN_GIT_VERSION_MINOR = 30;
111
+ Git.MIN_GIT_VERSION_MINOR = 20;
109
112
  Git.MIN_GIT_VERSION_PATCH = 0;
@@ -28,37 +28,62 @@ describe('Git', () => {
28
28
  yield repoManager.tearDown();
29
29
  }));
30
30
  describe('version check', () => {
31
- it('does not fail when Git version is equal to 2.30.0', () => {
31
+ it('does not fail when Git version is equal to 2.20.0', () => {
32
32
  //Given/When
33
33
  const mock = {
34
- version: jest.fn().mockReturnValue({ major: 2, minor: 30, patch: 0 }),
34
+ version: jest.fn().mockReturnValue({
35
+ installed: true,
36
+ major: 2,
37
+ minor: 20,
38
+ patch: 0,
39
+ }),
35
40
  };
36
41
  expect(Git_1.Git.versionCheck(mock)).resolves;
37
42
  });
38
- it('fails when Git major version is lower', () => __awaiter(void 0, void 0, void 0, function* () {
43
+ it('does not fail when Git version is higher', () => {
44
+ //Given/When
45
+ const mock = {
46
+ version: jest.fn().mockReturnValue({
47
+ installed: true,
48
+ major: 2,
49
+ minor: 30,
50
+ patch: 2,
51
+ }),
52
+ };
53
+ //Then
54
+ expect(Git_1.Git.versionCheck(mock)).resolves;
55
+ });
56
+ it('fails when Git is not installed', () => __awaiter(void 0, void 0, void 0, function* () {
39
57
  //Given/When
40
58
  const mock = {
41
- version: jest.fn().mockReturnValue({ major: 1 }),
59
+ version: jest.fn().mockReturnValue({ installed: false }),
42
60
  };
43
61
  //Then
44
- yield expect(Git_1.Git.versionCheck(mock)).rejects.toThrow(Error('Unsupported version of git. Min version must be 2.30.0'));
62
+ yield expect(Git_1.Git.versionCheck(mock)).rejects.toThrow(Error('"git" is not installed or available on the PATH'));
45
63
  }));
46
- it('fails when Git minor version is lower', () => __awaiter(void 0, void 0, void 0, function* () {
64
+ it('fails when Git major version is lower', () => __awaiter(void 0, void 0, void 0, function* () {
47
65
  //Given/When
48
66
  const mock = {
49
- version: jest.fn().mockReturnValue({ major: 3, minor: 36 }),
67
+ version: jest.fn().mockReturnValue({
68
+ installed: true,
69
+ major: 1,
70
+ }),
50
71
  };
51
72
  //Then
52
- yield expect(Git_1.Git.versionCheck(mock)).rejects.toThrow(Error('Unsupported version of git. Min version must be 2.30.0'));
73
+ yield expect(Git_1.Git.versionCheck(mock)).rejects.toThrow(Error('Unsupported version of git. Min version must be 2.20.0'));
53
74
  }));
54
- it('fails when Git patch version is more than 0', () => {
75
+ it('fails when Git minor version is lower', () => __awaiter(void 0, void 0, void 0, function* () {
55
76
  //Given/When
56
77
  const mock = {
57
- version: jest.fn().mockReturnValue({ major: 3, minor: 38, patch: 1 }),
78
+ version: jest.fn().mockReturnValue({
79
+ installed: true,
80
+ major: 2,
81
+ minor: 19,
82
+ }),
58
83
  };
59
84
  //Then
60
- expect(Git_1.Git.versionCheck(mock)).resolves;
61
- });
85
+ yield expect(Git_1.Git.versionCheck(mock)).rejects.toThrow(Error('Unsupported version of git. Min version must be 2.20.0'));
86
+ }));
62
87
  });
63
88
  describe('rev parse', () => {
64
89
  it('get git root', () => __awaiter(void 0, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexdevtools/git-ops",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Library to do git operations to find changed files in a given git repository",
5
5
  "author": {
6
6
  "name": "Apex Dev Tools Team",
@@ -50,7 +50,6 @@
50
50
  "typescript": "^4.9.5"
51
51
  },
52
52
  "dependencies": {
53
- "install": "^0.13.0",
54
53
  "simple-git": "^3.16.0"
55
54
  },
56
55
  "config": {