Skip to content

Commit 4e000f6

Browse files
committed
fix: Documentation update
- Absolute URLs for links in `.md` files - Update import syntax, add test for named import style commons js
1 parent c97c08c commit 4e000f6

File tree

7 files changed

+96
-63
lines changed

7 files changed

+96
-63
lines changed

examples/git-grep.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Git Grep
22

3-
The official documentation for [git grep](https://git-scm.com/docs/git-grep) gives the full set of options that can be passed to the `simple-git` `git.grep` method as [options](../readme.md#how-to-specify-options) (note that `-h` to hide the file name is disallowed).
3+
The official documentation for [git grep](https://git-scm.com/docs/git-grep) gives the full set of options that can be passed to the `simple-git` `git.grep` method as [options](https://github.com/steveukx/git-js/blob/main/readme.md#how-to-specify-options) (note that `-h` to hide the file name is disallowed).
44

55
The simplest version is to search with a single search token:
66

@@ -28,7 +28,7 @@ console.log(Array.from(grepQueryBuilder('aaa').and('bbb', 'ccc')))
2828
// [ '-e', 'aaa', '--and', '(', '-e', 'bbb', '-e', 'ccc', ')' ]
2929
```
3030

31-
To build your own query instead of using the `grepQueryBuilder`, use the array form of [options](../readme.md#how-to-specify-options):
31+
To build your own query instead of using the `grepQueryBuilder`, use the array form of [options](https://github.com/steveukx/git-js/blob/main/readme.md#how-to-specify-options):
3232

3333
```typescript
3434
import simpleGit from 'simple-git';

packages/test-es-module-consumer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"test": "node test.mjs"
88
},
99
"dependencies": {
10-
"simple-git": "^2.48.0"
10+
"simple-git": "^3.0.0"
1111
}
1212
}

packages/test-javascript-consumer/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"private": true,
44
"version": "1.0.0",
55
"scripts": {
6-
"test": "node test.js"
6+
"test": "node test.js && node test-default.js"
77
},
88
"dependencies": {
9-
"simple-git": "^2.48.0"
9+
"simple-git": "^3.0.0"
1010
}
1111
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const {default: simpleGit, ResetMode} = require('simple-git');
2+
const {strictEqual} = require("assert");
3+
4+
exec('requires default', async () => {
5+
strictEqual(
6+
await simpleGit().checkIsRepo(),
7+
true,
8+
'expected the current directory to be a valid git root',
9+
);
10+
});
11+
12+
exec('imports named exports', async () => {
13+
strictEqual(
14+
/hard/.test(ResetMode.HARD),
15+
true,
16+
'expected valid ResetMode enum'
17+
);
18+
});
19+
20+
function exec (name, runner) {
21+
runner()
22+
.then(() => console.log(`${ name }: OK`))
23+
.catch((e) => {
24+
console.error(`${ name }: ${ e.message }`);
25+
throw e;
26+
});
27+
}

packages/test-typescript-consumer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
},
1818
"dependencies": {
1919
"@simple-git/babel-config": "^1.0.0",
20-
"simple-git": "^2.48.0"
20+
"simple-git": "^3.0.0"
2121
}
2222
}

readme.md

+52-46
Large diffs are not rendered by default.

simple-git/CHANGELOG.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280

281281
## 2.25.0 TypeScript Types & Unit Tests, Commit Parsing
282282

