Skip to content

Commit 88540b6

Browse files
authored
docs: add usage on documentation (#48)
* wip * wip * wip * docs * ignore index * function expression
1 parent a177252 commit 88540b6

28 files changed

+818
-65
lines changed

README-ko_kr.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# es-git · [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/toss/es-git/blob/main/LICENSE) [![NPM badge](https://img.shields.io/npm/v/es-git?logo=npm)](https://www.npmjs.com/package/es-git)
2+
3+
[English](https://github.com/toss/es-git/blob/main/README.md) | 한국어
4+
5+
es-git은 Node.js를 위한 현대적인 git 라이브러리예요. 간편하고 직관적인 인터페이스 덕분에 복잡한 git 작업도 쉽게 통합할 수 있으며, TypeScript 타입을 내장해 빠르고 안정적인 개발을
6+
지원해요.
7+
8+
es-git은 libgit2를 바인딩한 [git2-rs](https://github.com/rust-lang/git2-rs)[napi-rs](https://napi.rs/)를 사용해 네이티브 모듈로 빌드하여,
9+
운영체제와 상관없이 고성능 git 기능을 제공해요.
10+
11+
또한, node-gyp를 사용하지 않고 운영체제 및 cpu 아키텍처에 맞는 사전 빌드된 네이티브 모듈을 제공하기 때문에 사용자 환경에서 빌드하지 않고 간편하게
12+
모듈을 설치할 수 있어요.
13+
14+
## 예제
15+
16+
```ts
17+
import { cloneRepository } from 'es-git';
18+
19+
const repo = await cloneRepository('https://github.com/toss/es-git', '/path/to/clone');
20+
const head = repo.head().name();
21+
console.log(head); // "refs/heads/main"
22+
```
23+
24+
## 문서
25+
26+
- [사용법](https://es-git.slash.page/ko/usage/open)
27+
- [API](https://es-git.slash.page/ko/api/globals)
28+
29+
## 라이센스
30+
31+
MIT © Viva Republica, Inc. 자세한 내용은 [LICENSE](./LICENSE)를 참고하세요.
32+
33+
<a title="Toss" href="https://toss.im">
34+
<picture>
35+
<source media="(prefers-color-scheme: dark)" srcset="https://static.toss.im/logos/png/4x/logo-toss-reverse.png">
36+
<img alt="Toss" src="https://static.toss.im/logos/png/4x/logo-toss.png" width="100">
37+
</picture>
38+
</a>

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
# es-git
1+
# es-git &middot; [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/toss/es-git/blob/main/LICENSE) [![NPM badge](https://img.shields.io/npm/v/es-git?logo=npm)](https://www.npmjs.com/package/es-git)
2+
3+
English | [한국어](https://github.com/toss/es-git/blob/main/README-ko_kr.md)
4+
5+
es-git is a modern git library built for Node.js. With its simple and intuitive interface, even complex git operations
6+
can be easily integrated, and the built-in TypeScript types ensure fast and reliable development.
7+
8+
es-git builds high-performance git functionality across different operating systems by using [napi-rs](https://napi.rs/)
9+
to compile a native module from [git2-rs](https://github.com/rust-lang/git2-rs), which binds to libgit2.
10+
11+
Furthermore, by offering pre-built native modules tailored to your OS and CPU architecture without relying
12+
on node-gyp, the module can be installed effortlessly without the need to build it locally.
13+
14+
## Examples
15+
16+
```ts
17+
import { cloneRepository } from 'es-git';
18+
19+
const repo = await cloneRepository('https://github.com/toss/es-git', '/path/to/clone');
20+
const head = repo.head().name();
21+
console.log(head); // "refs/heads/main"
22+
```
23+
24+
## Documentation
25+
26+
- [사용법](https://es-git.slash.page/usage/open)
27+
- [API](https://es-git.slash.page/api/globals)
228

329
## License
430

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export default defineConfig({
99
root: { label: 'English', ...en },
1010
ko: { label: '한국어', ...ko },
1111
},
12-
ignoreDeadLinks: ['./index', './classes/index'],
12+
ignoreDeadLinks: [/\/index/],
1313
});

docs/.vitepress/en.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const docsRoot = path.resolve(import.meta.dirname, '..');
66

77
export const en = defineConfig({
88
lang: 'en',
9-
description: 'TODO',
9+
description: 'Modern git library built for Node.js',
1010
themeConfig: {
1111
nav: nav(),
1212
sidebar: sidebar(),
@@ -24,7 +24,8 @@ export const en = defineConfig({
2424
function nav(): DefaultTheme.NavItem[] {
2525
return [
2626
{ text: 'Home', link: '/' },
27-
{ text: 'Introduction', link: '/intro' },
27+
{ text: 'About', link: '/about' },
28+
{ text: 'Usage', link: '/usage/open' },
2829
];
2930
}
3031

@@ -33,13 +34,25 @@ function sidebar(): DefaultTheme.Sidebar {
3334
{
3435
text: 'Guide',
3536
items: [
36-
{ text: 'Introduction', link: '/intro' },
37-
{ text: 'Installation & Usage', link: '/usage' },
37+
{ text: 'About', link: '/about' },
38+
{ text: 'Installation', link: '/install' },
39+
],
40+
},
41+
{
42+
text: 'Usage',
43+
items: [
44+
{ text: 'Opening a Repository', link: '/usage/open' },
45+
{ text: 'Cloning a Repository', link: '/usage/clone' },
46+
{ text: 'Remotes', link: '/usage/remote' },
47+
{ text: 'Commit History', link: '/usage/history' },
48+
{ text: 'Commit Changes', link: '/usage/commit' },
49+
{ text: 'Tags', link: '/usage/tag' },
3850
],
3951
},
4052
{
4153
text: 'API',
4254
collapsed: true,
55+
link: '/api/globals',
4356
items: getAPISidebarItems(docsRoot),
4457
},
4558
];

docs/.vitepress/ko.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const docsRoot = path.resolve(import.meta.dirname, '..');
66

77
export const ko = defineConfig({
88
lang: 'ko',
9-
description: 'TODO',
9+
description: 'Node.js를 위한 현대적인 git 라이브러리',
1010
themeConfig: {
1111
nav: nav(),
1212
sidebar: sidebar(),
@@ -24,7 +24,8 @@ export const ko = defineConfig({
2424
function nav(): DefaultTheme.NavItem[] {
2525
return [
2626
{ text: '홈', link: '/ko' },
27-
{ text: '소개', link: '/ko/intro' },
27+
{ text: '소개', link: '/ko/about' },
28+
{ text: '사용법', link: '/ko/usage/open' },
2829
];
2930
}
3031

@@ -33,13 +34,25 @@ function sidebar(): DefaultTheme.Sidebar {
3334
{
3435
text: '가이드',
3536
items: [
36-
{ text: '소개', link: '/ko/intro' },
37-
{ text: '설치 및 사용 방법', link: '/ko/usage' },
37+
{ text: '소개', link: '/ko/about' },
38+
{ text: '설치하기', link: '/ko/install' },
39+
],
40+
},
41+
{
42+
text: '사용법',
43+
items: [
44+
{ text: '리포지토리 열기', link: '/ko/usage/open' },
45+
{ text: '리포지토리 복제하기', link: '/ko/usage/clone' },
46+
{ text: '리모트', link: '/ko/usage/remote' },
47+
{ text: '커밋 히스토리', link: '/ko/usage/history' },
48+
{ text: '커밋하기', link: '/ko/usage/commit' },
49+
{ text: '태그', link: '/ko/usage/tag' },
3850
],
3951
},
4052
{
4153
text: 'API',
4254
collapsed: true,
55+
link: '/ko/api/globals',
4356
items: getAPISidebarItems(docsRoot, 'ko'),
4457
},
4558
];

docs/.vitepress/lib/sidebar.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
3-
import glob from 'fast-glob';
43
import type { DefaultTheme } from 'vitepress';
54

6-
export function getSidebarItems(docsRoot: string, ...parts: string[]): DefaultTheme.SidebarItem[] {
7-
const files = glob.sync(path.join(docsRoot, ...parts, '*'));
8-
const paths = files.map(x => `/${path.relative(docsRoot, x)}`);
9-
10-
return paths.map(p => {
11-
const filename = path.basename(p).replace(/\.md$/g, '');
12-
13-
return {
14-
text: filename,
15-
link: p.replace(/\.md$/g, ''),
16-
};
17-
});
18-
}
19-
205
export function getAPISidebarItems(docsRoot: string, lang?: string) {
216
const jsonFilepath =
227
lang != null

docs/about.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# About es-git
2+
3+
es-git is a modern git library built for Node.js. With its simple and intuitive interface, even complex git operations
4+
can be easily integrated, and the built-in TypeScript types ensure fast and reliable development.
5+
6+
es-git builds high-performance git functionality across different operating systems by using [napi-rs](https://napi.rs/)
7+
to compile a native module from [git2-rs](https://github.com/rust-lang/git2-rs), which binds to libgit2.
8+
9+
Furthermore, by offering pre-built native modules tailored to your OS and CPU architecture without relying
10+
on node-gyp, the module can be installed effortlessly without the need to build it locally.
11+
12+
## Links
13+
14+
Please refer to the following links for more information about this project.
15+
16+
- [GitHub](https://github.com/toss/es-git)

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ layout: home
44

55
hero:
66
name: 'es-git'
7-
text: 'TODO'
7+
text: 'Modern git library built for Node.js'
88
# tagline:
99
actions:
1010
- theme: brand
1111
text: About es-git
12-
link: /intro
12+
link: /about
1313
- theme: alt
1414
text: Usage
15-
link: /usage
15+
link: /usage/open
1616
---

docs/usage.md renamed to docs/install.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
description: How to use es-git
2+
description: Install es-git
33
prev:
4-
text: Introduction to es-git
5-
link: ./intro.md
4+
text: About es-git
5+
link: ./about.md
66
---
77

8-
# Installation & Usage
8+
# Installation
99

1010
es-git is available via [npm](https://npmjs.com/package/es-git).
1111

docs/intro.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)