Skip to content

Commit

Permalink
chore: update readme and api description
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgao365 committed Dec 8, 2023
1 parent 88b1a54 commit 0d47271
Show file tree
Hide file tree
Showing 11 changed files with 918 additions and 317 deletions.
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ export default defineConfig({
});
```

#### Options
#### API Options

| Option | Type | Default | Description |
You Visit The [API Document](https://paka.dev/npm/@tomjs/vite-plugin-iconify) Power by [paka.dev](https://paka.dev).

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| selector | `string` | 'title' | The tag selector to inject the IconifyProviders script after |
| resources | `string[]` | [] | Icon API URLs, default includes https://api.iconify.design |
Expand All @@ -88,7 +90,7 @@ Iconify icon set, refer to [icon sets](https://icon-sets.iconify.design/) or [Ic

By configuring this parameter, the local icon set will be copied to the `outDir` directory based on the `sets` configuration.

| Option | Type | Default | Description |
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| **sets** | `IconifySet[]` | [] | Iconify icon sets |
| base | `string` | '/' | Same as the `base` option in Vite configuration |
Expand Down Expand Up @@ -133,6 +135,22 @@ Options:
```bash
# Install dependencies
pnpm i
# Generate the dist directory for this library and install the dependencies for examples
pnpm bootstrap
# build library
pnpm build
```
- To debug the `vue` project, execute the following commands:
```bash
cd examples/vue
pnpm build
pnpm preview
```
- To debug the `react` project, execute the following commands:
```bash
cd examples/react
pnpm build
pnpm preview
```
24 changes: 21 additions & 3 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export default defineConfig({
});
```

#### 参数
#### API 参数

你可以访问 [paka.dev](https://paka.dev) 提供的 [API文档](https://paka.dev/npm/@tomjs/vite-plugin-iconify).

| 参数名 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
Expand Down Expand Up @@ -133,6 +135,22 @@ Options:
```bash
# 安装依赖
pnpm i
# 生成本库的dist,安装 examples 依赖
pnpm bootstrap
# 编译库
pnpm build
```
- 调试 `vue` 项目,执行如下命令
```bash
cd examples/vue
pnpm build
pnpm preview
```
- 调试 `react` 项目,执行如下命令
```bash
cd examples/react
pnpm build
pnpm preview
```
9 changes: 5 additions & 4 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@iconify/json": "^2.2.149",
"@types/react": "^18.2.39",
"@iconify/json": "^2.2.153",
"@tomjs/vite-plugin-iconify": "workspace:^",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0",
"typescript": "^5.2.2",
"vite": "^5.0.4"
"typescript": "^5.3.3",
"vite": "^5.0.6"
}
}
2 changes: 1 addition & 1 deletion examples/react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import iconify from '@tomjs/vite-plugin-iconify';
import react from '@vitejs/plugin-react-swc';
import iconify from '../../dist/index.mjs';

// https://vitejs.dev/config/
export default defineConfig({
Expand Down
13 changes: 7 additions & 6 deletions examples/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
},
"dependencies": {
"@iconify/vue": "^4.1.1",
"vue": "^3.3.9"
"vue": "^3.3.10"
},
"devDependencies": {
"@iconify/json": "^2.2.149",
"@vitejs/plugin-vue": "^4.5.0",
"typescript": "^5.2.2",
"vite": "^5.0.4",
"vue-tsc": "^1.8.24"
"@iconify/json": "^2.2.153",
"@tomjs/vite-plugin-iconify": "workspace:^",
"@vitejs/plugin-vue": "^4.5.2",
"typescript": "^5.3.3",
"vite": "^5.0.6",
"vue-tsc": "^1.8.25"
}
}
2 changes: 1 addition & 1 deletion examples/vue/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import iconify from '@tomjs/vite-plugin-iconify';
import vue from '@vitejs/plugin-vue';
import iconify from '../../dist/index.mjs';

// https://vitejs.dev/config/
export default defineConfig({
Expand Down
28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@
"ti": "./dist/cli.mjs"
},
"scripts": {
"build": "npm run clean && tsup",
"dev": "tsup",
"build": "npm run clean && tsup --minify",
"clean": "rimraf ./dist",
"lint": "run-s lint:eslint lint:stylelint lint:prettier",
"lint:eslint": "eslint \"{src,examples}/**/*.{ts,tsx,vue}\" *.{js,cjs,ts} --fix --cache",
"lint:eslint": "eslint \"{src,examples}/**/*.{js,cjs,ts,tsx,vue}\" *.{js,cjs,ts} --fix --cache",
"lint:stylelint": "stylelint \"examples/**/*.{vue,css,less,html}\" --fix --cache",
"lint:prettier": "prettier --write \"{src,examples}/**/*.{js,cjs,ts,tsx,json,md,html}\" *.{js,cjs,ts,json,md}",
"bootstrap": "pnpm build && run-p bootstrap:*",
"bootstrap:vue": "cd examples/vue && pnpm i",
"bootstrap:react": "cd examples/react && pnpm i",
"prepare": "husky install",
"prepublishOnly": "npm run build && np --any-branch --no-yarn --yolo --no-publish --message \"chore: release v%s\""
},
Expand All @@ -68,24 +66,24 @@
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@tomjs/commitlint": "^2.0.3",
"@tomjs/eslint": "^1.0.8",
"@tomjs/prettier": "^1.0.5",
"@tomjs/stylelint": "^1.0.6",
"@tomjs/tsconfig": "^1.0.7",
"@tomjs/commitlint": "^2.0.5",
"@tomjs/eslint": "^1.1.1",
"@tomjs/prettier": "^1.0.6",
"@tomjs/stylelint": "^1.1.0",
"@tomjs/tsconfig": "^1.0.8",
"@types/fs-extra": "^11.0.4",
"@types/node": "^18.18.13",
"eslint": "^8.54.0",
"eslint": "^8.55.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"np": "^9.0.0",
"lint-staged": "^15.2.0",
"np": "^9.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"rimraf": "^5.0.5",
"stylelint": "^15.11.0",
"tsup": "^8.0.1",
"typescript": "^5.2.2",
"vite": "^5.0.4"
"typescript": "^5.3.3",
"vite": "^5.0.6"
},
"peerDependencies": {
"vite": ">=2"
Expand Down
Loading

0 comments on commit 0d47271

Please sign in to comment.