283-
- See [Legacy Node Versions](./docs/LEGACY_NODE_VERSIONS.md) for details of how to use `simple-git` with `node.js`
283+
- See [Legacy Node Versions](https://github.com/steveukx/git-js/blob/main/docs/LEGACY_NODE_VERSIONS.md) for details of how to use `simple-git` with `node.js`
284284
versions 11 and below.
285285
- To help keep the TypeScript definitions in line with functionality, unit tests are now written in TypeScript.
286286
- When using `git.commit`, the first argument must be a string or array of strings. Passing another data type has long
@@ -356,7 +356,7 @@
356356
## 2.13.0 - Upgraded Pull & Merge and parser for Push
357357

358358
- `.push` and `.pushTags` rewritten as v2 style tasks. The git response is now parsed and returned as a
359-
[PushResult](./typings/response.d.ts)
359+
[PushResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts)
360360

361361
- Pull and merge rewritten to fit the TypeScript tasks style.
362362

@@ -371,12 +371,12 @@
371371
- until now, `simple-git` reject all pending tasks in the queue when a task has failed. From `2.11.0`, only
372372
tasks chained from the failing one will be rejected, other tasks can continue to be processed as normal,
373373
giving the developer more control over which tasks should be treated as atomic chains, and which can be
374-
[run in parallel](./readme.md#concurrent--parallel-requests).
374+
[run in parallel](https://github.com/steveukx/git-js/blob/main/readme.md#concurrent--parallel-requests).
375375

376376
To support this, and to prevent the issues seen when `git` is run concurrently in too many child processes,
377377
`simple-git` will limit the number of tasks running in parallel at any one time to be at most 1 from each
378378
chain (ie: chained tasks are still run in series) and at most 5 tasks across all chains (
379-
[configurable](./readme.md#configuration) by passing `{maxConcurrentProcesses: x}` in the `simpleGit` constructor).
379+
[configurable](https://github.com/steveukx/git-js/blob/main/readme.md#configuration) by passing `{maxConcurrentProcesses: x}` in the `simpleGit` constructor).
380380

381381
- add support to `git.status()` for parsing the response of a repo that has no commits yet, previously
382382
it wouldn't determine the branch name correctly.
@@ -395,7 +395,7 @@ await simpleGit().checkout({'branch-name': null});
395395
```
396396

397397
- `git.init` now supports both object and array forms of supplying trailing options and now
398-
parses the response to return an [InitResult](./typings/response.d.ts);
398+
parses the response to return an [InitResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts);
399399

400400
```typescript
401401
import simpleGit, { InitResult } from 'simple-git';
@@ -476,21 +476,21 @@ expect(simpleGit().init().then).toBe(expect.any(Function));
476476
- The main export from `simple-git` no longer shows the deprecation notice for using the
477477
`.then` function, it now exposes the promise chain generated from the most recently run
478478
task, allowing the combination of chain building and ad-hoc splitting off to a new promise chain.
479-
- See the [unit](./test/unit/promises.spec.js) and [integration](./test/integration/promise-from-root.spec.js) tests.
480-
- See the [typescript consumer](./test/consumer/ts-default-from-root.spec.ts) test.
479+
- See the [unit](https://github.com/steveukx/git-js/blob/main/simple-git/test/unit/promises.spec.js) and [integration](https://github.com/steveukx/git-js/blob/main/simple-git/test/integration/promise-from-root.spec.js) tests.
480+
- See the [typescript consumer](https://github.com/steveukx/git-js/blob/main/simple-git/test/consumer/ts-default-from-root.spec.ts) test.
481481

482482
### TypeScript Importing
483483

484484
- Promise / async interface and TypeScript types all available from the `simple-git` import rather than needing
485-
`simple-git/promise`, see examples in the [ReadMe](./readme.md) or in the [consumer tests](./test/consumer).
485+
`simple-git/promise`, see examples in the [ReadMe](https://github.com/steveukx/git-js/blob/main/readme.md) or in the [consumer tests](https://github.com/steveukx/git-js/blob/main/simple-git/test/consumer).
486486

487487
### Typed Errors
488488

489489
- Tasks that previously validated their usage and rejected with a `TypeError` will now reject with a
490-
[`TaskConfigurationError`](./src/lib/errors/task-configuration-error.ts).
490+
[`TaskConfigurationError`](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/errors/task-configuration-error.ts).
491491

492492
- Tasks that previously rejected with a custom object (currently only `git.merge` when the auto-merge fails)
493-
will now reject with a [`GitResponseError`](./src/lib/errors/git-response-error.ts) where previously it
493+
will now reject with a [`GitResponseError`](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/errors/git-response-error.ts) where previously it
494494
was a modified `Error`.
495495

496496
### Git Clean
@@ -537,4 +537,4 @@ please only use the documented public API.
537537

538538
## v1 and below
539539

540-
Please see the [historical changelog](./docs/CHANGELOG-HISTORICAL.md);
540+
Please see the [historical changelog](https://github.com/steveukx/git-js/blob/main/docs/CHANGELOG-HISTORICAL.md);

0 commit comments

Comments
 (0)