Skip to content

Commit 00bc8e4

Browse files
authored
Merge pull request #16 from tkskto/feature/add-staged
Feature/add staged
2 parents 71a4514 + 4d9d9bc commit 00bc8e4

File tree

14 files changed

+816
-212
lines changed

14 files changed

+816
-212
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/setup-node@v2
2222
with:
2323
node-version: ${{ matrix.node-version }}
24-
- run: npm install
24+
- run: npm ci
2525
- run: npm run build --if-present
2626
- run: npm run test:ci
2727
env:

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ See the [types](./types/index.d.ts) for details.
4242

4343
#### branches.local: string[]
4444

45+
Get the list of local.
46+
4547
#### branches.remote: Record<string, string[]>
4648

49+
Get the list of branches along with the remote name.
50+
4751
### Commit
4852

4953
#### `Commit.author`: [Pick<Author, 'email' | 'name'>](#Author)
@@ -54,11 +58,15 @@ See the [types](./types/index.d.ts) for details.
5458

5559
#### `Commit.parent`: string[]
5660

61+
Hash of the parent commit. The merge commit has two parents.
62+
5763
#### `Commit.files`: [File](#File)[]
5864

65+
The list of files included in this commit.
66+
5967
### File
6068

61-
#### `File.type`: 'add' | 'modify' | 'delete'
69+
#### `File.type`: 'added' | 'deleted' | 'ignored' | 'modified' | 'renamed' | 'unmodified' | 'untracked'
6270

6371
#### `File.fileName`: string
6472

@@ -186,6 +194,22 @@ Get remote info with `git remote -v` command.
186194

187195
* [Remote](#Remote)
188196

197+
### status()
198+
199+
Get the list of changed file with `git status -s` command.
200+
201+
#### Since
202+
203+
0.5.0
204+
205+
#### Arguments
206+
207+
* nothing
208+
209+
#### Returns
210+
211+
* [File](#File)
212+
189213
### tags()
190214

191215
Get tag info with `git show-ref --tags` command.

__tests__/spec/branches.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {branches} from '../../src';
22

33
const isCI = process.argv[2] === '--ci';
44

5-
describe('branch test', () => {
5+
describe('branches test', () => {
66
test('local', async () => {
77
const branch = await branches(false);
88

__tests__/spec/commits.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ describe('commits test', () => {
6868
files: [
6969
{
7070
fileName: 'LICENSE',
71-
type: 'add',
71+
type: 'added',
7272
},
7373
{
7474
fileName: 'README.md',
75-
type: 'add',
75+
type: 'added',
7676
},
7777
]
7878
});

__tests__/spec/remotes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {remotes} from '../../src';
22

33
const isCI = process.argv[2] === '--ci';
44

5-
describe('authors test', () => {
5+
describe('remotes test', () => {
66
test('default', async () => {
77
const remote = await remotes();
88

__tests__/spec/status.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {status} from '../../src';
2+
3+
const isCI = process.argv[2] === '--ci';
4+
5+
describe('status test', () => {
6+
test('default', async () => {
7+
const state = await status();
8+
9+
if (isCI) {
10+
expect(state).toStrictEqual([]);
11+
} else {
12+
expect(state).toStrictEqual([]);
13+
}
14+
});
15+
});

__tests__/spec/tags.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@ import {tags} from '../../src';
22

33
const isCI = process.argv[2] === '--ci';
44

5-
describe('authors test', () => {
5+
describe('tags test', () => {
66
test('default', async () => {
77
const tag = await tags();
88

99
if (isCI) {
1010
expect(tag).toStrictEqual([]);
1111
} else {
12-
expect(tag).toStrictEqual([
13-
{ hash: '24c2a9e90836d3eb13693099568408dca476b5cc', name: 'v0.1.0' },
14-
{ hash: 'ca0c3b48f237d820b0cc9ef87bbed16de2a1cf5f', name: 'v0.1.1' },
15-
{ hash: '41348ee32aadb9405f1555cbdae2ac3fdb8595b8', name: 'v0.2.0' },
16-
{ hash: '81c1d84d22d4d0b3ace5c1652d8ba37b8bcb2844', name: 'v0.3.0' },
17-
{ hash: 'fa5acd4263a4a527557414764f4f823464a8f509', name: 'v0.3.1' }
18-
]);
12+
expect(tag).toContainEqual({ hash: '24c2a9e90836d3eb13693099568408dca476b5cc', name: 'v0.1.0' });
13+
expect(tag).toContainEqual({ hash: 'ca0c3b48f237d820b0cc9ef87bbed16de2a1cf5f', name: 'v0.1.1' });
14+
expect(tag).toContainEqual({ hash: '41348ee32aadb9405f1555cbdae2ac3fdb8595b8', name: 'v0.2.0' });
15+
expect(tag).toContainEqual({ hash: '81c1d84d22d4d0b3ace5c1652d8ba37b8bcb2844', name: 'v0.3.0' });
16+
expect(tag).toContainEqual({ hash: 'fa5acd4263a4a527557414764f4f823464a8f509', name: 'v0.3.1' });
1917
}
2018
});
2119
});

0 commit comments

Comments
 (0)