Skip to content

Commit

Permalink
feat: support vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Oct 27, 2024
1 parent e73e658 commit d861865
Show file tree
Hide file tree
Showing 12 changed files with 1,142 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"root": true,
"ignorePatterns": ["lib", "coverage"],
"extends": ["@varlet"]
"ignorePatterns": ["lib", "coverage", "docs/.vitepress/cache", "docs/.vitepress/dist"],
"extends": ["@varlet"],
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
node_modules
lib
coverage
.DS_Store
.DS_Store
docs/.vitepress/cache
docs/.vitepress/dist
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ lib/**
.github/**
.history/**
coverage/**
docs/.vitepress/cache/**
docs/.vitepress/dist/**

pnpm-lock.yaml
pnpm-workspace.yaml
49 changes: 49 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineConfig } from 'vitepress'

export default defineConfig({
title: 'Rattail',
description: 'A utilities library for front-end developers, lightweight and ts-friendly',
locales: {
root: {
label: 'English',
lang: 'en',
},
zh: {
label: '简体中文',
lang: 'zh',
link: '/zh',
themeConfig: {
nav: [{ text: '首页', link: '/zh' }],

sidebar: [
{
text: '简介',
items: [{ text: '快速开始', link: '/zh/getting-started' }],
},
{
text: '通用',
items: [{ text: 'isString', link: '/zh/general/is-string' }],
},
],

socialLinks: [{ icon: 'github', link: 'https://github.com/varletjs/rattail' }],
},
},
},
themeConfig: {
nav: [{ text: 'Home', link: '/' }],

sidebar: [
{
text: 'Introduction',
items: [{ text: 'Getting Started', link: '/getting-started' }],
},
{
text: 'General',
items: [{ text: 'isString', link: '/general/is-string' }],
},
],

socialLinks: [{ icon: 'github', link: 'https://github.com/varletjs/rattail' }],
},
})
24 changes: 24 additions & 0 deletions docs/general/is-string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# isString

Determine whether the input value is a string

### Usage

```ts
import { isString } from 'rattail'

console.log(isString('rattail')) // return true
console.log(isString(123)) // return false
```

### Arguments

| Arg | Type | Defaults |
| ------- | :---: | -------: |
| `value` | `any` | |

### Return

| Type |
| :--: |
| `boolean` |
25 changes: 25 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Getting Started

### Installation

::: code-group
```shell [npm]
npm i rattail -S
```

```shell [yarn]
yarn add rattail
```

```shell [pnpm]
pnpm add rattail
```
:::

### Usage

```ts
import { isString } from 'rattail'

console.log(isString('rattail'))
```
20 changes: 20 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
layout: home

hero:
name: 'Rattail'
text: 'A Utilities Library'
tagline: A utilities library for front-end developers, lightweight and ts-friendly
actions:
- theme: brand
text: Get Started
link: /getting-started

features:
- title: General
details: Provide utilities frequently used in daily development
- title: Lightweight
details: Utilities implementation is very lightweight
- title: Ts-friendly
details: Written based on ts, providing complete ts types
---
24 changes: 24 additions & 0 deletions docs/zh/general/is-string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# isString

判断输入值是否是字符串

### 使用

```ts
import { isString } from 'rattail'

console.log(isString('rattail')) // return true
console.log(isString(123)) // return false
```

### 参数列表

| 参数 | 类型 | 默认值 |
| ------- | :---: | -----: |
| `value` | `any` | |

### 返回值

| 类型 |
| :-------: |
| `boolean` |
25 changes: 25 additions & 0 deletions docs/zh/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 快速开始

### 安装

::: code-group
```shell [npm]
npm i rattail -S
```

```shell [yarn]
yarn add rattail
```

```shell [pnpm]
pnpm add rattail
```
:::

### 使用

```ts
import { isString } from 'rattail'

console.log(isString('rattail'))
```
20 changes: 20 additions & 0 deletions docs/zh/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
layout: home

hero:
name: 'Rattail'
text: '实用工具库'
tagline: 面向前端开发人员的实用工具库,轻量级且 ts 友好
actions:
- theme: brand
text: 快速开始
link: /zh/getting-started

features:
- title: 通用
details: 提供日常开发中经常使用的实用程序
- title: 轻量
details: 工具实现非常轻量
- title: Ts 友好
details: 实用 ts 编写,提供完善的类型支持
---
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"require": "./lib/index.cjs"
}
},
"description": "shared utils of common",
"description": "A utilities library for front-end developers, lightweight and ts-friendly",
"keywords": [
"shared",
"utils",
"common"
"utilities library",
"front-end developers",
"lightweight",
"ts-friendly"
],
"author": "haoziqaq <357229046@qq.com>",
"license": "MIT",
Expand All @@ -38,19 +39,23 @@
"clean": "rimraf node_modules lib",
"test:watch": "vitest --coverage",
"test": "vitest run --coverage",
"release": "pnpm build && vr release"
"release": "pnpm build && vr release",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"devDependencies": {
"@types/node": "^22.8.1",
"@varlet/eslint-config": "latest",
"@varlet/release": "^0.3.0",
"@vitest/coverage-istanbul": "^2.1.3",
"jsdom": "^25.0.1",
"eslint": "^8.53.0",
"jsdom": "^25.0.1",
"prettier": "^3.1.0",
"rimraf": "^6.0.1",
"tsup": "8.3.5",
"typescript": "^5.6.3",
"vitepress": "^1.4.1",
"vitest": "^2.1.3"
},
"packageManager": "pnpm@9.0.0",
Expand Down
Loading

0 comments on commit d861865

Please sign in to comment.