mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-01-02 21:36:56 +08:00
Compare commits
232 Commits
v4.0.0-alp
...
next
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b45b0b7608 | ||
|
|
c309ca2aaf | ||
|
|
66df033ec8 | ||
|
|
e2ea3be819 | ||
|
|
019c328975 | ||
|
|
0e55b72200 | ||
|
|
69d3ba000c | ||
|
|
9418fe371d | ||
|
|
5d8282ddae | ||
|
|
43ff890d79 | ||
|
|
98642589ee | ||
|
|
6f910c9913 | ||
|
|
1b08f84ac6 | ||
|
|
f0d3e04fba | ||
|
|
830a1eb5cf | ||
|
|
cd439c04f3 | ||
|
|
0aac165d4e | ||
|
|
f60a3b840d | ||
|
|
997f3e0acd | ||
|
|
e2fe50250c | ||
|
|
bc024a105c | ||
|
|
7afb74345a | ||
|
|
65fdb2155b | ||
|
|
c6bc97f4e4 | ||
|
|
7d023fd6e4 | ||
|
|
1afe960f30 | ||
|
|
3e039b02b5 | ||
|
|
1837ed712f | ||
|
|
94c5afe65c | ||
|
|
5174a1a668 | ||
|
|
ed8cd77449 | ||
|
|
a677bee2b8 | ||
|
|
05544c109f | ||
|
|
21c57caa9b | ||
|
|
66aa2906e0 | ||
|
|
61ef6b9a98 | ||
|
|
c25acb8d46 | ||
|
|
8bcb34724f | ||
|
|
cf5e7e6629 | ||
|
|
a02cfe9604 | ||
|
|
71354f7742 | ||
|
|
84b05f0668 | ||
|
|
95542bf06e | ||
|
|
8d15fa4fdf | ||
|
|
35f81fb208 | ||
|
|
da3400435f | ||
|
|
50ee584953 | ||
|
|
889b28609a | ||
|
|
6a7376d15d | ||
|
|
2cca630808 | ||
|
|
dcffa09812 | ||
|
|
0881de82af | ||
|
|
86adc66dd9 | ||
|
|
1d87343195 | ||
|
|
aa1689fed8 | ||
|
|
b6dd0cb36c | ||
|
|
4b2e06b34d | ||
|
|
717f244d2f | ||
|
|
6b7ae0f6a0 | ||
|
|
cb93bd2da3 | ||
|
|
ca583e1075 | ||
|
|
667034322e | ||
|
|
8d51f9e08e | ||
|
|
236a2e43f3 | ||
|
|
326880a4e1 | ||
|
|
31ac5faa3a | ||
|
|
1e8187bc37 | ||
|
|
72d515b30e | ||
|
|
b4072ef2bd | ||
|
|
ec1d32db4a | ||
|
|
dfdc27a755 | ||
|
|
8574339579 | ||
|
|
5c6992f97c | ||
|
|
292ac6b55e | ||
|
|
1945c35b17 | ||
|
|
da3ad139d4 | ||
|
|
3aca130ca5 | ||
|
|
f060d1a813 | ||
|
|
041039b5e9 | ||
|
|
68b93a4008 | ||
|
|
4e83e5ecc0 | ||
|
|
8ef197ea12 | ||
|
|
dc0a29be17 | ||
|
|
a06f1567db | ||
|
|
e17cc35dcf | ||
|
|
04494a450d | ||
|
|
e5cc32ca97 | ||
|
|
c3776877ca | ||
|
|
f61b00175e | ||
|
|
6a1516ca37 | ||
|
|
7eaefd04fa | ||
|
|
ed5ea225ca | ||
|
|
b117e21dc4 | ||
|
|
961f70d523 | ||
|
|
cfdb5c1fbe | ||
|
|
89718934af | ||
|
|
6fee5cfed8 | ||
|
|
9e8a0864c3 | ||
|
|
c3a8275ebf | ||
|
|
c88b034aac | ||
|
|
d96c4228f5 | ||
|
|
41d6b5191d | ||
|
|
d3c679aa27 | ||
|
|
e6b43db90b | ||
|
|
2f6ef7aed8 | ||
|
|
729e283ab5 | ||
|
|
a1d4297c92 | ||
|
|
e45ac25ac0 | ||
|
|
83a4e286bd | ||
|
|
f4ab1b8c0c | ||
|
|
7879fd6395 | ||
|
|
11dbde14f6 | ||
|
|
537e629d7d | ||
|
|
178df39c44 | ||
|
|
74c1c2927e | ||
|
|
a31f78b07a | ||
|
|
794fd029a0 | ||
|
|
c628a66770 | ||
|
|
b6c8d3f39f | ||
|
|
627661e0ed | ||
|
|
11d25a0b0e | ||
|
|
b46b429682 | ||
|
|
15142770f2 | ||
|
|
aea97f90e6 | ||
|
|
abce9fdafd | ||
|
|
1050ab33f5 | ||
|
|
a0bd47dd84 | ||
|
|
1ac1bb94e7 | ||
|
|
53162941da | ||
|
|
e998c1be95 | ||
|
|
a53dc02b0a | ||
|
|
1ce400bb7f | ||
|
|
5a3fe7ed0f | ||
|
|
1bc6cbdb69 | ||
|
|
5179891faa | ||
|
|
ba95cad78d | ||
|
|
9a6bc32cf4 | ||
|
|
419a8e4f0e | ||
|
|
d712da5778 | ||
|
|
5f526c9f0e | ||
|
|
ec78d5b1d9 | ||
|
|
e5e6e8aaa4 | ||
|
|
e27efdad0d | ||
|
|
beeb059401 | ||
|
|
5883d3e0c7 | ||
|
|
2e27c67c76 | ||
|
|
28e8b72ccd | ||
|
|
8256fdc927 | ||
|
|
e60f36390a | ||
|
|
0a8420fdac | ||
|
|
eea5f002a7 | ||
|
|
2f1066e9c6 | ||
|
|
e4fc6f9081 | ||
|
|
cb751211f1 | ||
|
|
e5a3aa103d | ||
|
|
52957ec244 | ||
|
|
a49fa3648f | ||
|
|
cc698f561e | ||
|
|
f46c9c6548 | ||
|
|
154408fa8b | ||
|
|
20ee462cab | ||
|
|
293dab6a51 | ||
|
|
bb23e1b700 | ||
|
|
2b77f96fc5 | ||
|
|
e61d85a890 | ||
|
|
2c2cdd077f | ||
|
|
c83a57b2bd | ||
|
|
1d5cb1e051 | ||
|
|
6f94627bf4 | ||
|
|
7ca4db9c64 | ||
|
|
a1c79f42ff | ||
|
|
6225c8123c | ||
|
|
ffefe3002f | ||
|
|
df03886053 | ||
|
|
eae8d47cee | ||
|
|
c38fed70be | ||
|
|
8ee4080d69 | ||
|
|
5d81dcb549 | ||
|
|
88d44cf4ea | ||
|
|
a317984da1 | ||
|
|
4dab4e20c2 | ||
|
|
525653b68d | ||
|
|
bab0636014 | ||
|
|
2765ff5555 | ||
|
|
b6920a5691 | ||
|
|
586bc21dd3 | ||
|
|
4a602f7e46 | ||
|
|
0dc09cab8c | ||
|
|
63519433f1 | ||
|
|
1f19fb0d9f | ||
|
|
f13601cb9f | ||
|
|
1fa454f7ad | ||
|
|
85dd8f4176 | ||
|
|
850aab865e | ||
|
|
387c478b25 | ||
|
|
3606f48003 | ||
|
|
79dfc4b8cb | ||
|
|
0b6de0aa77 | ||
|
|
be22f4c1f8 | ||
|
|
e5cc7fadeb | ||
|
|
d5f8963d02 | ||
|
|
95bee73624 | ||
|
|
ffed2035c8 | ||
|
|
607e6e2be4 | ||
|
|
ba448b8617 | ||
|
|
a4472f8788 | ||
|
|
a2df2b1b3b | ||
|
|
3fe6a04e7c | ||
|
|
1f4155c464 | ||
|
|
d4e49b59ff | ||
|
|
1d0bbb39d1 | ||
|
|
dada6a42fc | ||
|
|
4bb4a6622f | ||
|
|
90deb2439f | ||
|
|
5cd731594f | ||
|
|
582582e480 | ||
|
|
173a364dae | ||
|
|
0c0191332a | ||
|
|
99d705e597 | ||
|
|
3829a1e745 | ||
|
|
df024f1c6e | ||
|
|
726f98027a | ||
|
|
0a114228a8 | ||
|
|
880ed2c78e | ||
|
|
9fbc1fa477 | ||
|
|
8b5c62e6fc | ||
|
|
040ffbb8ca | ||
|
|
3b0965520b | ||
|
|
68a7b17f36 | ||
|
|
b122e3638f | ||
|
|
08fd2a8184 | ||
|
|
fe2115ee5c |
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
请移步 GitHub issues 进行反馈:
|
请移步 GitHub issues 进行反馈:
|
||||||
|
|
||||||
https://github.com/youzan/vant/issues
|
https://github.com/vant-ui/vant/issues
|
||||||
|
|||||||
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -29,7 +29,7 @@ It's welcomed to pull request, And there are some tips about that:
|
|||||||
You will need [Node.js >= 14](https://nodejs.org) and [pnpm](https://pnpm.io).
|
You will need [Node.js >= 14](https://nodejs.org) and [pnpm](https://pnpm.io).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone git@github.com:youzan/vant.git
|
git clone git@github.com:vant-ui/vant.git
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
pnpm i
|
pnpm i
|
||||||
|
|||||||
@ -9,8 +9,8 @@ body:
|
|||||||
在提交 Bug 报告前,请注意:
|
在提交 Bug 报告前,请注意:
|
||||||
|
|
||||||
- 确认你的问题无法通过官方文档得到解决。
|
- 确认你的问题无法通过官方文档得到解决。
|
||||||
- 确认你搜索过 [历史 issue](https://github.com/youzan/vant/issues),并且没有发现同样的问题。
|
- 确认你搜索过 [历史 issue](https://github.com/vant-ui/vant/issues),并且没有发现同样的问题。
|
||||||
- 如果不是反馈 Bug,请到 [Discussions 讨论区](https://github.com/youzan/vant/discussions) 发帖。
|
- 如果不是反馈 Bug,请到 [Discussions 讨论区](https://github.com/vant-ui/vant/discussions) 发帖。
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
id: reproduce
|
id: reproduce
|
||||||
|
|||||||
@ -9,8 +9,8 @@ body:
|
|||||||
在提交 Bug 报告前,请注意:
|
在提交 Bug 报告前,请注意:
|
||||||
|
|
||||||
- 确认你的问题无法通过官方文档得到解决。
|
- 确认你的问题无法通过官方文档得到解决。
|
||||||
- 确认你搜索过 [历史 issue](https://github.com/youzan/vant/issues),并且没有发现同样的问题。
|
- 确认你搜索过 [历史 issue](https://github.com/vant-ui/vant/issues),并且没有发现同样的问题。
|
||||||
- 如果不是反馈 Bug,请到 [Discussions 讨论区](https://github.com/youzan/vant/discussions) 发帖。
|
- 如果不是反馈 Bug,请到 [Discussions 讨论区](https://github.com/vant-ui/vant/discussions) 发帖。
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
id: reproduce
|
id: reproduce
|
||||||
|
|||||||
@ -9,8 +9,8 @@ body:
|
|||||||
在提交功能需求前,请注意:
|
在提交功能需求前,请注意:
|
||||||
|
|
||||||
- 确认这是一个通用功能,并且无法通过现有的 API 或 Slot 实现。
|
- 确认这是一个通用功能,并且无法通过现有的 API 或 Slot 实现。
|
||||||
- 确认你搜索过 [历史 issue](https://github.com/youzan/vant/issues),并且没有发现同样的需求。
|
- 确认你搜索过 [历史 issue](https://github.com/vant-ui/vant/issues),并且没有发现同样的需求。
|
||||||
- 可以先到 [Discussions 讨论区](https://github.com/youzan/vant/discussions) 发帖,讨论一下需求是否合理。
|
- 可以先到 [Discussions 讨论区](https://github.com/vant-ui/vant/discussions) 发帖,讨论一下需求是否合理。
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
|
|||||||
@ -9,8 +9,8 @@ body:
|
|||||||
在提交功能需求前,请注意:
|
在提交功能需求前,请注意:
|
||||||
|
|
||||||
- 确认这是一个通用功能,并且无法通过现有的 API 实现。
|
- 确认这是一个通用功能,并且无法通过现有的 API 实现。
|
||||||
- 确认你搜索过 [历史 issue](https://github.com/youzan/vant/issues),并且没有发现同样的需求。
|
- 确认你搜索过 [历史 issue](https://github.com/vant-ui/vant/issues),并且没有发现同样的需求。
|
||||||
- 可以先到 [Discussions 讨论区](https://github.com/youzan/vant/discussions) 发帖,讨论一下需求是否合理。
|
- 可以先到 [Discussions 讨论区](https://github.com/vant-ui/vant/discussions) 发帖,讨论一下需求是否合理。
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
|
|||||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,6 +1,6 @@
|
|||||||
### Before submitting a pull request, please make sure the following is done:
|
### Before submitting a pull request, please make sure the following is done:
|
||||||
|
|
||||||
1. Read the [contributing guide](https://github.com/youzan/vant/blob/dev/.github/CONTRIBUTING.md).
|
1. Read the [contributing guide](https://github.com/vant-ui/vant/blob/dev/.github/CONTRIBUTING.md).
|
||||||
2. If you've added code that should be tested, add tests.
|
2. If you've added code that should be tested, add tests.
|
||||||
3. If you've changed APIs, update the documentation.
|
3. If you've changed APIs, update the documentation.
|
||||||
4. Ensure the test suite passes (`npm test`).
|
4. Ensure the test suite passes (`npm test`).
|
||||||
|
|||||||
8
.github/workflows/deploy-v4-site.yml
vendored
8
.github/workflows/deploy-v4-site.yml
vendored
@ -2,10 +2,12 @@ name: Deploy V4 Site
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [next]
|
branches: [dev]
|
||||||
paths:
|
paths:
|
||||||
- 'packages/vant/docs/**'
|
- 'packages/vant/docs/**'
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -16,9 +18,7 @@ jobs:
|
|||||||
ref: 'next'
|
ref: 'next'
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.0.1
|
run: npm i pnpm@7 -g
|
||||||
with:
|
|
||||||
version: 6.20.3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
4
.github/workflows/release-tag.yml
vendored
4
.github/workflows/release-tag.yml
vendored
@ -20,6 +20,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
tag_name: ${{ github.ref }}
|
||||||
body: |
|
body: |
|
||||||
更新内容参见 [CHANGELOG](https://youzan.github.io/vant/#/zh-CN/changelog)。
|
更新内容参见 [CHANGELOG](https://vant-ui.github.io/vant/#/zh-CN/changelog)。
|
||||||
|
|
||||||
Please refer to [CHANGELOG](https://youzan.github.io/vant/#/en-US/changelog) for details.
|
Please refer to [CHANGELOG](https://vant-ui.github.io/vant/#/en-US/changelog) for details.
|
||||||
|
|||||||
6
.github/workflows/sync-gitee.yml
vendored
6
.github/workflows/sync-gitee.yml
vendored
@ -2,7 +2,9 @@ name: Sync to Gitee
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [dev, 2.x, gh-pages]
|
branches: [dev, 2.x, 3.x, gh-pages]
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -15,6 +17,6 @@ jobs:
|
|||||||
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
|
||||||
with:
|
with:
|
||||||
# GitHub 源仓库地址
|
# GitHub 源仓库地址
|
||||||
source-repo: git@github.com:youzan/vant.git
|
source-repo: git@github.com:vant-ui/vant.git
|
||||||
# Gitee 目标仓库地址
|
# Gitee 目标仓库地址
|
||||||
destination-repo: git@gitee.com:vant-contrib/vant.git
|
destination-repo: git@gitee.com:vant-contrib/vant.git
|
||||||
|
|||||||
23
.github/workflows/test.yml
vendored
23
.github/workflows/test.yml
vendored
@ -1,6 +1,15 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@ -9,9 +18,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.0.1
|
run: npm i pnpm@7 -g
|
||||||
with:
|
|
||||||
version: 6.20.3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
@ -30,9 +37,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.0.1
|
run: npm i pnpm@7 -g
|
||||||
with:
|
|
||||||
version: 6.20.3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
@ -56,9 +61,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.0.1
|
run: npm i pnpm@7 -g
|
||||||
with:
|
|
||||||
version: 6.20.3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,6 +15,5 @@ package-lock.json
|
|||||||
es
|
es
|
||||||
lib
|
lib
|
||||||
dist
|
dist
|
||||||
vetur
|
|
||||||
**/site-dist
|
**/site-dist
|
||||||
changelog.generated.md
|
changelog.generated.md
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
npx --no-install lint-staged
|
npx --no-install nano-staged
|
||||||
|
|||||||
2
.npmrc
2
.npmrc
@ -1 +1,3 @@
|
|||||||
registry=https://registry.npmmirror.com/
|
registry=https://registry.npmmirror.com/
|
||||||
|
|
||||||
|
strict-peer-dependencies=false
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["@vant/stylelint-config"]
|
|
||||||
}
|
|
||||||
5
LICENSE
5
LICENSE
@ -1,4 +1,7 @@
|
|||||||
Copyright 2016-present Youzan
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|||||||
36
README.md
36
README.md
@ -1,24 +1,23 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://cdn.jsdelivr.net/npm/@vant/assets/logo.png" width="120" height="120" style="margin-bottom: 10px;">
|
<img alt="logo" src="https://fastly.jsdelivr.net/npm/@vant/assets/logo.png" width="120" height="120" style="margin-bottom: 10px;">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1 align="center">Vant</h1>
|
<h1 align="center">Vant</h1>
|
||||||
|
|
||||||
<p align="center">Mobile UI Components built on Vue</p>
|
<p align="center">Lightweight Mobile UI Components built on Vue</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://img.shields.io/npm/v/vant?style=flat-square" alt="npm version" />
|
<img src="https://img.shields.io/npm/v/vant?style=flat-square" alt="npm version" />
|
||||||
<img src="https://img.shields.io/github/workflow/status/youzan/vant/CI/dev?style=flat-square" alt="CI Status" />
|
<img src="https://img.shields.io/github/workflow/status/vant-ui/vant/CI/dev?style=flat-square" alt="CI Status" />
|
||||||
<img src="https://img.shields.io/codecov/c/github/youzan/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
|
<img src="https://img.shields.io/codecov/c/github/vant-ui/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
|
||||||
<img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
|
<img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
|
||||||
<img src="https://img.shields.io/jsdelivr/npm/hm/vant?style=flat-square" alt="Jsdelivr Hits">
|
|
||||||
<img src="https://img.badgesize.io/https://unpkg.com/vant@3/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
|
<img src="https://img.badgesize.io/https://unpkg.com/vant@3/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
🔥 <a href="https://vant-contrib.gitee.io/vant">文档网站(国内)</a>
|
🔥 <a href="https://vant-contrib.gitee.io/vant">文档网站(国内)</a>
|
||||||
|
|
||||||
🌈 <a href="https://youzan.github.io/vant">文档网站(GitHub)</a>
|
🌈 <a href="https://vant-ui.github.io/vant">文档网站(GitHub)</a>
|
||||||
|
|
||||||
🇨🇳 <a href="./README.zh-CN.md">中文版介绍</a>
|
🇨🇳 <a href="./README.zh-CN.md">中文版介绍</a>
|
||||||
</p>
|
</p>
|
||||||
@ -29,6 +28,7 @@
|
|||||||
|
|
||||||
- 🚀 1KB Component average size (min+gzip)
|
- 🚀 1KB Component average size (min+gzip)
|
||||||
- 🚀 70+ High quality components
|
- 🚀 70+ High quality components
|
||||||
|
- 🚀 Zero third-party dependencies
|
||||||
- 💪 90%+ Unit test coverage
|
- 💪 90%+ Unit test coverage
|
||||||
- 💪 Written in TypeScript
|
- 💪 Written in TypeScript
|
||||||
- 📖 Extensive documentation and demos
|
- 📖 Extensive documentation and demos
|
||||||
@ -67,14 +67,18 @@ pnpm add vant
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
// 1. Import the components you need
|
||||||
import { Button } from 'vant';
|
import { Button } from 'vant';
|
||||||
|
// 2. Import the components style
|
||||||
import 'vant/lib/index.css';
|
import 'vant/lib/index.css';
|
||||||
|
|
||||||
const app = createApp();
|
const app = createApp();
|
||||||
|
|
||||||
|
// 3. Register the components you need
|
||||||
app.use(Button);
|
app.use(Button);
|
||||||
```
|
```
|
||||||
|
|
||||||
See more in [Quickstart](https://youzan.github.io/vant#/en-US/quickstart).
|
See more in [Quickstart](https://vant-ui.github.io/vant#/en-US/quickstart).
|
||||||
|
|
||||||
## Browser Support
|
## Browser Support
|
||||||
|
|
||||||
@ -86,11 +90,11 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
|
|||||||
|
|
||||||
| Project | Description |
|
| Project | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [vant-weapp](https://github.com/youzan/vant-weapp) | WeChat MiniProgram UI |
|
| [vant-weapp](https://github.com/vant-ui/vant-weapp) | WeChat MiniProgram UI |
|
||||||
| [vant-demo](https://github.com/youzan/vant-demo) | Collection of Vant demos |
|
| [vant-demo](https://github.com/vant-ui/vant-demo) | Collection of Vant demos |
|
||||||
| [vant-cli](https://github.com/youzan/vant/tree/dev/packages/vant-cli) | Scaffold for UI library |
|
| [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | Scaffold for UI library |
|
||||||
| [vant-icons](https://github.com/youzan/vant/tree/dev/packages/vant-icons) | Vant icons |
|
| [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant icons |
|
||||||
| [vant-touch-emulator](https://github.com/youzan/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers |
|
| [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers |
|
||||||
|
|
||||||
## Community Ecosystem
|
## Community Ecosystem
|
||||||
|
|
||||||
@ -106,15 +110,15 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
|
|||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- [Documentation](https://youzan.github.io/vant)
|
- [Documentation](https://vant-ui.github.io/vant)
|
||||||
- [Changelog](https://youzan.github.io/vant#/en-US/changelog)
|
- [Changelog](https://vant-ui.github.io/vant#/en-US/changelog)
|
||||||
- [Gitter](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
|
- [Gitter](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
|
||||||
|
|
||||||
## Preview
|
## Preview
|
||||||
|
|
||||||
You can scan the following QR code to access the demo:
|
You can scan the following QR code to access the demo:
|
||||||
|
|
||||||
<img src="https://cdn.jsdelivr.net/npm/@vant/assets/preview-qrcode.png" width="220" height="220" >
|
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/preview-qrcode.png" width="220" height="220" >
|
||||||
|
|
||||||
## Core Team
|
## Core Team
|
||||||
|
|
||||||
@ -128,7 +132,7 @@ Core contributors of Vant and Vant Weapp:
|
|||||||
|
|
||||||
Thanks to the following friends for their contributions to Vant:
|
Thanks to the following friends for their contributions to Vant:
|
||||||
|
|
||||||
<a href="https://github.com/youzan/vant/graphs/contributors">
|
<a href="https://github.com/vant-ui/vant/graphs/contributors">
|
||||||
<img src="https://opencollective.com/vant/contributors.svg?width=890&button=false" alt="contributors">
|
<img src="https://opencollective.com/vant/contributors.svg?width=890&button=false" alt="contributors">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://cdn.jsdelivr.net/npm/@vant/assets/logo.png" width="120" style="margin-bottom: 10px;">
|
<img alt="logo" src="https://fastly.jsdelivr.net/npm/@vant/assets/logo.png" width="120" style="margin-bottom: 10px;">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1 align="center">Vant</h1>
|
<h1 align="center">Vant</h1>
|
||||||
@ -8,17 +8,16 @@
|
|||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://img.shields.io/npm/v/vant?style=flat-square" alt="npm version" />
|
<img src="https://img.shields.io/npm/v/vant?style=flat-square" alt="npm version" />
|
||||||
<img src="https://img.shields.io/github/workflow/status/youzan/vant/CI/dev?style=flat-square" alt="CI Status" />
|
<img src="https://img.shields.io/github/workflow/status/vant-ui/vant/CI/dev?style=flat-square" alt="CI Status" />
|
||||||
<img src="https://img.shields.io/codecov/c/github/youzan/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
|
<img src="https://img.shields.io/codecov/c/github/vant-ui/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
|
||||||
<img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
|
<img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
|
||||||
<img src="https://img.shields.io/jsdelivr/npm/hm/vant?style=flat-square" alt="Jsdelivr Hits">
|
|
||||||
<img src="https://img.badgesize.io/https://unpkg.com/vant@3/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
|
<img src="https://img.badgesize.io/https://unpkg.com/vant@3/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
🔥 <a href="https://vant-contrib.gitee.io/vant">文档网站(国内)</a>
|
🔥 <a href="https://vant-contrib.gitee.io/vant">文档网站(国内)</a>
|
||||||
|
|
||||||
🌈 <a href="https://youzan.github.io/vant">文档网站(GitHub)</a>
|
🌈 <a href="https://vant-ui.github.io/vant">文档网站(GitHub)</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -33,6 +32,7 @@ Vant 是一个**轻量、可靠的移动端组件库**,于 2017 年开源。
|
|||||||
|
|
||||||
- 🚀 性能极佳,组件平均体积小于 1KB(min+gzip)
|
- 🚀 性能极佳,组件平均体积小于 1KB(min+gzip)
|
||||||
- 🚀 70+ 个高质量组件,覆盖移动端主流场景
|
- 🚀 70+ 个高质量组件,覆盖移动端主流场景
|
||||||
|
- 🚀 零外部依赖,不依赖三方 npm 包
|
||||||
- 💪 使用 TypeScript 编写,提供完整的类型定义
|
- 💪 使用 TypeScript 编写,提供完整的类型定义
|
||||||
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
|
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
|
||||||
- 📖 提供丰富的中英文文档和组件示例
|
- 📖 提供丰富的中英文文档和组件示例
|
||||||
@ -71,10 +71,14 @@ pnpm add vant
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
// 1. 引入你需要的组件
|
||||||
import { Button } from 'vant';
|
import { Button } from 'vant';
|
||||||
|
// 2. 引入组件样式
|
||||||
import 'vant/lib/index.css';
|
import 'vant/lib/index.css';
|
||||||
|
|
||||||
const app = createApp();
|
const app = createApp();
|
||||||
|
|
||||||
|
// 3. 注册你需要的组件
|
||||||
app.use(Button);
|
app.use(Button);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -92,11 +96,11 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
|
|||||||
|
|
||||||
| 项目 | 描述 |
|
| 项目 | 描述 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [vant-weapp](https://github.com/youzan/vant-weapp) | Vant 微信小程序版 |
|
| [vant-weapp](https://github.com/vant-ui/vant-weapp) | Vant 微信小程序版 |
|
||||||
| [vant-demo](https://github.com/youzan/vant-demo) | Vant 官方示例合集 |
|
| [vant-demo](https://github.com/vant-ui/vant-demo) | Vant 官方示例合集 |
|
||||||
| [vant-cli](https://github.com/youzan/vant/tree/dev/packages/vant-cli) | 开箱即用的组件库搭建工具 |
|
| [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | 开箱即用的组件库搭建工具 |
|
||||||
| [vant-icons](https://github.com/youzan/vant/tree/dev/packages/vant-icons) | Vant 图标库 |
|
| [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant 图标库 |
|
||||||
| [vant-touch-emulator](https://github.com/youzan/vant/tree/dev/packages/vant-touch-emulator) | 在桌面端使用 Vant 的辅助库 |
|
| [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | 在桌面端使用 Vant 的辅助库 |
|
||||||
|
|
||||||
## 社区生态
|
## 社区生态
|
||||||
|
|
||||||
@ -122,7 +126,7 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
|
|||||||
|
|
||||||
可以手机扫码以下二维码访问手机端 demo:
|
可以手机扫码以下二维码访问手机端 demo:
|
||||||
|
|
||||||
<img src="https://cdn.jsdelivr.net/npm/@vant/assets/preview-qrcode.png" width="220" height="220" >
|
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/preview-qrcode.png" width="220" height="220" >
|
||||||
|
|
||||||
## 核心团队
|
## 核心团队
|
||||||
|
|
||||||
@ -136,7 +140,7 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
|
|||||||
|
|
||||||
感谢以下小伙伴们为 Vant 发展做出的贡献:
|
感谢以下小伙伴们为 Vant 发展做出的贡献:
|
||||||
|
|
||||||
<a href="https://github.com/youzan/vant/graphs/contributors">
|
<a href="https://github.com/vant-ui/vant/graphs/contributors">
|
||||||
<img src="https://opencollective.com/vant/contributors.svg?width=890&button=false" alt="contributors">
|
<img src="https://opencollective.com/vant/contributors.svg?width=890&button=false" alt="contributors">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -144,7 +148,7 @@ Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一
|
|||||||
|
|
||||||
修改代码请阅读我们的 [贡献指南](https://vant-contrib.gitee.io/vant/#/zh-CN/contribution)。
|
修改代码请阅读我们的 [贡献指南](https://vant-contrib.gitee.io/vant/#/zh-CN/contribution)。
|
||||||
|
|
||||||
使用过程中发现任何问题都可以提 [Issue](https://github.com/youzan/vant/issues) 给我们,当然,我们也非常欢迎你给我们发 [PR](https://github.com/youzan/vant/pulls)。
|
使用过程中发现任何问题都可以提 [Issue](https://github.com/vant-ui/vant/issues) 给我们,当然,我们也非常欢迎你给我们发 [PR](https://github.com/vant-ui/vant/pulls)。
|
||||||
|
|
||||||
## 开源协议
|
## 开源协议
|
||||||
|
|
||||||
|
|||||||
41
package.json
41
package.json
@ -2,29 +2,36 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"dev": "pnpm dev --dir ./packages/vant",
|
"dev": "pnpm --dir ./packages/vant dev",
|
||||||
"lint": "pnpm lint --dir ./packages/vant",
|
"lint": "pnpm --dir ./packages/vant lint",
|
||||||
"test": "pnpm test --dir ./packages/vant",
|
"test": "pnpm --dir ./packages/vant test",
|
||||||
"test:watch": "pnpm test:watch --dir ./packages/vant",
|
"test:watch": "pnpm --dir ./packages/vant test:watch",
|
||||||
"build": "pnpm build --dir ./packages/vant",
|
"build": "pnpm --dir ./packages/vant build",
|
||||||
"build:site": "pnpm build:site --dir ./packages/vant"
|
"build:site": "pnpm --dir ./packages/vant build:site"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"nano-staged": {
|
||||||
"*.md": "prettier --write",
|
"*.md": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue,less}": "prettier --write",
|
"*.{ts,tsx,js,vue,less}": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue}": "eslint --fix",
|
"*.{ts,tsx,js,vue}": "eslint --fix"
|
||||||
"*.{vue,css,less}": "stylelint --fix"
|
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm",
|
"packageManager": "pnpm@7.11.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vant/cli": "workspace:*",
|
"@vant/cli": "workspace:*",
|
||||||
"@vant/eslint-config": "workspace:*",
|
"@vant/eslint-config": "workspace:*",
|
||||||
"@vant/stylelint-config": "workspace:*",
|
"eslint": "^8.23.0",
|
||||||
"eslint": "^8.2.0",
|
"husky": "^8.0.1",
|
||||||
"husky": "^7.0.4",
|
"nano-staged": "^0.8.0",
|
||||||
"lint-staged": "^12.1.2",
|
"prettier": "^2.7.1",
|
||||||
"prettier": "^2.5.0",
|
"rimraf": "^3.0.2"
|
||||||
"rimraf": "^3.0.2",
|
},
|
||||||
"stylelint": "^13.13.1"
|
"pnpm": {
|
||||||
|
"peerDependencyRules": {
|
||||||
|
"ignoreMissing": [
|
||||||
|
"@algolia/client-search",
|
||||||
|
"@types/react",
|
||||||
|
"react",
|
||||||
|
"react-dom"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
packages/create-vant-cli-app/LICENSE
Normal file
10
packages/create-vant-cli-app/LICENSE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@ -15,18 +15,17 @@
|
|||||||
"build": "vant-cli build",
|
"build": "vant-cli build",
|
||||||
"release": "vant-cli release",
|
"release": "vant-cli release",
|
||||||
"test:coverage": "open test/coverage/index.html",
|
"test:coverage": "open test/coverage/index.html",
|
||||||
"build-site": "vant-cli build-site && gh-pages -d site-dist"
|
"build-site": "vant-cli build-site && npx gh-pages -d site-dist"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "lint-staged",
|
"pre-commit": "nano-staged",
|
||||||
"commit-msg": "vant-cli commit-lint"
|
"commit-msg": "vant-cli commit-lint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"nano-staged": {
|
||||||
"*.{ts,tsx,js,jsx,vue}": "eslint --fix",
|
"*.{ts,tsx,js,jsx,vue}": "eslint --fix"
|
||||||
"*.{vue,css,less,scss}": "stylelint --fix"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
@ -34,7 +33,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vant/cli": "^2.0.0",
|
"@vant/cli": "^2.0.0",
|
||||||
"babel-plugin-import": "^1.13.0",
|
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-template-compiler": "^2.6.11"
|
"vue-template-compiler": "^2.6.11"
|
||||||
},
|
},
|
||||||
@ -44,11 +42,6 @@
|
|||||||
"@vant"
|
"@vant"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"stylelint": {
|
|
||||||
"extends": [
|
|
||||||
"@vant/stylelint-config"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"singleQuote": true
|
"singleQuote": true
|
||||||
},
|
},
|
||||||
|
|||||||
@ -10,7 +10,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
site: {
|
site: {
|
||||||
title: '<%= name %>',
|
title: '<%= name %>',
|
||||||
logo: 'https://cdn.jsdelivr.net/npm/@vant/assets/logo.png',
|
logo: 'https://fastly.jsdelivr.net/npm/@vant/assets/logo.png',
|
||||||
nav: [
|
nav: [
|
||||||
{
|
{
|
||||||
title: '开发指南',
|
title: '开发指南',
|
||||||
|
|||||||
@ -15,6 +15,5 @@ test/coverage
|
|||||||
es
|
es
|
||||||
lib
|
lib
|
||||||
dist
|
dist
|
||||||
vetur
|
|
||||||
site
|
site
|
||||||
changelog.generated.md
|
changelog.generated.md
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
npx --no-install lint-staged
|
npx --no-install nano-staged
|
||||||
|
|||||||
@ -17,16 +17,15 @@
|
|||||||
"build": "vant-cli build",
|
"build": "vant-cli build",
|
||||||
"build:site": "vant-cli build-site",
|
"build:site": "vant-cli build-site",
|
||||||
"release": "vant-cli release --tag next",
|
"release": "vant-cli release --tag next",
|
||||||
"release:site": "pnpm build:site && gh-pages -d site-dist",
|
"release:site": "pnpm build:site && npx gh-pages -d site-dist",
|
||||||
"test:watch": "vant-cli test --watch",
|
"test:watch": "vant-cli test --watch",
|
||||||
"test:coverage": "open test/coverage/index.html"
|
"test:coverage": "open test/coverage/index.html"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"lint-staged": {
|
"nano-staged": {
|
||||||
"*.md": "prettier --write",
|
"*.md": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue,less,scss}": "prettier --write",
|
"*.{ts,tsx,js,vue,less,scss}": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue}": "eslint --fix",
|
"*.{ts,tsx,js,vue}": "eslint --fix"
|
||||||
"*.{vue,css,less,scss}": "stylelint --fix"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "^3.0.0"
|
"vue": "^3.0.0"
|
||||||
@ -42,11 +41,6 @@
|
|||||||
"@vant"
|
"@vant"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"stylelint": {
|
|
||||||
"extends": [
|
|
||||||
"@vant/stylelint-config"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"singleQuote": true
|
"singleQuote": true
|
||||||
},
|
},
|
||||||
|
|||||||
@ -7,3 +7,7 @@
|
|||||||
<demo-button color="#03a9f4" style="margin-left: 15px">按钮</demo-button>
|
<demo-button color="#03a9f4" style="margin-left: 15px">按钮</demo-button>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import DemoButton from '../index.vue';
|
||||||
|
</script>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export default {
|
|||||||
},
|
},
|
||||||
site: {
|
site: {
|
||||||
title: '<%= name %>',
|
title: '<%= name %>',
|
||||||
logo: 'https://cdn.jsdelivr.net/npm/@vant/assets/logo.png',
|
logo: 'https://fastly.jsdelivr.net/npm/@vant/assets/logo.png',
|
||||||
nav: [
|
nav: [
|
||||||
{
|
{
|
||||||
title: '开发指南',
|
title: '开发指南',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-vant-cli-app",
|
"name": "create-vant-cli-app",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"description": "Create Vant CLI App",
|
"description": "Create Vant CLI App",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -24,24 +24,24 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/youzan/vant.git",
|
"url": "https://github.com/vant-ui/vant.git",
|
||||||
"directory": "packages/create-vant-cli-app"
|
"directory": "packages/create-vant-cli-app"
|
||||||
},
|
},
|
||||||
"bugs": "https://github.com/youzan/vant/issues",
|
"bugs": "https://github.com/vant-ui/vant/issues",
|
||||||
"author": "chenjiahan",
|
"author": "chenjiahan",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/inquirer": "^8.1.3",
|
"@types/inquirer": "^8.2.3",
|
||||||
"release-it": "^14.11.6",
|
"release-it": "^15.4.1",
|
||||||
"typescript": "~4.5.2"
|
"typescript": "^4.8.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.1.2",
|
|
||||||
"consola": "^2.11.3",
|
"consola": "^2.11.3",
|
||||||
"fast-glob": "^3.2.4",
|
"fast-glob": "^3.2.11",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.1.0",
|
||||||
"inquirer": "^8.0.0"
|
"inquirer": "^8.2.4",
|
||||||
|
"picocolors": "^1.0.0"
|
||||||
},
|
},
|
||||||
"release-it": {
|
"release-it": {
|
||||||
"git": {
|
"git": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import chalk from 'chalk';
|
import color from 'picocolors';
|
||||||
import consola from 'consola';
|
import consola from 'consola';
|
||||||
import { prompt } from 'inquirer';
|
import { prompt } from 'inquirer';
|
||||||
import { sep, join } from 'path';
|
import { sep, join } from 'path';
|
||||||
@ -64,7 +64,7 @@ export class VanGenerator {
|
|||||||
|
|
||||||
writing() {
|
writing() {
|
||||||
console.log();
|
console.log();
|
||||||
consola.info(`Creating project in ${chalk.green(this.outputDir)}\n`);
|
consola.info(`Creating project in ${color.green(this.outputDir)}\n`);
|
||||||
|
|
||||||
// see https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows
|
// see https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows
|
||||||
const templatePath = join(GENERATOR_DIR, this.inputs.vueVersion).replace(
|
const templatePath = join(GENERATOR_DIR, this.inputs.vueVersion).replace(
|
||||||
@ -99,16 +99,16 @@ export class VanGenerator {
|
|||||||
fs.writeFileSync(to, content);
|
fs.writeFileSync(to, content);
|
||||||
|
|
||||||
const name = to.replace(this.outputDir + sep, '');
|
const name = to.replace(this.outputDir + sep, '');
|
||||||
consola.success(`${chalk.green('create')} ${name}`);
|
consola.success(`${color.green('create')} ${name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
end() {
|
end() {
|
||||||
const { name } = this.inputs;
|
const { name } = this.inputs;
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
consola.success(`Successfully created ${chalk.yellow(name)}.`);
|
consola.success(`Successfully created ${color.yellow(name)}.`);
|
||||||
consola.success(
|
consola.success(
|
||||||
`Run ${chalk.yellow(
|
`Run ${color.yellow(
|
||||||
`cd ${name} && git init && yarn && yarn dev`
|
`cd ${name} && git init && yarn && yarn dev`
|
||||||
)} to start development!`
|
)} to start development!`
|
||||||
);
|
);
|
||||||
|
|||||||
10
packages/vant-area-data/LICENSE
Normal file
10
packages/vant-area-data/LICENSE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@ -1,10 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@vant/area-data",
|
"name": "@vant/area-data",
|
||||||
"version": "1.2.4",
|
"version": "1.3.2",
|
||||||
"description": "Vant 省市区数据",
|
"description": "Vant 省市区数据",
|
||||||
"main": "dist/index.cjs.js",
|
"main": "dist/index.cjs.js",
|
||||||
"module": "dist/index.esm.js",
|
"module": "dist/index.esm.mjs",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/index.esm.mjs",
|
||||||
|
"require": "./dist/index.cjs.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
@ -23,16 +29,16 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/youzan/vant.git",
|
"url": "https://github.com/vant-ui/vant.git",
|
||||||
"directory": "packages/vant-area-data"
|
"directory": "packages/vant-area-data"
|
||||||
},
|
},
|
||||||
"bugs": "https://github.com/youzan/vant/issues",
|
"bugs": "https://github.com/vant-ui/vant/issues",
|
||||||
"author": "chenjiahan",
|
"author": "chenjiahan",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "^0.14.29",
|
"esbuild": "^0.14.54",
|
||||||
"release-it": "^14.2.2",
|
"release-it": "^15.4.1",
|
||||||
"typescript": "~4.5.2"
|
"typescript": "^4.8.2"
|
||||||
},
|
},
|
||||||
"release-it": {
|
"release-it": {
|
||||||
"git": {
|
"git": {
|
||||||
|
|||||||
@ -1150,10 +1150,10 @@ export const areaList = {
|
|||||||
232701: '漠河市',
|
232701: '漠河市',
|
||||||
232721: '呼玛县',
|
232721: '呼玛县',
|
||||||
232722: '塔河县',
|
232722: '塔河县',
|
||||||
232790: '松岭区',
|
232761: '加格达奇区',
|
||||||
232791: '呼中区',
|
232762: '松岭区',
|
||||||
232792: '加格达奇区',
|
232763: '新林区',
|
||||||
232793: '新林区',
|
232764: '呼中区',
|
||||||
310101: '黄浦区',
|
310101: '黄浦区',
|
||||||
310104: '徐汇区',
|
310104: '徐汇区',
|
||||||
310105: '长宁区',
|
310105: '长宁区',
|
||||||
|
|||||||
10
packages/vant-cli/LICENSE
Normal file
10
packages/vant-cli/LICENSE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@ -10,7 +10,7 @@ Vant CLI is a tool for building vue component library. You can quickly build a f
|
|||||||
|
|
||||||
- Provides rich commands covering the complete process from development to deploy
|
- Provides rich commands covering the complete process from development to deploy
|
||||||
- Based on conventional directory structure. Generate elegant document website and component examples automatically.
|
- Based on conventional directory structure. Generate elegant document website and component examples automatically.
|
||||||
- ESlint Stylelint built-in.
|
- ESlint built-in.
|
||||||
- Support Tree Shaking/Theme Customization/Import on Demand
|
- Support Tree Shaking/Theme Customization/Import on Demand
|
||||||
|
|
||||||
### Quickstart
|
### Quickstart
|
||||||
@ -47,19 +47,15 @@ Please add the followed config to `package.json` file.
|
|||||||
"release": "vant-cli release",
|
"release": "vant-cli release",
|
||||||
"build-site": "vant-cli build-site"
|
"build-site": "vant-cli build-site"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"nano-staged": {
|
||||||
"*.md": "prettier --write",
|
"*.md": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue,less,scss}": "prettier --write",
|
"*.{ts,tsx,js,vue,less,scss}": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue}": "eslint --fix",
|
"*.{ts,tsx,js,vue}": "eslint --fix"
|
||||||
"*.{vue,css,less,scss}": "stylelint --fix"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
"extends": ["@vant"]
|
"extends": ["@vant"]
|
||||||
},
|
},
|
||||||
"stylelint": {
|
|
||||||
"extends": ["@vant/stylelint-config"]
|
|
||||||
},
|
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"singleQuote": true
|
"singleQuote": true
|
||||||
},
|
},
|
||||||
@ -69,7 +65,7 @@ Please add the followed config to `package.json` file.
|
|||||||
|
|
||||||
## More Details
|
## More Details
|
||||||
|
|
||||||
- [cli](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/commands.md)
|
- [cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/commands.md)
|
||||||
- [config](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/config.md)
|
- [config](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/config.md)
|
||||||
- [directory structure](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/directory.md)
|
- [directory structure](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.md)
|
||||||
- [CHANGELOG](https://github.com/youzan/vant/tree/dev/packages/vant-cli/changelog.md)
|
- [CHANGELOG](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/changelog.md)
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
# Vant CLI
|
# Vant CLI
|
||||||
|
|
||||||
Vant CLI 是一个 Vue 组件库构建工具,通过 Vant CLI 可以快速搭建一套功能完备的 Vue 组件库。
|
Vant CLI 是一个基于 Vite 实现的 Vue 组件库构建工具,通过 Vant CLI 可以快速搭建一套功能完备的 Vue 组件库。
|
||||||
|
|
||||||
### 特性
|
### 特性
|
||||||
|
|
||||||
|
- 基于 Vite 实现,享受愉悦的开发体验
|
||||||
- 提供丰富的命令,涵盖从开发测试到构建发布的完整流程
|
- 提供丰富的命令,涵盖从开发测试到构建发布的完整流程
|
||||||
- 基于约定的目录结构,自动生成优雅的文档站点和组件示例
|
- 基于约定的目录结构,自动生成优雅的文档站点和组件示例
|
||||||
- 内置 ESLint、Stylelint 校验规则,提交代码时自动执行校验
|
- 内置 ESLint 校验规则,提交代码时自动执行校验
|
||||||
- 构建后的组件库默认支持按需引入、主题定制、Tree Shaking
|
- 构建后的组件库默认支持按需引入、主题定制、Tree Shaking
|
||||||
|
|
||||||
### 快速上手
|
### 快速上手
|
||||||
@ -43,19 +44,15 @@ pnpm add @vant/cli -D
|
|||||||
"release": "vant-cli release",
|
"release": "vant-cli release",
|
||||||
"build-site": "vant-cli build-site"
|
"build-site": "vant-cli build-site"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"nano-staged": {
|
||||||
"*.md": "prettier --write",
|
"*.md": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue,less,scss}": "prettier --write",
|
"*.{ts,tsx,js,vue,less,scss}": "prettier --write",
|
||||||
"*.{ts,tsx,js,vue}": "eslint --fix",
|
"*.{ts,tsx,js,vue}": "eslint --fix"
|
||||||
"*.{vue,css,less,scss}": "stylelint --fix"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
"extends": ["@vant"]
|
"extends": ["@vant"]
|
||||||
},
|
},
|
||||||
"stylelint": {
|
|
||||||
"extends": ["@vant/stylelint-config"]
|
|
||||||
},
|
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"singleQuote": true
|
"singleQuote": true
|
||||||
},
|
},
|
||||||
@ -65,7 +62,7 @@ pnpm add @vant/cli -D
|
|||||||
|
|
||||||
## 详细文档
|
## 详细文档
|
||||||
|
|
||||||
- [命令](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/commands.zh-CN.md)
|
- [命令](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/commands.zh-CN.md)
|
||||||
- [配置指南](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/config.zh-CN.md)
|
- [配置指南](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/config.zh-CN.md)
|
||||||
- [目录结构](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/directory.zh-CN.md)
|
- [目录结构](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.zh-CN.md)
|
||||||
- [更新日志](https://github.com/youzan/vant/tree/dev/packages/vant-cli/changelog.md)
|
- [更新日志](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/changelog.md)
|
||||||
|
|||||||
@ -1,5 +1,58 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## v5.0.0 (未发布)
|
||||||
|
|
||||||
|
### 依赖升级
|
||||||
|
|
||||||
|
对以下依赖进行了大版本升级:
|
||||||
|
|
||||||
|
- vite v3
|
||||||
|
- @vitejs/plugin-vue v3
|
||||||
|
- @vitejs/plugin-vue-jsx v2
|
||||||
|
|
||||||
|
### 依赖精简
|
||||||
|
|
||||||
|
- 不再默认安装 `gh-pages` 依赖,请按照如下方式更新 `package.json`:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- "release:site": "pnpm build:site && gh-pages -d site-dist",
|
||||||
|
+ "release:site": "pnpm build:site && npx gh-pages -d site-dist",
|
||||||
|
```
|
||||||
|
|
||||||
|
- 不再默认内置 `stylelint`,需要的话可以自行安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn add stylelint@13 @vant/stylelint-config
|
||||||
|
```
|
||||||
|
|
||||||
|
### 移除 vetur 相关配置
|
||||||
|
|
||||||
|
由于 Vue 3 推荐使用 volar 而不是 vetur,因此移除了 vetur 相关的配置文件。
|
||||||
|
|
||||||
|
现在会默认生成 WebStorm 所需的 web-types.json 文件到 `lib/web-types.json` 目录下。
|
||||||
|
|
||||||
|
## v4.0.4
|
||||||
|
|
||||||
|
`2022-07-02`
|
||||||
|
|
||||||
|
- 修复构建 sfc 文件的类型定义时报错的问题
|
||||||
|
|
||||||
|
## v4.0.3
|
||||||
|
|
||||||
|
`2022-07-02`
|
||||||
|
|
||||||
|
- 新增 `build.bundleOptions` 配置项
|
||||||
|
- 新增 `css.removeSourceFile` 配置项
|
||||||
|
- 修复编译后的 script setup 中,引用的组件不生效的问题
|
||||||
|
- 移除未使用的 esm bundle
|
||||||
|
- 移除未使用的 ssr.js 文件
|
||||||
|
|
||||||
|
## v4.0.2
|
||||||
|
|
||||||
|
`2022-05-14`
|
||||||
|
|
||||||
|
- 修复编译 script setup 错误的问题
|
||||||
|
|
||||||
## v4.0.1
|
## v4.0.1
|
||||||
|
|
||||||
`2022-03-03`
|
`2022-03-03`
|
||||||
@ -390,15 +443,15 @@ yarn add sass
|
|||||||
|
|
||||||
`2020-03-29`
|
`2020-03-29`
|
||||||
|
|
||||||
- 优化网站导航栏在大屏上的适配 ([#5928](https://github.com/youzan/vant/pull/5928))
|
- 优化网站导航栏在大屏上的适配 ([#5928](https://github.com/vant-ui/vant/pull/5928))
|
||||||
|
|
||||||
### v2.3.0
|
### v2.3.0
|
||||||
|
|
||||||
`2020-03-25`
|
`2020-03-25`
|
||||||
|
|
||||||
- build 命令支持编译 scoped 样式 ([#5910](https://github.com/youzan/vant/pull/5910))
|
- build 命令支持编译 scoped 样式 ([#5910](https://github.com/vant-ui/vant/pull/5910))
|
||||||
- build 命令支持生成 WebStorm 组件定义文件 ([#5899](https://github.com/youzan/vant/issues/5899))
|
- build 命令支持生成 WebStorm 组件定义文件 ([#5899](https://github.com/vant-ui/vant/issues/5899))
|
||||||
- clean 命令现在会移除而不是清空文件夹 ([#5895](https://github.com/youzan/vant/issues/5895))
|
- clean 命令现在会移除而不是清空文件夹 ([#5895](https://github.com/vant-ui/vant/issues/5895))
|
||||||
- 升级 @vant/markdown-vetur 2.0.0
|
- 升级 @vant/markdown-vetur 2.0.0
|
||||||
|
|
||||||
### v2.2.8
|
### v2.2.8
|
||||||
@ -432,7 +485,7 @@ yarn add sass
|
|||||||
|
|
||||||
`2020-02-14`
|
`2020-02-14`
|
||||||
|
|
||||||
- 修复在 windows 上构建出的样式入口文件路径错误的问题 ([#5655](https://github.com/youzan/vant/pull/5655)
|
- 修复在 windows 上构建出的样式入口文件路径错误的问题 ([#5655](https://github.com/vant-ui/vant/pull/5655)
|
||||||
|
|
||||||
### v2.2.3
|
### v2.2.3
|
||||||
|
|
||||||
@ -444,14 +497,14 @@ yarn add sass
|
|||||||
|
|
||||||
`2020-02-05`
|
`2020-02-05`
|
||||||
|
|
||||||
- 修复在 windows 上获取 markdown 路径错误的问题 ([#5626](https://github.com/youzan/vant/pull/5626))
|
- 修复在 windows 上获取 markdown 路径错误的问题 ([#5626](https://github.com/vant-ui/vant/pull/5626))
|
||||||
|
|
||||||
### v2.2.1
|
### v2.2.1
|
||||||
|
|
||||||
`2020-02-04`
|
`2020-02-04`
|
||||||
|
|
||||||
- 升级 babel@7.8
|
- 升级 babel@7.8
|
||||||
- 修复切换版本时跳转 undefined 的问题 ([#5620](https://github.com/youzan/vant/pull/5620))
|
- 修复切换版本时跳转 undefined 的问题 ([#5620](https://github.com/vant-ui/vant/pull/5620))
|
||||||
|
|
||||||
### v2.2.0
|
### v2.2.0
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Start local dev server for browsering components and demo.
|
|||||||
|
|
||||||
Build Vue component library.
|
Build Vue component library.
|
||||||
|
|
||||||
Files will be output to `es` and `lib` directory. More details [directory structure](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/directory.md)
|
Files will be output to `es` and `lib` directory. More details [directory structure](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.md)
|
||||||
|
|
||||||
Please add the followed config to `package.json` when publish to npm.
|
Please add the followed config to `package.json` when publish to npm.
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ npx vant-cli dev
|
|||||||
|
|
||||||
构建组件库。
|
构建组件库。
|
||||||
|
|
||||||
运行 build 命令会在 `es` 和 `lib` 目录下生成可用于生产环境的组件代码,详见 [目录结构](https://github.com/youzan/vant/tree/dev/packages/vant-cli/docs/directory.zh-CN.md)。
|
运行 build 命令会在 `es` 和 `lib` 目录下生成可用于生产环境的组件代码,详见 [目录结构](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli/docs/directory.zh-CN.md)。
|
||||||
|
|
||||||
发布 npm 时,请将以下配置加入到 `package.json` 中,使 npm 包能被正确识别:
|
发布 npm 时,请将以下配置加入到 `package.json` 中,使 npm 包能被正确识别:
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ export default {
|
|||||||
// title
|
// title
|
||||||
title: 'Demo UI',
|
title: 'Demo UI',
|
||||||
// logo
|
// logo
|
||||||
logo: 'https://cdn.jsdelivr.net/npm/@vant/assets/logo.png',
|
logo: 'https://fastly.jsdelivr.net/npm/@vant/assets/logo.png',
|
||||||
// description
|
// description
|
||||||
description: '示例组件库',
|
description: '示例组件库',
|
||||||
// left nav
|
// left nav
|
||||||
@ -103,7 +103,7 @@ module.exports = {
|
|||||||
- Type: `string`
|
- Type: `string`
|
||||||
- Default: `'less'`
|
- Default: `'less'`
|
||||||
|
|
||||||
CSS preprocess Config, support `less` and `sass`. Use `less` by default.
|
CSS preprocessor config, support `less` and `sass`. Use `less` by default.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -115,6 +115,23 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### build.css.removeSourceFile
|
||||||
|
|
||||||
|
- Type: `boolean`
|
||||||
|
- Default: `'false'`
|
||||||
|
|
||||||
|
Whether to remove the source style files after build.
|
||||||
|
|
||||||
|
```js
|
||||||
|
module.exports = {
|
||||||
|
build: {
|
||||||
|
css: {
|
||||||
|
removeSourceFile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
### build.site.publicPath
|
### build.site.publicPath
|
||||||
|
|
||||||
- Type: `string`
|
- Type: `string`
|
||||||
@ -204,6 +221,45 @@ module.exports = {
|
|||||||
|
|
||||||
`npm` package manager.
|
`npm` package manager.
|
||||||
|
|
||||||
|
### build.bundleOptions
|
||||||
|
|
||||||
|
- Type: `BundleOptions[]`
|
||||||
|
|
||||||
|
Specify the format of the bundled output.
|
||||||
|
|
||||||
|
The type of `BundleOptions`:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
type BundleOption = {
|
||||||
|
// Whether to minify code (Tips: es format output can't be minified by vite)
|
||||||
|
minify?: boolean;
|
||||||
|
// Formats, can be set to 'es' | 'cjs' | 'umd' | 'iife'
|
||||||
|
formats: LibraryFormats[];
|
||||||
|
// Dependencies to external (Vue is externaled by default)
|
||||||
|
external?: string[];
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Default value:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const DEFAULT_OPTIONS: BundleOption[] = [
|
||||||
|
{
|
||||||
|
minify: false,
|
||||||
|
formats: ['umd'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
minify: true,
|
||||||
|
formats: ['umd'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
minify: false,
|
||||||
|
formats: ['es', 'cjs'],
|
||||||
|
external: allDependencies,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
### site.title
|
### site.title
|
||||||
|
|
||||||
- Type: `string`
|
- Type: `string`
|
||||||
@ -269,7 +325,7 @@ module.exports = {
|
|||||||
versions: [
|
versions: [
|
||||||
{
|
{
|
||||||
label: 'v1',
|
label: 'v1',
|
||||||
link: 'https://youzan.github.io/vant/v1/',
|
link: 'https://vant-ui.github.io/vant/v1/',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -324,12 +380,19 @@ Customize iframe URL.
|
|||||||
|
|
||||||
Customize HTML meta tag, key means name, value means content.
|
Customize HTML meta tag, key means name, value means content.
|
||||||
|
|
||||||
|
### site.headHtml
|
||||||
|
|
||||||
|
- Type: `string`
|
||||||
|
- Default: `undefined`
|
||||||
|
|
||||||
|
Insert a custom HTML content in the `<head>` tag.
|
||||||
|
|
||||||
### site.enableVConsole
|
### site.enableVConsole
|
||||||
|
|
||||||
- Type: `boolean`
|
- Type: `boolean`
|
||||||
- Default: `false`
|
- Default: `false`
|
||||||
|
|
||||||
Should use [vConsole](https://github.com/Tencent/vConsole) to debug when dev. For mobile.
|
Whether to enable [vConsole](https://github.com/Tencent/vConsole) debugging in dev, usually used for mobile debugging.
|
||||||
|
|
||||||
## PostCSS
|
## PostCSS
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ export default {
|
|||||||
// 标题
|
// 标题
|
||||||
title: 'Demo UI',
|
title: 'Demo UI',
|
||||||
// 图标
|
// 图标
|
||||||
logo: 'https://cdn.jsdelivr.net/npm/@vant/assets/logo.png',
|
logo: 'https://fastly.jsdelivr.net/npm/@vant/assets/logo.png',
|
||||||
// 描述
|
// 描述
|
||||||
description: '示例组件库',
|
description: '示例组件库',
|
||||||
// 左侧导航
|
// 左侧导航
|
||||||
@ -115,6 +115,23 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### build.css.removeSourceFile
|
||||||
|
|
||||||
|
- Type: `boolean`
|
||||||
|
- Default: `'false'`
|
||||||
|
|
||||||
|
是否在构建后移除样式文件的源代码。
|
||||||
|
|
||||||
|
```js
|
||||||
|
module.exports = {
|
||||||
|
build: {
|
||||||
|
css: {
|
||||||
|
removeSourceFile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
### build.site.publicPath
|
### build.site.publicPath
|
||||||
|
|
||||||
- Type: `string`
|
- Type: `string`
|
||||||
@ -206,6 +223,45 @@ module.exports = {
|
|||||||
|
|
||||||
指定使用的包管理器。
|
指定使用的包管理器。
|
||||||
|
|
||||||
|
### build.bundleOptions
|
||||||
|
|
||||||
|
- Type: `BundleOptions[]`
|
||||||
|
|
||||||
|
指定打包后产物的格式。
|
||||||
|
|
||||||
|
产物格式由三个配置项控制:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
type BundleOption = {
|
||||||
|
// 是否压缩代码(注意 es 产物无法被 vite 压缩)
|
||||||
|
minify?: boolean;
|
||||||
|
// 产物类型,可选值为 'es' | 'cjs' | 'umd' | 'iife'
|
||||||
|
formats: LibraryFormats[];
|
||||||
|
// 需要 external 的依赖(Vue 默认会被 external)
|
||||||
|
external?: string[];
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
该选项的默认值为:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const DEFAULT_OPTIONS: BundleOption[] = [
|
||||||
|
{
|
||||||
|
minify: false,
|
||||||
|
formats: ['umd'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
minify: true,
|
||||||
|
formats: ['umd'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
minify: false,
|
||||||
|
formats: ['es', 'cjs'],
|
||||||
|
external: allDependencies,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
### site.title
|
### site.title
|
||||||
|
|
||||||
- Type: `string`
|
- Type: `string`
|
||||||
@ -271,7 +327,7 @@ module.exports = {
|
|||||||
versions: [
|
versions: [
|
||||||
{
|
{
|
||||||
label: 'v1',
|
label: 'v1',
|
||||||
link: 'https://youzan.github.io/vant/v1/',
|
link: 'https://vant-ui.github.io/vant/v1/',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -281,7 +337,7 @@ module.exports = {
|
|||||||
### site.baiduAnalytics
|
### site.baiduAnalytics
|
||||||
|
|
||||||
- Type: `object`
|
- Type: `object`
|
||||||
- Default: `undefied`
|
- Default: `undefined`
|
||||||
|
|
||||||
文档网站的百度统计配置,添加这项配置后,会自动在构建文档网站时加载百度统计的脚本。
|
文档网站的百度统计配置,添加这项配置后,会自动在构建文档网站时加载百度统计的脚本。
|
||||||
|
|
||||||
@ -328,6 +384,13 @@ module.exports = {
|
|||||||
|
|
||||||
配置 HTML 中的 meta 标签,对象的 key 为 name,value 为 content。
|
配置 HTML 中的 meta 标签,对象的 key 为 name,value 为 content。
|
||||||
|
|
||||||
|
### site.headHtml
|
||||||
|
|
||||||
|
- Type: `string`
|
||||||
|
- Default: `undefined`
|
||||||
|
|
||||||
|
在 `<head>` 标签中插入一段自定义的 HTML 内容。
|
||||||
|
|
||||||
### site.enableVConsole
|
### site.enableVConsole
|
||||||
|
|
||||||
- Type: `boolean`
|
- Type: `boolean`
|
||||||
|
|||||||
@ -42,7 +42,7 @@ button
|
|||||||
└─ README.md # component doc
|
└─ README.md # component doc
|
||||||
```
|
```
|
||||||
|
|
||||||
When using this directory structure, the developer of the component library needs to import the JS and CSS files respectively, and the styles can also be imported automatically through babel-plugin-import.
|
When using this directory structure, the developer of the component library needs to import the JS and CSS files respectively.
|
||||||
|
|
||||||
Theme customization can be achieved by importing style source files (less or scss) and modifying style variables.
|
Theme customization can be achieved by importing style source files (less or scss) and modifying style variables.
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ button
|
|||||||
└─ README.md # 组件文档
|
└─ README.md # 组件文档
|
||||||
```
|
```
|
||||||
|
|
||||||
采用这种目录结构时,组件的使用者需要分别引入 JS 和 CSS 文件,也可以通过 babel-plugin-import 自动引入样式。
|
采用这种目录结构时,组件的使用者需要分别引入 JS 和 CSS 文件。
|
||||||
|
|
||||||
通过引入样式源文件(less 或 scss)并修改样式变量,可以实现主题定制功能。
|
通过引入样式源文件(less 或 scss)并修改样式变量,可以实现主题定制功能。
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vant/cli",
|
"name": "@vant/cli",
|
||||||
"version": "4.0.1",
|
"version": "4.0.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
@ -32,64 +32,63 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/youzan/vant.git",
|
"url": "https://github.com/vant-ui/vant.git",
|
||||||
"directory": "packages/vant-cli"
|
"directory": "packages/vant-cli"
|
||||||
},
|
},
|
||||||
"bugs": "https://github.com/youzan/vant/issues",
|
"bugs": "https://github.com/vant-ui/vant/issues",
|
||||||
"author": "chenjiahan",
|
"author": "chenjiahan",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@jest/types": "^27.5.1",
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/less": "^3.0.3",
|
"@types/less": "^3.0.3",
|
||||||
"@types/markdown-it": "^12.2.3",
|
"@types/markdown-it": "^12.2.3",
|
||||||
"vue": "^3.2.27"
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"vue": "^3.2.38"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.16.0",
|
"@babel/core": "^7.18.13",
|
||||||
"@babel/preset-typescript": "^7.16.0",
|
"@babel/preset-typescript": "^7.18.6",
|
||||||
"@docsearch/css": "^3.0.0",
|
"@docsearch/css": "^3.2.1",
|
||||||
"@docsearch/js": "^3.0.0",
|
"@docsearch/js": "^3.2.1",
|
||||||
"@types/jest": "^27.0.3",
|
"@types/jest": "^27.5.2",
|
||||||
"@vant/eslint-config": "^3.3.2",
|
"@vant/eslint-config": "^3.5.0",
|
||||||
"@vant/markdown-vetur": "^2.3.0",
|
"@vant/touch-emulator": "^1.4.0",
|
||||||
"@vant/stylelint-config": "^1.4.2",
|
"@vitejs/plugin-vue": "^3.0.3",
|
||||||
"@vant/touch-emulator": "^1.3.2",
|
"@vitejs/plugin-vue-jsx": "^2.0.1",
|
||||||
"@vitejs/plugin-vue": "^2.0.0",
|
|
||||||
"@vitejs/plugin-vue-jsx": "^1.3.3",
|
|
||||||
"@vue/babel-plugin-jsx": "^1.1.1",
|
"@vue/babel-plugin-jsx": "^1.1.1",
|
||||||
"autoprefixer": "^10.4.0",
|
"autoprefixer": "^10.4.8",
|
||||||
"chalk": "^4.1.2",
|
"commander": "^9.4.0",
|
||||||
"commander": "^8.3.0",
|
|
||||||
"consola": "^2.15.3",
|
"consola": "^2.15.3",
|
||||||
"conventional-changelog": "^3.1.24",
|
"conventional-changelog": "^3.1.25",
|
||||||
"esbuild": "^0.14.29",
|
"esbuild": "^0.14.54",
|
||||||
"eslint": "^8.1.0",
|
"eslint": "^8.23.0",
|
||||||
"execa": "^5.1.1",
|
"execa": "^5.1.1",
|
||||||
"fast-glob": "^3.2.7",
|
"fast-glob": "^3.2.11",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.1.0",
|
||||||
"gh-pages": "^3.2.3",
|
|
||||||
"hash-sum": "^2.0.0",
|
"hash-sum": "^2.0.0",
|
||||||
"highlight.js": "^11.3.1",
|
"highlight.js": "^11.6.0",
|
||||||
"husky": "^7.0.4",
|
"husky": "^8.0.1",
|
||||||
"jest": "^27.3.1",
|
"jest": "^27.5.1",
|
||||||
"jest-canvas-mock": "^2.3.1",
|
"jest-canvas-mock": "^2.4.0",
|
||||||
"jest-serializer-html": "^7.1.0",
|
"jest-serializer-html": "^7.1.0",
|
||||||
"less": "^4.1.2",
|
"less": "^4.1.3",
|
||||||
"lint-staged": "^12.1.2",
|
"markdown-it": "^12.3.2",
|
||||||
"markdown-it": "^12.2.0",
|
"markdown-it-anchor": "^8.6.4",
|
||||||
"markdown-it-anchor": "^8.4.1",
|
"nano-staged": "^0.8.0",
|
||||||
"ora": "^6.0.1",
|
"nanospinner": "^1.1.0",
|
||||||
"postcss": "^8.3.11",
|
"picocolors": "^1.0.0",
|
||||||
"postcss-load-config": "^3.1.0",
|
"postcss": "^8.4.16",
|
||||||
"prettier": "^2.5.0",
|
"postcss-load-config": "^3.1.4",
|
||||||
"release-it": "^14.11.6",
|
"prettier": "^2.7.1",
|
||||||
"stylelint": "^13.0.0",
|
"release-it": "^15.4.1",
|
||||||
"transliteration": "^2.2.0",
|
"transliteration": "^2.3.5",
|
||||||
"typescript": "^4.5.2",
|
"typescript": "^4.8.2",
|
||||||
"vite": "^2.9.0",
|
"vite": "^3.0.9",
|
||||||
"vite-plugin-html": "^2.1.1",
|
"vite-plugin-html": "^2.1.2",
|
||||||
"vite-plugin-md": "^0.11.4",
|
"vite-plugin-md": "^0.11.9",
|
||||||
"vue-router": "^4.0.12"
|
"vue-router": "^4.1.5"
|
||||||
},
|
},
|
||||||
"release-it": {
|
"release-it": {
|
||||||
"git": {
|
"git": {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
@import './vars.less';
|
@import './vars.less';
|
||||||
@import './font.less';
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
min-width: 1100px;
|
min-width: 1100px;
|
||||||
|
|||||||
@ -1,163 +0,0 @@
|
|||||||
/* cyrillic-ext */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFWJ0bf8pkAp6a.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
|
||||||
U+FE2E-FE2F;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* cyrillic */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFUZ0bf8pkAp6a.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* greek-ext */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFWZ0bf8pkAp6a.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+1F00-1FFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* greek */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFVp0bf8pkAp6a.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0370-03FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vietnamese */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFWp0bf8pkAp6a.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
|
|
||||||
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFW50bf8pkAp6a.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
|
||||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* latin */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans Regular'), local('OpenSans-Regular'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem8YaGs126MiZpBA-UFVZ0bf8pkAg.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
|
||||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
|
||||||
U+FEFF, U+FFFD;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* cyrillic-ext */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOX-hpKKSTj5PW.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
|
||||||
U+FE2E-FE2F;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* cyrillic */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOVuhpKKSTj5PW.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* greek-ext */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOXuhpKKSTj5PW.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+1F00-1FFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* greek */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOUehpKKSTj5PW.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0370-03FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vietnamese */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOXehpKKSTj5PW.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
|
|
||||||
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* latin-ext */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOXOhpKKSTj5PW.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
|
||||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* latin */
|
|
||||||
@font-face {
|
|
||||||
font-weight: 600;
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
font-style: normal;
|
|
||||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
|
|
||||||
url(https://b.yzcdn.cn/vant/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2)
|
|
||||||
format('woff2');
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
|
||||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
|
||||||
U+FEFF, U+FFFD;
|
|
||||||
}
|
|
||||||
@ -87,6 +87,7 @@ export default {
|
|||||||
padding: 24px;
|
padding: 24px;
|
||||||
background-color: var(--van-doc-background-2);
|
background-color: var(--van-doc-background-2);
|
||||||
border-radius: var(--van-doc-border-radius);
|
border-radius: var(--van-doc-border-radius);
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
> pre code {
|
> pre code {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -3,9 +3,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import '@docsearch/css';
|
|
||||||
import docsearch from '@docsearch/js';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'VanDocSearch',
|
name: 'VanDocSearch',
|
||||||
|
|
||||||
@ -27,9 +24,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initDocsearch() {
|
initDocsearch() {
|
||||||
if (this.searchConfig) {
|
if (this.searchConfig) {
|
||||||
docsearch({
|
import('@docsearch/css');
|
||||||
...this.searchConfig,
|
import('@docsearch/js').then((docsearch) => {
|
||||||
container: '#docsearch',
|
docsearch.default({
|
||||||
|
...this.searchConfig,
|
||||||
|
container: '#docsearch',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
<meta http-equiv="Cache-Control" content="no-cache" />
|
<meta http-equiv="Cache-Control" content="no-cache" />
|
||||||
<meta http-equiv="Pragma" content="no-cache" />
|
<meta http-equiv="Pragma" content="no-cache" />
|
||||||
<meta http-equiv="Expires" content="0" />
|
<meta http-equiv="Expires" content="0" />
|
||||||
|
<% if (headHtml) { %>
|
||||||
|
<%- headHtml %>
|
||||||
|
<% } %>
|
||||||
<% if (baiduAnalytics) { %>
|
<% if (baiduAnalytics) { %>
|
||||||
<script>
|
<script>
|
||||||
var _hmt = _hmt || [];
|
var _hmt = _hmt || [];
|
||||||
@ -27,7 +30,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
</head>
|
</head>
|
||||||
<body ontouchstart>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/desktop/main.js"></script>
|
<script type="module" src="/desktop/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
<meta http-equiv="Cache-Control" content="no-cache" />
|
<meta http-equiv="Cache-Control" content="no-cache" />
|
||||||
<meta http-equiv="Pragma" content="no-cache" />
|
<meta http-equiv="Pragma" content="no-cache" />
|
||||||
<meta http-equiv="Expires" content="0" />
|
<meta http-equiv="Expires" content="0" />
|
||||||
|
<% if (headHtml) { %>
|
||||||
|
<%- headHtml %>
|
||||||
|
<% } %>
|
||||||
<% if (enableVConsole) { %>
|
<% if (enableVConsole) { %>
|
||||||
<script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
|
<script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
@ -36,7 +39,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
</head>
|
</head>
|
||||||
<body ontouchstart>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/mobile/main.js"></script>
|
<script type="module" src="/mobile/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -13,3 +13,8 @@ window.app = createApp(App)
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.app.mount('#app');
|
window.app.mount('#app');
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari/33681490#33681490
|
||||||
|
document.addEventListener('touchstart', () => {}, {
|
||||||
|
passive: true,
|
||||||
|
});
|
||||||
|
|||||||
@ -1,25 +1,26 @@
|
|||||||
import { Command } from 'commander';
|
import { Command } from 'commander';
|
||||||
|
|
||||||
import {
|
import { cliVersion } from './index.js';
|
||||||
dev,
|
|
||||||
lint,
|
|
||||||
test,
|
|
||||||
clean,
|
|
||||||
build,
|
|
||||||
release,
|
|
||||||
changelog,
|
|
||||||
buildSite,
|
|
||||||
commitLint,
|
|
||||||
cliVersion,
|
|
||||||
} from './index.js';
|
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
program.version(`@vant/cli ${cliVersion}`);
|
program.version(`@vant/cli ${cliVersion}`);
|
||||||
|
|
||||||
program.command('dev').description('Run dev server').action(dev);
|
program
|
||||||
|
.command('dev')
|
||||||
|
.description('Run dev server')
|
||||||
|
.action(async () => {
|
||||||
|
const { dev } = await import('./commands/dev.js');
|
||||||
|
return dev();
|
||||||
|
});
|
||||||
|
|
||||||
program.command('lint').description('Run eslint and stylelint').action(lint);
|
program
|
||||||
|
.command('lint')
|
||||||
|
.description('Run ESLint')
|
||||||
|
.action(async () => {
|
||||||
|
const { lint } = await import('./commands/lint.js');
|
||||||
|
return lint();
|
||||||
|
});
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('test')
|
.command('test')
|
||||||
@ -45,34 +46,58 @@ program
|
|||||||
'Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests'
|
'Run all tests serially in the current process, rather than creating a worker pool of child processes that run tests'
|
||||||
)
|
)
|
||||||
.option('--debug', 'Print debugging info about your Jest config')
|
.option('--debug', 'Print debugging info about your Jest config')
|
||||||
.action(test);
|
.action(async (options) => {
|
||||||
|
const { test } = await import('./commands/jest.js');
|
||||||
|
return test(options);
|
||||||
|
});
|
||||||
|
|
||||||
program.command('clean').description('Clean all dist files').action(clean);
|
program
|
||||||
|
.command('clean')
|
||||||
|
.description('Clean all dist files')
|
||||||
|
.action(async () => {
|
||||||
|
const { clean } = await import('./commands/clean.js');
|
||||||
|
return clean();
|
||||||
|
});
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('build')
|
.command('build')
|
||||||
.description('Compile components in production mode')
|
.description('Compile components in production mode')
|
||||||
.action(build);
|
.action(async () => {
|
||||||
|
const { build } = await import('./commands/build.js');
|
||||||
|
return build();
|
||||||
|
});
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('release')
|
.command('release')
|
||||||
.description('Compile components and release it')
|
.description('Compile components and release it')
|
||||||
.option('--tag <tag>', 'Release tag')
|
.option('--tag <tag>', 'Release tag')
|
||||||
.action(release);
|
.action(async (options) => {
|
||||||
|
const { release } = await import('./commands/release.js');
|
||||||
|
return release(options);
|
||||||
|
});
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('build-site')
|
.command('build-site')
|
||||||
.description('Compile site in production mode')
|
.description('Compile site in production mode')
|
||||||
.action(buildSite);
|
.action(async () => {
|
||||||
|
const { buildSite } = await import('./commands/build-site.js');
|
||||||
|
return buildSite();
|
||||||
|
});
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('changelog')
|
.command('changelog')
|
||||||
.description('Generate changelog')
|
.description('Generate changelog')
|
||||||
.action(changelog);
|
.action(async () => {
|
||||||
|
const { changelog } = await import('./commands/changelog.js');
|
||||||
|
return changelog();
|
||||||
|
});
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('commit-lint <gitParams>')
|
.command('commit-lint <gitParams>')
|
||||||
.description('Lint commit message')
|
.description('Lint commit message')
|
||||||
.action(commitLint);
|
.action(async (gitParams) => {
|
||||||
|
const { commitLint } = await import('./commands/commit-lint.js');
|
||||||
|
return commitLint(gitParams);
|
||||||
|
});
|
||||||
|
|
||||||
program.parse();
|
program.parse();
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import execa from 'execa';
|
|||||||
import { join, relative } from 'path';
|
import { join, relative } from 'path';
|
||||||
import { clean } from './clean.js';
|
import { clean } from './clean.js';
|
||||||
import { CSS_LANG } from '../common/css.js';
|
import { CSS_LANG } from '../common/css.js';
|
||||||
import { ora, consola } from '../common/logger.js';
|
import { createSpinner, consola } from '../common/logger.js';
|
||||||
import { installDependencies } from '../common/manager.js';
|
import { installDependencies } from '../common/manager.js';
|
||||||
import { compileSfc } from '../compiler/compile-sfc.js';
|
import { compileSfc } from '../compiler/compile-sfc.js';
|
||||||
import { compileStyle } from '../compiler/compile-style.js';
|
import { compileStyle } from '../compiler/compile-style.js';
|
||||||
@ -12,9 +12,9 @@ import { compileBundles } from '../compiler/compile-bundles.js';
|
|||||||
import { genPackageEntry } from '../compiler/gen-package-entry.js';
|
import { genPackageEntry } from '../compiler/gen-package-entry.js';
|
||||||
import { genStyleDepsMap } from '../compiler/gen-style-deps-map.js';
|
import { genStyleDepsMap } from '../compiler/gen-style-deps-map.js';
|
||||||
import { genComponentStyle } from '../compiler/gen-component-style.js';
|
import { genComponentStyle } from '../compiler/gen-component-style.js';
|
||||||
import { SRC_DIR, LIB_DIR, ES_DIR } from '../common/constant.js';
|
import { SRC_DIR, LIB_DIR, ES_DIR, getVantConfig } from '../common/constant.js';
|
||||||
import { genPackageStyle } from '../compiler/gen-package-style.js';
|
import { genPackageStyle } from '../compiler/gen-package-style.js';
|
||||||
import { genVeturConfig } from '../compiler/gen-vetur-config.js';
|
import { genWebStormTypes } from '../compiler/web-types/index.js';
|
||||||
import {
|
import {
|
||||||
isDir,
|
isDir,
|
||||||
isSfc,
|
isSfc,
|
||||||
@ -135,9 +135,10 @@ async function buildPackageStyleEntry() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function buildBundledOutputs() {
|
async function buildBundledOutputs() {
|
||||||
|
const config = getVantConfig();
|
||||||
setModuleEnv('esmodule');
|
setModuleEnv('esmodule');
|
||||||
await compileBundles();
|
await compileBundles();
|
||||||
genVeturConfig();
|
genWebStormTypes(config.build?.tagPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tasks = [
|
const tasks = [
|
||||||
@ -178,14 +179,14 @@ const tasks = [
|
|||||||
async function runBuildTasks() {
|
async function runBuildTasks() {
|
||||||
for (let i = 0; i < tasks.length; i++) {
|
for (let i = 0; i < tasks.length; i++) {
|
||||||
const { task, text } = tasks[i];
|
const { task, text } = tasks[i];
|
||||||
const spinner = ora(text).start();
|
const spinner = createSpinner(text).start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/* eslint-disable no-await-in-loop */
|
/* eslint-disable no-await-in-loop */
|
||||||
await task();
|
await task();
|
||||||
spinner.succeed(text);
|
spinner.success({ text });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
spinner.fail(text);
|
spinner.error({ text });
|
||||||
console.log(err);
|
console.log(err);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { join, dirname } from 'path';
|
import { join, dirname } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { ROOT } from '../common/constant.js';
|
import { ROOT } from '../common/constant.js';
|
||||||
import { ora, slimPath } from '../common/logger.js';
|
import { createSpinner, slimPath } from '../common/logger.js';
|
||||||
import { createWriteStream, readFileSync } from 'fs';
|
import { createWriteStream, readFileSync } from 'fs';
|
||||||
import conventionalChangelog from 'conventional-changelog';
|
import conventionalChangelog from 'conventional-changelog';
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ function transform(item: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function changelog(): Promise<void> {
|
export async function changelog(): Promise<void> {
|
||||||
const spinner = ora('Generating changelog...').start();
|
const spinner = createSpinner('Generating changelog...').start();
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
conventionalChangelog(
|
conventionalChangelog(
|
||||||
@ -68,7 +68,9 @@ export async function changelog(): Promise<void> {
|
|||||||
)
|
)
|
||||||
.pipe(createWriteStream(DIST_FILE))
|
.pipe(createWriteStream(DIST_FILE))
|
||||||
.on('close', () => {
|
.on('close', () => {
|
||||||
spinner.succeed(`Changelog generated at ${slimPath(DIST_FILE)}`);
|
spinner.success({
|
||||||
|
text: `Changelog generated at ${slimPath(DIST_FILE)}`,
|
||||||
|
});
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import {
|
|||||||
ES_DIR,
|
ES_DIR,
|
||||||
LIB_DIR,
|
LIB_DIR,
|
||||||
DIST_DIR,
|
DIST_DIR,
|
||||||
VETUR_DIR,
|
|
||||||
SITE_DIST_DIR,
|
SITE_DIST_DIR,
|
||||||
} from '../common/constant.js';
|
} from '../common/constant.js';
|
||||||
|
|
||||||
@ -14,7 +13,6 @@ export async function clean() {
|
|||||||
remove(ES_DIR),
|
remove(ES_DIR),
|
||||||
remove(LIB_DIR),
|
remove(LIB_DIR),
|
||||||
remove(DIST_DIR),
|
remove(DIST_DIR),
|
||||||
remove(VETUR_DIR),
|
|
||||||
remove(SITE_DIST_DIR),
|
remove(SITE_DIST_DIR),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import execa from 'execa';
|
import execa from 'execa';
|
||||||
import { consola, ora } from '../common/logger.js';
|
import { consola, createSpinner } from '../common/logger.js';
|
||||||
import { SCRIPT_EXTS } from '../common/constant.js';
|
import { SCRIPT_EXTS } from '../common/constant.js';
|
||||||
|
|
||||||
type RunCommandMessages = {
|
type RunCommandMessages = {
|
||||||
@ -13,7 +13,7 @@ function runCommand(
|
|||||||
options: string[],
|
options: string[],
|
||||||
messages: RunCommandMessages
|
messages: RunCommandMessages
|
||||||
) {
|
) {
|
||||||
const spinner = ora(messages.start).start();
|
const spinner = createSpinner(messages.start).start();
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
execa(cmd, options, {
|
execa(cmd, options, {
|
||||||
@ -21,11 +21,11 @@ function runCommand(
|
|||||||
env: { FORCE_COLOR: true },
|
env: { FORCE_COLOR: true },
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
spinner.succeed(messages.succeed);
|
spinner.success({ text: messages.succeed });
|
||||||
resolve(true);
|
resolve(true);
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
spinner.fail(messages.failed);
|
spinner.error({ text: messages.failed });
|
||||||
consola.error(err.stderr || err.stdout);
|
consola.error(err.stderr || err.stdout);
|
||||||
resolve(false);
|
resolve(false);
|
||||||
});
|
});
|
||||||
@ -44,23 +44,10 @@ function eslint() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stylelint() {
|
|
||||||
return runCommand(
|
|
||||||
'stylelint',
|
|
||||||
['src/**/*.css', 'src/**/*.vue', 'src/**/*.less', 'src/**/*.sass', '--fix'],
|
|
||||||
{
|
|
||||||
start: 'Running stylelint...',
|
|
||||||
succeed: 'Stylelint Passed.',
|
|
||||||
failed: 'Stylelint failed!',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function lint() {
|
export async function lint() {
|
||||||
const eslintPassed = await eslint();
|
const eslintPassed = await eslint();
|
||||||
const stylelintPassed = await stylelint();
|
|
||||||
|
|
||||||
if (!eslintPassed || !stylelintPassed) {
|
if (!eslintPassed) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { join, dirname } from 'path';
|
|||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
const PLUGIN_PATH = join(__dirname, '../../cjs/vant-cli-release-plugin.cjs');
|
const PLUGIN_PATH = join(__dirname, '../compiler/vant-cli-release-plugin.js');
|
||||||
|
|
||||||
export async function release(command: { tag?: string }) {
|
export async function release(command: { tag?: string }) {
|
||||||
await releaseIt({
|
await releaseIt({
|
||||||
|
|||||||
@ -21,7 +21,6 @@ export const ROOT = findRootDir(CWD);
|
|||||||
export const ES_DIR = join(ROOT, 'es');
|
export const ES_DIR = join(ROOT, 'es');
|
||||||
export const LIB_DIR = join(ROOT, 'lib');
|
export const LIB_DIR = join(ROOT, 'lib');
|
||||||
export const DOCS_DIR = join(ROOT, 'docs');
|
export const DOCS_DIR = join(ROOT, 'docs');
|
||||||
export const VETUR_DIR = join(ROOT, 'vetur');
|
|
||||||
export const SITE_DIST_DIR = join(ROOT, 'site-dist');
|
export const SITE_DIST_DIR = join(ROOT, 'site-dist');
|
||||||
export const VANT_CONFIG_FILE = join(ROOT, 'vant.config.mjs');
|
export const VANT_CONFIG_FILE = join(ROOT, 'vant.config.mjs');
|
||||||
export const PACKAGE_JSON_FILE = join(ROOT, 'package.json');
|
export const PACKAGE_JSON_FILE = join(ROOT, 'package.json');
|
||||||
@ -43,7 +42,15 @@ export const STYLE_DEPS_JSON_FILE = join(DIST_DIR, 'style-deps.json');
|
|||||||
export const POSTCSS_CONFIG_FILE = join(CJS_DIR, 'postcss.config.cjs');
|
export const POSTCSS_CONFIG_FILE = join(CJS_DIR, 'postcss.config.cjs');
|
||||||
export const JEST_CONFIG_FILE = join(CJS_DIR, 'jest.config.cjs');
|
export const JEST_CONFIG_FILE = join(CJS_DIR, 'jest.config.cjs');
|
||||||
|
|
||||||
export const SCRIPT_EXTS = ['.js', '.jsx', '.vue', '.ts', '.tsx'];
|
export const SCRIPT_EXTS = [
|
||||||
|
'.js',
|
||||||
|
'.jsx',
|
||||||
|
'.vue',
|
||||||
|
'.ts',
|
||||||
|
'.tsx',
|
||||||
|
'.mjs',
|
||||||
|
'.cjs',
|
||||||
|
];
|
||||||
export const STYLE_EXTS = ['.css', '.less', '.scss'];
|
export const STYLE_EXTS = ['.css', '.less', '.scss'];
|
||||||
|
|
||||||
export function getPackageJson() {
|
export function getPackageJson() {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import ora from 'ora';
|
import { createSpinner } from 'nanospinner';
|
||||||
import chalk from 'chalk';
|
import color from 'picocolors';
|
||||||
import consola from 'consola';
|
import consola from 'consola';
|
||||||
import { ROOT } from '../common/constant.js';
|
import { ROOT } from '../common/constant.js';
|
||||||
|
|
||||||
export function slimPath(path: string) {
|
export function slimPath(path: string) {
|
||||||
return chalk.yellow(path.replace(ROOT, ''));
|
return color.yellow(path.replace(ROOT, ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
export { ora, consola };
|
export { createSpinner, consola };
|
||||||
|
|||||||
@ -1,68 +1,41 @@
|
|||||||
import fse from 'fs-extra';
|
|
||||||
import { join } from 'path';
|
|
||||||
import { build } from 'vite';
|
import { build } from 'vite';
|
||||||
import { getPackageJson, getVantConfig, LIB_DIR } from '../common/constant.js';
|
import { getPackageJson, getVantConfig } from '../common/constant.js';
|
||||||
import { mergeCustomViteConfig } from '../common/index.js';
|
import { mergeCustomViteConfig } from '../common/index.js';
|
||||||
import { getViteConfigForPackage } from '../config/vite.package.js';
|
import { getViteConfigForPackage } from '../config/vite.package.js';
|
||||||
|
import type { LibraryFormats } from 'vite';
|
||||||
|
|
||||||
// generate entry file for nuxt
|
export type BundleOption = {
|
||||||
async function genEntryForSSR() {
|
minify?: boolean;
|
||||||
const { name } = getVantConfig();
|
formats: LibraryFormats[];
|
||||||
const cjsPath = join(LIB_DIR, 'ssr.js');
|
external?: string[];
|
||||||
const mjsPath = join(LIB_DIR, 'ssr.mjs');
|
|
||||||
|
|
||||||
const cjsContent = `'use strict';
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
module.exports = require('./${name}.cjs.min.js');
|
|
||||||
} else {
|
|
||||||
module.exports = require('./${name}.cjs.js');
|
|
||||||
};
|
};
|
||||||
`;
|
|
||||||
|
|
||||||
const mjsContent = `export * from './index.js';\n`;
|
|
||||||
|
|
||||||
return Promise.all([
|
|
||||||
fse.outputFile(cjsPath, cjsContent),
|
|
||||||
fse.outputFile(mjsPath, mjsContent),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function compileBundles() {
|
export async function compileBundles() {
|
||||||
const dependencies = getPackageJson().dependencies || {};
|
const dependencies = getPackageJson().dependencies || {};
|
||||||
const externals = Object.keys(dependencies);
|
const external = Object.keys(dependencies);
|
||||||
|
|
||||||
const configs = [
|
const DEFAULT_OPTIONS: BundleOption[] = [
|
||||||
// umd bundle
|
{
|
||||||
getViteConfigForPackage({
|
|
||||||
minify: false,
|
minify: false,
|
||||||
formats: ['umd'],
|
formats: ['umd'],
|
||||||
external: ['vue'],
|
},
|
||||||
}),
|
{
|
||||||
// umd bundle (minified)
|
|
||||||
getViteConfigForPackage({
|
|
||||||
minify: true,
|
minify: true,
|
||||||
formats: ['umd'],
|
formats: ['umd'],
|
||||||
external: ['vue'],
|
},
|
||||||
}),
|
{
|
||||||
// esm/cjs bundle
|
|
||||||
getViteConfigForPackage({
|
|
||||||
minify: false,
|
minify: false,
|
||||||
formats: ['es', 'cjs'],
|
formats: ['es', 'cjs'],
|
||||||
external: ['vue', ...externals],
|
external,
|
||||||
}),
|
},
|
||||||
// esm/cjs bundle (minified)
|
|
||||||
// vite will not minify es bundle
|
|
||||||
// see: https://github.com/vuejs/vue-next/issues/2860
|
|
||||||
getViteConfigForPackage({
|
|
||||||
minify: true,
|
|
||||||
formats: ['es', 'cjs'],
|
|
||||||
external: ['vue', ...externals],
|
|
||||||
}),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const bundleOptions: BundleOption[] =
|
||||||
|
getVantConfig().build?.bundleOptions || DEFAULT_OPTIONS;
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
configs.map((config) => build(mergeCustomViteConfig(config)))
|
bundleOptions.map((config) =>
|
||||||
|
build(mergeCustomViteConfig(getViteConfigForPackage(config)))
|
||||||
|
)
|
||||||
);
|
);
|
||||||
await genEntryForSSR();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import fse from 'fs-extra';
|
|||||||
import babel from '@babel/core';
|
import babel from '@babel/core';
|
||||||
import esbuild, { type Format } from 'esbuild';
|
import esbuild, { type Format } from 'esbuild';
|
||||||
import { sep } from 'path';
|
import { sep } from 'path';
|
||||||
import { isJsx, replaceExt } from '../common/index.js';
|
import { isJsx, replaceExt, getVantConfig } from '../common/index.js';
|
||||||
import { replaceCSSImportExt } from '../common/css.js';
|
import { replaceCSSImportExt } from '../common/css.js';
|
||||||
import { replaceScriptImportExt } from './get-deps.js';
|
import { replaceScriptImportExt } from './get-deps.js';
|
||||||
|
|
||||||
@ -16,12 +16,15 @@ export async function compileScript(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const extensionMap = getVantConfig().build?.extensions;
|
||||||
|
const extension = extensionMap?.[format] || '.js';
|
||||||
|
|
||||||
let code = readFileSync(filePath, 'utf-8');
|
let code = readFileSync(filePath, 'utf-8');
|
||||||
|
|
||||||
if (!filePath.includes(`${sep}style${sep}`)) {
|
if (!filePath.includes(`${sep}style${sep}`)) {
|
||||||
code = replaceCSSImportExt(code);
|
code = replaceCSSImportExt(code);
|
||||||
}
|
}
|
||||||
code = replaceScriptImportExt(code, '.vue', '');
|
code = replaceScriptImportExt(code, filePath, extension);
|
||||||
|
|
||||||
if (isJsx(filePath)) {
|
if (isJsx(filePath)) {
|
||||||
const babelResult = await babel.transformAsync(code, {
|
const babelResult = await babel.transformAsync(code, {
|
||||||
@ -50,7 +53,8 @@ export async function compileScript(
|
|||||||
|
|
||||||
({ code } = esbuildResult);
|
({ code } = esbuildResult);
|
||||||
|
|
||||||
const jsFilePath = replaceExt(filePath, '.js');
|
const jsFilePath = replaceExt(filePath, extension);
|
||||||
|
|
||||||
removeSync(filePath);
|
removeSync(filePath);
|
||||||
outputFileSync(jsFilePath, code);
|
outputFileSync(jsFilePath, code);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
import fse from 'fs-extra';
|
import fse from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import hash from 'hash-sum';
|
import hash from 'hash-sum';
|
||||||
import { parse, SFCBlock, compileTemplate } from 'vue/compiler-sfc';
|
import {
|
||||||
|
parse,
|
||||||
|
SFCBlock,
|
||||||
|
compileTemplate,
|
||||||
|
compileScript,
|
||||||
|
} from 'vue/compiler-sfc';
|
||||||
import { replaceExt } from '../common/index.js';
|
import { replaceExt } from '../common/index.js';
|
||||||
|
|
||||||
const { remove, readFileSync, outputFile } = fse;
|
const { remove, readFileSync, outputFile } = fse;
|
||||||
@ -73,20 +78,26 @@ export async function compileSfc(filePath: string): Promise<any> {
|
|||||||
const scopeId = hasScoped ? `data-v-${hash(source)}` : '';
|
const scopeId = hasScoped ? `data-v-${hash(source)}` : '';
|
||||||
|
|
||||||
// compile js part
|
// compile js part
|
||||||
if (descriptor.script) {
|
if (descriptor.script || descriptor.scriptSetup) {
|
||||||
const lang = descriptor.script.lang || 'js';
|
const lang =
|
||||||
|
descriptor.script?.lang || descriptor.scriptSetup?.lang || 'js';
|
||||||
const scriptFilePath = replaceExt(filePath, `.${lang}`);
|
const scriptFilePath = replaceExt(filePath, `.${lang}`);
|
||||||
|
|
||||||
tasks.push(
|
tasks.push(
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
let script = '';
|
let script = '';
|
||||||
|
|
||||||
// the generated render fn lacks type definitions
|
let bindingMetadata;
|
||||||
if (lang === 'ts') {
|
if (descriptor.scriptSetup) {
|
||||||
script += '// @ts-nocheck\n';
|
const { bindings, content } = compileScript(descriptor, {
|
||||||
|
id: scopeId,
|
||||||
|
});
|
||||||
|
script += content;
|
||||||
|
bindingMetadata = bindings;
|
||||||
|
} else {
|
||||||
|
script += descriptor.script!.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
script += descriptor.script!.content;
|
|
||||||
script = injectStyle(script, styles, filePath);
|
script = injectStyle(script, styles, filePath);
|
||||||
script = script.replace(EXPORT, `const ${VUEIDS} =`);
|
script = script.replace(EXPORT, `const ${VUEIDS} =`);
|
||||||
|
|
||||||
@ -95,6 +106,9 @@ export async function compileSfc(filePath: string): Promise<any> {
|
|||||||
id: scopeId,
|
id: scopeId,
|
||||||
source: template.content,
|
source: template.content,
|
||||||
filename: filePath,
|
filename: filePath,
|
||||||
|
compilerOptions: {
|
||||||
|
bindingMetadata,
|
||||||
|
},
|
||||||
}).code;
|
}).code;
|
||||||
|
|
||||||
script = injectRender(script, render);
|
script = injectRender(script, render);
|
||||||
@ -106,6 +120,12 @@ export async function compileSfc(filePath: string): Promise<any> {
|
|||||||
|
|
||||||
script += `\n${EXPORT} ${VUEIDS}`;
|
script += `\n${EXPORT} ${VUEIDS}`;
|
||||||
|
|
||||||
|
// ts-nocheck should be placed on the first line
|
||||||
|
// the generated render fn lacks type definitions
|
||||||
|
if (lang === 'ts') {
|
||||||
|
script = '// @ts-nocheck\n' + script;
|
||||||
|
}
|
||||||
|
|
||||||
outputFile(scriptFilePath, script).then(resolve);
|
outputFile(scriptFilePath, script).then(resolve);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import chalk from 'chalk';
|
import color from 'picocolors';
|
||||||
import { createRequire } from 'module';
|
import { createRequire } from 'module';
|
||||||
import { createServer, build } from 'vite';
|
import { createServer, build } from 'vite';
|
||||||
import {
|
import {
|
||||||
@ -38,8 +38,8 @@ export async function compileSite(production = false) {
|
|||||||
|
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
const { version } = require('vite/package.json');
|
const { version } = require('vite/package.json');
|
||||||
const viteInfo = chalk.cyan(`vite v${version}`);
|
const viteInfo = color.cyan(`vite v${version}`);
|
||||||
console.log(`\n ${viteInfo}` + chalk.green(` dev server running at:\n`));
|
console.log(`\n ${viteInfo}` + color.green(` dev server running at:\n`));
|
||||||
server.printUrls();
|
server.printUrls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import { parse } from 'path';
|
import { parse } from 'path';
|
||||||
import { readFileSync, writeFileSync } from 'fs';
|
import fse from 'fs-extra';
|
||||||
import { replaceExt } from '../common/index.js';
|
import { getVantConfig, replaceExt } from '../common/index.js';
|
||||||
import { compileCss } from './compile-css.js';
|
import { compileCss } from './compile-css.js';
|
||||||
import { compileLess } from './compile-less.js';
|
import { compileLess } from './compile-less.js';
|
||||||
import { compileSass } from './compile-sass.js';
|
import { compileSass } from './compile-sass.js';
|
||||||
import { consola } from '../common/logger.js';
|
import { consola } from '../common/logger.js';
|
||||||
|
|
||||||
|
const { readFileSync, writeFileSync, removeSync } = fse;
|
||||||
|
|
||||||
async function compileFile(filePath: string) {
|
async function compileFile(filePath: string) {
|
||||||
const parsedPath = parse(filePath);
|
const parsedPath = parse(filePath);
|
||||||
|
|
||||||
@ -30,6 +32,11 @@ async function compileFile(filePath: string) {
|
|||||||
|
|
||||||
export async function compileStyle(filePath: string) {
|
export async function compileStyle(filePath: string) {
|
||||||
const css = await compileFile(filePath);
|
const css = await compileFile(filePath);
|
||||||
|
const vantConfig = getVantConfig();
|
||||||
|
|
||||||
|
if (vantConfig.build?.css?.removeSourceFile) {
|
||||||
|
removeSync(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
writeFileSync(replaceExt(filePath, '.css'), css);
|
writeFileSync(replaceExt(filePath, '.css'), css);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import {
|
|||||||
ES_DIR,
|
ES_DIR,
|
||||||
SRC_DIR,
|
SRC_DIR,
|
||||||
LIB_DIR,
|
LIB_DIR,
|
||||||
|
getVantConfig,
|
||||||
STYLE_DEPS_JSON_FILE,
|
STYLE_DEPS_JSON_FILE,
|
||||||
} from '../common/constant.js';
|
} from '../common/constant.js';
|
||||||
|
|
||||||
@ -87,8 +88,10 @@ export function genComponentStyle(
|
|||||||
delete require.cache[STYLE_DEPS_JSON_FILE];
|
delete require.cache[STYLE_DEPS_JSON_FILE];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const vantConfig = getVantConfig();
|
||||||
const components = getComponents();
|
const components = getComponents();
|
||||||
const baseFile = getCssBaseFile();
|
const baseFile = getCssBaseFile();
|
||||||
|
const hasSourceFile = vantConfig.build?.css?.removeSourceFile !== true;
|
||||||
|
|
||||||
components.forEach((component) => {
|
components.forEach((component) => {
|
||||||
genEntry({
|
genEntry({
|
||||||
@ -98,7 +101,7 @@ export function genComponentStyle(
|
|||||||
ext: '.css',
|
ext: '.css',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CSS_LANG !== 'css') {
|
if (CSS_LANG !== 'css' && hasSourceFile) {
|
||||||
genEntry({
|
genEntry({
|
||||||
baseFile,
|
baseFile,
|
||||||
component,
|
component,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export function checkStyleExists(component: string) {
|
|||||||
// analyze component dependencies
|
// analyze component dependencies
|
||||||
function analyzeComponentDeps(components: string[], component: string) {
|
function analyzeComponentDeps(components: string[], component: string) {
|
||||||
const checkList: string[] = [];
|
const checkList: string[] = [];
|
||||||
const componentEntry = fillExt(join(SRC_DIR, component, 'index'));
|
const componentEntry = fillExt(join(SRC_DIR, component, 'index')).path;
|
||||||
const record = new Set();
|
const record = new Set();
|
||||||
|
|
||||||
function search(filePath: string) {
|
function search(filePath: string) {
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
import markdownVetur from '@vant/markdown-vetur';
|
|
||||||
import {
|
|
||||||
SRC_DIR,
|
|
||||||
VETUR_DIR,
|
|
||||||
getVantConfig,
|
|
||||||
getPackageJson,
|
|
||||||
} from '../common/constant.js';
|
|
||||||
|
|
||||||
// generate vetur tags & attributes
|
|
||||||
export function genVeturConfig() {
|
|
||||||
const pkgJson = getPackageJson();
|
|
||||||
const vantConfig = getVantConfig();
|
|
||||||
const options = vantConfig.build?.vetur;
|
|
||||||
|
|
||||||
if (options) {
|
|
||||||
markdownVetur.parseAndWrite({
|
|
||||||
name: vantConfig.name,
|
|
||||||
path: SRC_DIR,
|
|
||||||
test: /README\.md/,
|
|
||||||
version: pkgJson.version,
|
|
||||||
outputDir: VETUR_DIR,
|
|
||||||
...options,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { SCRIPT_EXTS } from '../common/constant.js';
|
import { SCRIPT_EXTS, STYLE_EXTS } from '../common/constant.js';
|
||||||
import { readFileSync, existsSync } from 'fs';
|
import { readFileSync, existsSync } from 'fs';
|
||||||
|
|
||||||
let depsMap: Record<string, string[]> = {};
|
let depsMap: Record<string, string[]> = {};
|
||||||
@ -8,12 +8,19 @@ let existsCache: Record<string, boolean> = {};
|
|||||||
// https://regexr.com/47jlq
|
// https://regexr.com/47jlq
|
||||||
const IMPORT_RE =
|
const IMPORT_RE =
|
||||||
/import\s+?(?:(?:(?:[\w*\s{},]*)\s+from(\s+)?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g;
|
/import\s+?(?:(?:(?:[\w*\s{},]*)\s+from(\s+)?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g;
|
||||||
|
const EXPORT_FROM_RE =
|
||||||
|
/@?export\s+?(?:(?:(?:[\w*\s{},]*)\s+from(\s+)?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g;
|
||||||
|
|
||||||
function matchImports(code: string): string[] {
|
function matchImports(code: string): string[] {
|
||||||
const imports = code.match(IMPORT_RE) || [];
|
const imports = code.match(IMPORT_RE) || [];
|
||||||
return imports.filter((line) => !line.includes('import type'));
|
return imports.filter((line) => !line.includes('import type'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function matchExportFroms(code: string): string[] {
|
||||||
|
const exportFroms = code.match(EXPORT_FROM_RE) || [];
|
||||||
|
return exportFroms.filter((line) => !line.includes('export type'));
|
||||||
|
}
|
||||||
|
|
||||||
function exists(filePath: string) {
|
function exists(filePath: string) {
|
||||||
if (!(filePath in existsCache)) {
|
if (!(filePath in existsCache)) {
|
||||||
existsCache[filePath] = existsSync(filePath);
|
existsCache[filePath] = existsSync(filePath);
|
||||||
@ -26,23 +33,36 @@ export function fillExt(filePath: string) {
|
|||||||
for (let i = 0; i < SCRIPT_EXTS.length; i++) {
|
for (let i = 0; i < SCRIPT_EXTS.length; i++) {
|
||||||
const completePath = `${filePath}${SCRIPT_EXTS[i]}`;
|
const completePath = `${filePath}${SCRIPT_EXTS[i]}`;
|
||||||
if (exists(completePath)) {
|
if (exists(completePath)) {
|
||||||
return completePath;
|
return {
|
||||||
|
path: completePath,
|
||||||
|
isIndex: false,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < SCRIPT_EXTS.length; i++) {
|
for (let i = 0; i < SCRIPT_EXTS.length; i++) {
|
||||||
const completePath = `${filePath}/index${SCRIPT_EXTS[i]}`;
|
const completePath = `${filePath}/index${SCRIPT_EXTS[i]}`;
|
||||||
if (exists(completePath)) {
|
if (exists(completePath)) {
|
||||||
return completePath;
|
return {
|
||||||
|
path: completePath,
|
||||||
|
isIndex: true,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return {
|
||||||
|
path: '',
|
||||||
|
isIndex: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getImportRelativePath(code: string) {
|
||||||
|
const divider = code.includes('"') ? '"' : "'";
|
||||||
|
return code.split(divider)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPathByImport(code: string, filePath: string) {
|
function getPathByImport(code: string, filePath: string) {
|
||||||
const divider = code.includes('"') ? '"' : "'";
|
const relativePath = getImportRelativePath(code);
|
||||||
const relativePath = code.split(divider)[1];
|
|
||||||
|
|
||||||
if (relativePath.includes('.')) {
|
if (relativePath.includes('.')) {
|
||||||
return fillExt(join(filePath, '..', relativePath));
|
return fillExt(join(filePath, '..', relativePath));
|
||||||
@ -64,7 +84,7 @@ export function getDeps(filePath: string) {
|
|||||||
const code = readFileSync(filePath, 'utf-8');
|
const code = readFileSync(filePath, 'utf-8');
|
||||||
const imports = matchImports(code);
|
const imports = matchImports(code);
|
||||||
const paths = imports
|
const paths = imports
|
||||||
.map((item) => getPathByImport(item, filePath))
|
.map((item) => getPathByImport(item, filePath)?.path)
|
||||||
.filter((item) => !!item) as string[];
|
.filter((item) => !!item) as string[];
|
||||||
|
|
||||||
depsMap[filePath] = paths;
|
depsMap[filePath] = paths;
|
||||||
@ -74,14 +94,58 @@ export function getDeps(filePath: string) {
|
|||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "import App from 'App.vue';" => "import App from 'App.xxx';"
|
/**
|
||||||
export function replaceScriptImportExt(code: string, from: string, to: string) {
|
* 1. Replace .vue extension
|
||||||
const importLines = matchImports(code);
|
* @example "import App from 'App.vue';" => "import App from 'App.xxx';"
|
||||||
|
*
|
||||||
|
* 2. if using .mjs or .cjs, complete the import path
|
||||||
|
* @example import './foo' -> import './foo.mjs'
|
||||||
|
* @example import './foo' -> import './foo/index.mjs'
|
||||||
|
*/
|
||||||
|
export function replaceScriptImportExt(
|
||||||
|
code: string,
|
||||||
|
filePath: string,
|
||||||
|
ext: string
|
||||||
|
) {
|
||||||
|
const imports = [...matchImports(code), ...matchExportFroms(code)];
|
||||||
|
|
||||||
importLines.forEach((importLine) => {
|
const updateImport = (index: number, newImport: string) => {
|
||||||
const result = importLine.replace(from, to);
|
code = code.replace(imports[index], newImport);
|
||||||
code = code.replace(importLine, result);
|
imports[index] = newImport;
|
||||||
|
};
|
||||||
|
|
||||||
|
imports.forEach((line, index) => {
|
||||||
|
if (line.includes('.vue')) {
|
||||||
|
updateImport(index, line.replace('.vue', ext));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (ext === '.mjs' || ext === '.cjs') {
|
||||||
|
imports.forEach((line, index) => {
|
||||||
|
const isStyleImport = STYLE_EXTS.some((ext) => line.includes(ext));
|
||||||
|
if (isStyleImport) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pathInfo = getPathByImport(line, filePath);
|
||||||
|
|
||||||
|
if (pathInfo) {
|
||||||
|
const relativePath = getImportRelativePath(line);
|
||||||
|
|
||||||
|
if (pathInfo.isIndex) {
|
||||||
|
const newLine = line.replace(
|
||||||
|
relativePath,
|
||||||
|
`${relativePath}/index${ext}`
|
||||||
|
);
|
||||||
|
|
||||||
|
updateImport(index, newLine);
|
||||||
|
} else {
|
||||||
|
const newLine = line.replace(relativePath, relativePath + ext);
|
||||||
|
updateImport(index, newLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const releaseIt = require('release-it');
|
import { Plugin } from 'release-it';
|
||||||
const { execSync } = require('child_process');
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
class VantCliReleasePlugin extends releaseIt.Plugin {
|
class VantCliReleasePlugin extends Plugin {
|
||||||
async beforeRelease() {
|
async beforeRelease() {
|
||||||
// log an empty line
|
// log an empty line
|
||||||
console.log('');
|
console.log('');
|
||||||
@ -11,4 +11,4 @@ class VantCliReleasePlugin extends releaseIt.Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = VantCliReleasePlugin;
|
export default VantCliReleasePlugin;
|
||||||
@ -1,14 +1,19 @@
|
|||||||
/* eslint-disable no-continue */
|
/* eslint-disable no-continue */
|
||||||
import { Articals } from './parser';
|
import { Articles } from './parser.js';
|
||||||
import { formatOptions, formatType, removeVersion, toKebabCase } from './utils';
|
import {
|
||||||
import { VueEventArgument, VueTag } from './type';
|
formatOptions,
|
||||||
|
formatType,
|
||||||
|
removeVersion,
|
||||||
|
toKebabCase,
|
||||||
|
} from './utils.js';
|
||||||
|
import { VueEventArgument, VueTag } from './type.js';
|
||||||
|
|
||||||
function formatComponentName(name: string, tagPrefix: string) {
|
function formatComponentName(name: string, tagPrefix: string) {
|
||||||
return tagPrefix + toKebabCase(name);
|
return tagPrefix + toKebabCase(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* format arugments of events
|
* format arguments of events
|
||||||
* input = value: { foo: foo or 1, bar: bar or 2 }, value2: { one: 1 and 1, two: 2 and 2 }, foo: bar
|
* input = value: { foo: foo or 1, bar: bar or 2 }, value2: { one: 1 and 1, two: 2 and 2 }, foo: bar
|
||||||
* output = [{ name: 'value', type: '{ foo: foo or 1, bar: bar or 2 }' }, { name: 'value2', type: '{ one: 1 and 1, two: 2 and 2 }'}, { name: 'foo', type: 'bar' }]
|
* output = [{ name: 'value', type: '{ foo: foo or 1, bar: bar or 2 }' }, { name: 'value2', type: '{ one: 1 and 1, two: 2 and 2 }'}, { name: 'foo', type: 'bar' }]
|
||||||
*/
|
*/
|
||||||
@ -73,29 +78,29 @@ function findTag(vueTags: VueTag[], name: string) {
|
|||||||
|
|
||||||
export function formatter(
|
export function formatter(
|
||||||
vueTags: VueTag[],
|
vueTags: VueTag[],
|
||||||
articals: Articals,
|
articles: Articles,
|
||||||
tagPrefix = ''
|
tagPrefix = ''
|
||||||
) {
|
) {
|
||||||
if (!articals.length) {
|
if (!articles.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mainTitle = articals[0].content;
|
const mainTitle = articles[0].content;
|
||||||
const defaultName = mainTitle
|
const defaultName = mainTitle
|
||||||
? formatComponentName(mainTitle.split(' ')[0], tagPrefix)
|
? formatComponentName(mainTitle.split(' ')[0], tagPrefix)
|
||||||
: '';
|
: '';
|
||||||
const tables = articals.filter((artical) => artical.type === 'table');
|
const tables = articles.filter((article) => article.type === 'table');
|
||||||
|
|
||||||
tables.forEach((item) => {
|
tables.forEach((item) => {
|
||||||
const { table } = item;
|
const { table } = item;
|
||||||
const prevIndex = articals.indexOf(item) - 1;
|
const prevIndex = articles.indexOf(item) - 1;
|
||||||
const prevArtical = articals[prevIndex];
|
const prevArticle = articles[prevIndex];
|
||||||
|
|
||||||
if (!prevArtical || !prevArtical.content || !table || !table.body) {
|
if (!prevArticle || !prevArticle.content || !table || !table.body) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableTitle = prevArtical.content;
|
const tableTitle = prevArticle.content;
|
||||||
|
|
||||||
if (tableTitle.includes('Props')) {
|
if (tableTitle.includes('Props')) {
|
||||||
const name = getNameFromTableTitle(tableTitle, tagPrefix) || defaultName;
|
const name = getNameFromTableTitle(tableTitle, tagPrefix) || defaultName;
|
||||||
55
packages/vant-cli/src/compiler/web-types/index.ts
Normal file
55
packages/vant-cli/src/compiler/web-types/index.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import glob from 'fast-glob';
|
||||||
|
import { join } from 'path';
|
||||||
|
import fse from 'fs-extra';
|
||||||
|
import { mdParser } from './parser.js';
|
||||||
|
import { formatter } from './formatter.js';
|
||||||
|
import { genWebTypes } from './web-types.js';
|
||||||
|
import { Options, VueTag } from './type.js';
|
||||||
|
import { normalizePath } from './utils.js';
|
||||||
|
import {
|
||||||
|
SRC_DIR,
|
||||||
|
LIB_DIR,
|
||||||
|
getVantConfig,
|
||||||
|
getPackageJson,
|
||||||
|
} from '../../common/constant.js';
|
||||||
|
|
||||||
|
async function readMarkdown(options: Options) {
|
||||||
|
const mds = await glob(normalizePath(`${options.path}/**/*.md`));
|
||||||
|
return mds
|
||||||
|
.filter((md) => options.test.test(md))
|
||||||
|
.map((path) => fse.readFileSync(path, 'utf-8'));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function parseAndWrite(options: Options) {
|
||||||
|
if (!options.outputDir) {
|
||||||
|
throw new Error('outputDir can not be empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const mds = await readMarkdown(options);
|
||||||
|
const vueTags: VueTag[] = [];
|
||||||
|
|
||||||
|
mds.forEach((md) => {
|
||||||
|
const parsedMd = mdParser(md);
|
||||||
|
formatter(vueTags, parsedMd, options.tagPrefix);
|
||||||
|
});
|
||||||
|
|
||||||
|
const webTypes = genWebTypes(vueTags, options);
|
||||||
|
fse.outputFileSync(
|
||||||
|
join(options.outputDir, 'web-types.json'),
|
||||||
|
JSON.stringify(webTypes, null, 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genWebStormTypes(tagPrefix?: string) {
|
||||||
|
const pkgJson = getPackageJson();
|
||||||
|
const vantConfig = getVantConfig();
|
||||||
|
|
||||||
|
parseAndWrite({
|
||||||
|
name: vantConfig.name,
|
||||||
|
path: SRC_DIR,
|
||||||
|
test: /README\.md/,
|
||||||
|
version: pkgJson.version,
|
||||||
|
outputDir: LIB_DIR,
|
||||||
|
tagPrefix,
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -9,14 +9,14 @@ type TableContent = {
|
|||||||
body: string[][];
|
body: string[][];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Artical = {
|
export type Article = {
|
||||||
type: string;
|
type: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
table?: TableContent;
|
table?: TableContent;
|
||||||
level?: number;
|
level?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Articals = Artical[];
|
export type Articles = Article[];
|
||||||
|
|
||||||
function readLine(input: string) {
|
function readLine(input: string) {
|
||||||
const end = input.indexOf('\n');
|
const end = input.indexOf('\n');
|
||||||
@ -75,8 +75,8 @@ function tableParse(input: string) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mdParser(input: string): Articals {
|
export function mdParser(input: string): Articles {
|
||||||
const artical = [];
|
const article = [];
|
||||||
let start = 0;
|
let start = 0;
|
||||||
const end = input.length;
|
const end = input.length;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ export function mdParser(input: string): Articals {
|
|||||||
|
|
||||||
let match;
|
let match;
|
||||||
if ((match = TITLE_REG.exec(target))) {
|
if ((match = TITLE_REG.exec(target))) {
|
||||||
artical.push({
|
article.push({
|
||||||
type: 'title',
|
type: 'title',
|
||||||
content: match[2],
|
content: match[2],
|
||||||
level: match[1].length,
|
level: match[1].length,
|
||||||
@ -94,7 +94,7 @@ export function mdParser(input: string): Articals {
|
|||||||
start += match.index + match[0].length;
|
start += match.index + match[0].length;
|
||||||
} else if ((match = TABLE_REG.exec(target))) {
|
} else if ((match = TABLE_REG.exec(target))) {
|
||||||
const { table, usedLength } = tableParse(target.substr(match.index));
|
const { table, usedLength } = tableParse(target.substr(match.index));
|
||||||
artical.push({
|
article.push({
|
||||||
type: 'table',
|
type: 'table',
|
||||||
table,
|
table,
|
||||||
});
|
});
|
||||||
@ -105,5 +105,5 @@ export function mdParser(input: string): Articals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return artical;
|
return article;
|
||||||
}
|
}
|
||||||
@ -35,26 +35,6 @@ export type VueTag = {
|
|||||||
description?: string;
|
description?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type VeturTag = {
|
|
||||||
description?: string;
|
|
||||||
attributes: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type VeturTags = Record<string, VeturTag>;
|
|
||||||
|
|
||||||
export type VeturAttribute = {
|
|
||||||
type: string;
|
|
||||||
description: string;
|
|
||||||
options?: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type VeturAttributes = Record<string, VeturAttribute>;
|
|
||||||
|
|
||||||
export type VeturResult = {
|
|
||||||
tags: VeturTags;
|
|
||||||
attributes: VeturAttributes;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Options = {
|
export type Options = {
|
||||||
name: string;
|
name: string;
|
||||||
path: PathLike;
|
path: PathLike;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { VueTag, Options } from './type';
|
import type { VueTag, Options } from './type.js';
|
||||||
|
|
||||||
// create web-types.json to provide autocomplete in JetBrains IDEs
|
// create web-types.json to provide autocomplete in JetBrains IDEs
|
||||||
export function genWebTypes(tags: VueTag[], options: Options) {
|
export function genWebTypes(tags: VueTag[], options: Options) {
|
||||||
@ -1,40 +1,47 @@
|
|||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { setBuildTarget } from '../common/index.js';
|
import { setBuildTarget } from '../common/index.js';
|
||||||
import { CWD, ES_DIR, getVantConfig, LIB_DIR } from '../common/constant.js';
|
import { CWD, ES_DIR, getVantConfig, LIB_DIR } from '../common/constant.js';
|
||||||
import type { InlineConfig, LibraryFormats } from 'vite';
|
import type { InlineConfig } from 'vite';
|
||||||
|
import type { BundleOption } from '../compiler/compile-bundles.js';
|
||||||
|
|
||||||
export function getViteConfigForPackage({
|
export function getViteConfigForPackage({
|
||||||
minify,
|
minify,
|
||||||
formats,
|
formats,
|
||||||
external,
|
external = [],
|
||||||
}: {
|
}: BundleOption): InlineConfig {
|
||||||
minify: boolean;
|
|
||||||
formats: LibraryFormats[];
|
|
||||||
external: string[];
|
|
||||||
}): InlineConfig {
|
|
||||||
setBuildTarget('package');
|
setBuildTarget('package');
|
||||||
|
|
||||||
const { name } = getVantConfig();
|
const { name, build } = getVantConfig();
|
||||||
|
const entryExtension = build?.extensions?.esm || '.js';
|
||||||
|
const entry = join(ES_DIR, `index${entryExtension}`);
|
||||||
|
const shouldReplaceEnv = minify || formats?.includes('umd');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
root: CWD,
|
root: CWD,
|
||||||
|
|
||||||
logLevel: 'silent',
|
logLevel: 'silent',
|
||||||
|
|
||||||
|
define: shouldReplaceEnv
|
||||||
|
? {
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
name,
|
name,
|
||||||
entry: join(ES_DIR, 'index.js'),
|
entry,
|
||||||
formats,
|
formats,
|
||||||
fileName: (format: string) => {
|
fileName: (format: string) => {
|
||||||
const suffix = format === 'umd' ? '' : `.${format}`;
|
const suffix = format === 'umd' ? '' : `.${format}`;
|
||||||
return minify ? `${name}${suffix}.min.js` : `${name}${suffix}.js`;
|
return minify ? `${name}${suffix}.min.js` : `${name}${suffix}.js`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// terser has better compression than esbuild
|
// terser has better compression than esbuild
|
||||||
minify: minify ? 'terser' : false,
|
minify: minify ? 'terser' : false,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external,
|
external: [...external, 'vue'],
|
||||||
output: {
|
output: {
|
||||||
dir: LIB_DIR,
|
dir: LIB_DIR,
|
||||||
exports: 'named',
|
exports: 'named',
|
||||||
|
|||||||
@ -137,6 +137,7 @@ export function getViteConfigForSiteDev(): InlineConfig {
|
|||||||
const vantConfig = getVantConfig();
|
const vantConfig = getVantConfig();
|
||||||
const siteConfig = getSiteConfig(vantConfig);
|
const siteConfig = getSiteConfig(vantConfig);
|
||||||
const title = getTitle(siteConfig);
|
const title = getTitle(siteConfig);
|
||||||
|
const headHtml = vantConfig.site?.headHtml;
|
||||||
const baiduAnalytics = vantConfig.site?.baiduAnalytics;
|
const baiduAnalytics = vantConfig.site?.baiduAnalytics;
|
||||||
const enableVConsole = isDev() && vantConfig.site?.enableVConsole;
|
const enableVConsole = isDev() && vantConfig.site?.enableVConsole;
|
||||||
|
|
||||||
@ -178,6 +179,7 @@ export function getViteConfigForSiteDev(): InlineConfig {
|
|||||||
// `description` is used by the HTML ejs template,
|
// `description` is used by the HTML ejs template,
|
||||||
// so it needs to be written explicitly here to avoid error: description is not defined
|
// so it needs to be written explicitly here to avoid error: description is not defined
|
||||||
description: siteConfig.description,
|
description: siteConfig.description,
|
||||||
|
headHtml,
|
||||||
baiduAnalytics,
|
baiduAnalytics,
|
||||||
enableVConsole,
|
enableVConsole,
|
||||||
meta: getHTMLMeta(vantConfig),
|
meta: getHTMLMeta(vantConfig),
|
||||||
@ -202,9 +204,9 @@ export function getViteConfigForSiteProd(): InlineConfig {
|
|||||||
base: publicPath,
|
base: publicPath,
|
||||||
build: {
|
build: {
|
||||||
outDir,
|
outDir,
|
||||||
brotliSize: false,
|
reportCompressedSize: false,
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
// https://github.com/youzan/vant/issues/9703
|
// https://github.com/vant-ui/vant/issues/9703
|
||||||
cssTarget: ['chrome53'],
|
cssTarget: ['chrome53'],
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
|
|||||||
@ -1,30 +1,9 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { URL, fileURLToPath } from 'url';
|
import { URL, fileURLToPath } from 'url';
|
||||||
import { dev } from './commands/dev.js';
|
|
||||||
import { lint } from './commands/lint.js';
|
|
||||||
import { test } from './commands/jest.js';
|
|
||||||
import { clean } from './commands/clean.js';
|
|
||||||
import { build } from './commands/build.js';
|
|
||||||
import { release } from './commands/release.js';
|
|
||||||
import { changelog } from './commands/changelog.js';
|
|
||||||
import { buildSite } from './commands/build-site.js';
|
|
||||||
import { commitLint } from './commands/commit-lint.js';
|
|
||||||
|
|
||||||
const packagePath = fileURLToPath(new URL('../package.json', import.meta.url));
|
const packagePath = fileURLToPath(new URL('../package.json', import.meta.url));
|
||||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
||||||
export const cliVersion: string = packageJson.version;
|
export const cliVersion: string = packageJson.version;
|
||||||
|
|
||||||
process.env.VANT_CLI_VERSION = cliVersion;
|
process.env.VANT_CLI_VERSION = cliVersion;
|
||||||
|
|
||||||
export {
|
|
||||||
dev,
|
|
||||||
lint,
|
|
||||||
test,
|
|
||||||
clean,
|
|
||||||
build,
|
|
||||||
release,
|
|
||||||
changelog,
|
|
||||||
buildSite,
|
|
||||||
commitLint,
|
|
||||||
};
|
|
||||||
|
|||||||
2
packages/vant-cli/src/module.d.ts
vendored
2
packages/vant-cli/src/module.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
// some modules with missing type definitions
|
// some modules with missing type definitions
|
||||||
declare module 'execa';
|
declare module 'execa';
|
||||||
declare module 'hash-sum';
|
declare module 'hash-sum';
|
||||||
|
declare module '@babel/core';
|
||||||
declare module 'release-it';
|
declare module 'release-it';
|
||||||
declare module 'conventional-changelog';
|
declare module 'conventional-changelog';
|
||||||
declare module '@vant/markdown-vetur';
|
|
||||||
|
|||||||
10
packages/vant-compat/LICENSE
Normal file
10
packages/vant-compat/LICENSE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
32
packages/vant-compat/README.md
Normal file
32
packages/vant-compat/README.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# @vant/compat
|
||||||
|
|
||||||
|
This package provides Vant 3 compatible behavior for Vant 4 users.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# with npm
|
||||||
|
npm i @vant/compat
|
||||||
|
|
||||||
|
# with yarn
|
||||||
|
yarn add @vant/compat
|
||||||
|
|
||||||
|
# with pnpm
|
||||||
|
pnpm add @vant/compat
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Same as Toast in Vant 3
|
||||||
|
import { Toast } from '@vant/compat';
|
||||||
|
|
||||||
|
// Same as Dialog in Vant 3
|
||||||
|
import { Dialog } from '@vant/compat';
|
||||||
|
|
||||||
|
// Same as Notify in Vant 3
|
||||||
|
import { Notify } from '@vant/compat';
|
||||||
|
|
||||||
|
// Same as ImagePreview in Vant 3
|
||||||
|
import { ImagePreview } from '@vant/compat';
|
||||||
|
```
|
||||||
1
packages/vant-compat/build.js
Normal file
1
packages/vant-compat/build.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
require('../vant-use/build');
|
||||||
52
packages/vant-compat/package.json
Normal file
52
packages/vant-compat/package.json
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"name": "@vant/compat",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Provide Vant 3 compatible behavior for Vant 4",
|
||||||
|
"main": "dist/index.cjs.js",
|
||||||
|
"module": "dist/index.esm.mjs",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/index.esm.mjs",
|
||||||
|
"require": "./dist/index.cjs.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sideEffects": false,
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public",
|
||||||
|
"registry": "https://registry.npmjs.org/"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf ./dist",
|
||||||
|
"dev": "node ./build.js -w",
|
||||||
|
"build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly",
|
||||||
|
"build:bundle": "node ./build.js",
|
||||||
|
"build": "pnpm clean && pnpm build:bundle && pnpm build:types",
|
||||||
|
"release": "pnpm build && release-it"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/vant-ui/vant.git",
|
||||||
|
"directory": "packages/vant-compat"
|
||||||
|
},
|
||||||
|
"bugs": "https://github.com/vant-ui/vant/issues",
|
||||||
|
"author": "chenjiahan",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/runtime-core": "^3.2.27",
|
||||||
|
"vant": "workspace:*",
|
||||||
|
"vue": "^3.2.27",
|
||||||
|
"esbuild": "^0.14.29",
|
||||||
|
"release-it": "^15.1.1",
|
||||||
|
"typescript": "^4.7.4"
|
||||||
|
},
|
||||||
|
"release-it": {
|
||||||
|
"git": {
|
||||||
|
"tag": false,
|
||||||
|
"commitMessage": "release: @vant/compat ${version}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
packages/vant-compat/src/dialog.ts
Normal file
30
packages/vant-compat/src/dialog.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import {
|
||||||
|
Dialog as VanDialog,
|
||||||
|
showDialog,
|
||||||
|
closeDialog,
|
||||||
|
showConfirmDialog,
|
||||||
|
setDialogDefaultOptions,
|
||||||
|
resetDialogDefaultOptions,
|
||||||
|
} from 'vant';
|
||||||
|
import type { App } from 'vue';
|
||||||
|
|
||||||
|
export const Dialog = (...args: Parameters<typeof showDialog>) =>
|
||||||
|
showDialog(...args);
|
||||||
|
|
||||||
|
Dialog.Component = VanDialog;
|
||||||
|
Dialog.alert = Dialog;
|
||||||
|
Dialog.config = showConfirmDialog;
|
||||||
|
Dialog.close = closeDialog;
|
||||||
|
Dialog.setDefaultOptions = setDialogDefaultOptions;
|
||||||
|
Dialog.resetDefaultOptions = resetDialogDefaultOptions;
|
||||||
|
|
||||||
|
Dialog.install = (app: App) => {
|
||||||
|
app.use(Dialog.Component);
|
||||||
|
app.config.globalProperties.$dialog = Dialog;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare module '@vue/runtime-core' {
|
||||||
|
interface ComponentCustomProperties {
|
||||||
|
$dialog: typeof Dialog;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
packages/vant-compat/src/image-preview.ts
Normal file
11
packages/vant-compat/src/image-preview.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { ImagePreview as VanImagePreview, showImagePreview } from 'vant';
|
||||||
|
import type { App } from 'vue';
|
||||||
|
|
||||||
|
export const ImagePreview = (...args: Parameters<typeof showImagePreview>) =>
|
||||||
|
showImagePreview(...args);
|
||||||
|
|
||||||
|
ImagePreview.Component = VanImagePreview;
|
||||||
|
|
||||||
|
ImagePreview.install = (app: App) => {
|
||||||
|
app.use(ImagePreview.Component);
|
||||||
|
};
|
||||||
4
packages/vant-compat/src/index.ts
Normal file
4
packages/vant-compat/src/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './toast';
|
||||||
|
export * from './notify';
|
||||||
|
export * from './dialog';
|
||||||
|
export * from './image-preview';
|
||||||
27
packages/vant-compat/src/notify.ts
Normal file
27
packages/vant-compat/src/notify.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import {
|
||||||
|
Notify as VanNotify,
|
||||||
|
showNotify,
|
||||||
|
closeNotify,
|
||||||
|
setNotifyDefaultOptions,
|
||||||
|
resetNotifyDefaultOptions,
|
||||||
|
} from 'vant';
|
||||||
|
import type { App } from 'vue';
|
||||||
|
|
||||||
|
export const Notify = (...args: Parameters<typeof showNotify>) =>
|
||||||
|
showNotify(...args);
|
||||||
|
|
||||||
|
Notify.clear = closeNotify;
|
||||||
|
Notify.Component = VanNotify;
|
||||||
|
Notify.setDefaultOptions = setNotifyDefaultOptions;
|
||||||
|
Notify.resetDefaultOptions = resetNotifyDefaultOptions;
|
||||||
|
|
||||||
|
Notify.install = (app: App) => {
|
||||||
|
app.use(Notify.Component);
|
||||||
|
app.config.globalProperties.$notify = Notify;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare module '@vue/runtime-core' {
|
||||||
|
interface ComponentCustomProperties {
|
||||||
|
$notify: typeof Notify;
|
||||||
|
}
|
||||||
|
}
|
||||||
49
packages/vant-compat/src/toast.ts
Normal file
49
packages/vant-compat/src/toast.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import {
|
||||||
|
showToast,
|
||||||
|
closeToast,
|
||||||
|
showFailToast,
|
||||||
|
showSuccessToast,
|
||||||
|
allowMultipleToast,
|
||||||
|
setToastDefaultOptions,
|
||||||
|
resetToastDefaultOptions,
|
||||||
|
} from 'vant';
|
||||||
|
import type { App } from 'vue';
|
||||||
|
|
||||||
|
export const Toast = (...args: Parameters<typeof showToast>) => {
|
||||||
|
const toast = showToast(...args);
|
||||||
|
return {
|
||||||
|
clear: toast.close,
|
||||||
|
...toast,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Toast.fail = (...args: Parameters<typeof showFailToast>) => {
|
||||||
|
const toast = showFailToast(...args);
|
||||||
|
return {
|
||||||
|
clear: toast.close,
|
||||||
|
...toast,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Toast.success = (...args: Parameters<typeof showSuccessToast>) => {
|
||||||
|
const toast = showSuccessToast(...args);
|
||||||
|
return {
|
||||||
|
clear: toast.close,
|
||||||
|
...toast,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Toast.clear = closeToast;
|
||||||
|
Toast.allowMultiple = allowMultipleToast;
|
||||||
|
Toast.setDefaultOptions = setToastDefaultOptions;
|
||||||
|
Toast.resetDefaultOptions = resetToastDefaultOptions;
|
||||||
|
|
||||||
|
Toast.install = (app: App) => {
|
||||||
|
app.config.globalProperties.$toast = Toast;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare module '@vue/runtime-core' {
|
||||||
|
interface ComponentCustomProperties {
|
||||||
|
$toast: typeof Toast;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig",
|
"extends": "../../tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2019",
|
"outDir": "./dist",
|
||||||
"outDir": "./lib",
|
|
||||||
"module": "commonjs",
|
|
||||||
"declaration": true
|
"declaration": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*"]
|
||||||
10
packages/vant-eslint-config/LICENSE
Normal file
10
packages/vant-eslint-config/LICENSE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@ -51,6 +51,7 @@ module.exports = {
|
|||||||
'vue/require-v-for-key': 'off',
|
'vue/require-v-for-key': 'off',
|
||||||
'vue/require-default-prop': 'off',
|
'vue/require-default-prop': 'off',
|
||||||
'vue/no-unused-components': 'off',
|
'vue/no-unused-components': 'off',
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
'vue/return-in-computed-property': 'off',
|
'vue/return-in-computed-property': 'off',
|
||||||
// typescript-eslint
|
// typescript-eslint
|
||||||
'@typescript-eslint/camelcase': 'off',
|
'@typescript-eslint/camelcase': 'off',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vant/eslint-config",
|
"name": "@vant/eslint-config",
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"description": "eslint config of vant",
|
"description": "eslint config of vant",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
@ -13,24 +13,24 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/youzan/vant.git",
|
"url": "https://github.com/vant-ui/vant.git",
|
||||||
"directory": "packages/vant-eslint-config"
|
"directory": "packages/vant-eslint-config"
|
||||||
},
|
},
|
||||||
"bugs": "https://github.com/youzan/vant/issues",
|
"bugs": "https://github.com/vant-ui/vant/issues",
|
||||||
"author": "chenjiahan",
|
"author": "chenjiahan",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
||||||
"@typescript-eslint/parser": "^5.10.0",
|
"@typescript-eslint/parser": "^5.36.1",
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
"eslint-config-airbnb-base": "^15.0.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-vue": "^8.4.0"
|
"eslint-plugin-vue": "^9.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"enhanced-resolve": "^5.8.3",
|
"enhanced-resolve": "^5.10.0",
|
||||||
"eslint": "^8.7.0",
|
"eslint": "^8.23.0",
|
||||||
"typescript": "~4.5.5"
|
"typescript": "^4.8.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": "^7.32.0 || ^8.2.0"
|
"eslint": "^7.32.0 || ^8.2.0"
|
||||||
|
|||||||
10
packages/vant-icons/LICENSE
Normal file
10
packages/vant-icons/LICENSE
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Youzan
|
||||||
|
Copyright (c) Chen Jiahan and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@ -15,5 +15,5 @@ pnpm add @vant/icons
|
|||||||
|
|
||||||
## Document
|
## Document
|
||||||
|
|
||||||
- [Usage in Vue](https://youzan.github.io/vant/#/zh-CN/icon)
|
- [Usage in Vue](https://vant-ui.github.io/vant/#/zh-CN/icon)
|
||||||
- [Usage in Weapp](https://youzan.github.io/vant-weapp/#/icon)
|
- [Usage in Weapp](https://vant-ui.github.io/vant-weapp/#/icon)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Vant 图标库托管在 [iconfont.cn](https://iconfont.cn) 上,同时仓库中
|
|||||||
|
|
||||||
从 Sketch 中导出图标对应的 SVG 文件,并上传到 [iconfont 项目](https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=2553510)中。
|
从 Sketch 中导出图标对应的 SVG 文件,并上传到 [iconfont 项目](https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=2553510)中。
|
||||||
|
|
||||||
<img src="https://cdn.jsdelivr.net/npm/@vant/assets/iconfont-upload.png" style="width: 800px;">
|
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/iconfont-upload.png" style="width: 800px;">
|
||||||
|
|
||||||
> 此步骤需要图标库管理员权限,请联系 Vant 维护者进行添加。
|
> 此步骤需要图标库管理员权限,请联系 Vant 维护者进行添加。
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ Vant 图标库托管在 [iconfont.cn](https://iconfont.cn) 上,同时仓库中
|
|||||||
|
|
||||||
字体文件的 base64 URL 通过 [transfonter](https://transfonter.org/) 生成,步骤如下图所示:
|
字体文件的 base64 URL 通过 [transfonter](https://transfonter.org/) 生成,步骤如下图所示:
|
||||||
|
|
||||||
<img src="https://cdn.jsdelivr.net/npm/@vant/assets/icon-transform.png" style="width: 800px;">
|
<img src="https://fastly.jsdelivr.net/npm/@vant/assets/icon-transform.png" style="width: 800px;">
|
||||||
|
|
||||||
### 4. 发布图标库
|
### 4. 发布图标库
|
||||||
|
|
||||||
|
|||||||
@ -16,14 +16,14 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/youzan/vant.git",
|
"url": "https://github.com/vant-ui/vant.git",
|
||||||
"directory": "packages/vant-icons"
|
"directory": "packages/vant-icons"
|
||||||
},
|
},
|
||||||
"bugs": "https://github.com/youzan/vant/issues",
|
"bugs": "https://github.com/vant-ui/vant/issues",
|
||||||
"author": "chenjiahan",
|
"author": "chenjiahan",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"release-it": "^14.11.6"
|
"release-it": "^15.4.1"
|
||||||
},
|
},
|
||||||
"release-it": {
|
"release-it": {
|
||||||
"git": {
|
"git": {
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
/* stylelint-disable selector-pseudo-element-colon-notation */
|
|
||||||
/* stylelint-disable font-family-no-missing-generic-family-keyword */
|
|
||||||
|
|
||||||
.van-icon {
|
.van-icon {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
@import './common.less';
|
@import './common.less';
|
||||||
|
|
||||||
/* stylelint-disable selector-pseudo-element-colon-notation */
|
|
||||||
/* stylelint-disable font-family-no-missing-generic-family-keyword */
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-family: 'vant-icon';
|
font-family: 'vant-icon';
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
# Vant Markdown Vetur
|
|
||||||
|
|
||||||
将 .md 文件转换成能描述 vue 组件的 .json 文件,供 WebStorm 和 vscode 的 `vetur` 插件读取,从而可以在 vue 模版语法中拥有自动补全的功能。
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# with npm
|
|
||||||
npm i @vant/markdown-vetur -D
|
|
||||||
|
|
||||||
# with yarn
|
|
||||||
yarn add @vant/markdown-vetur -D
|
|
||||||
|
|
||||||
# with pnpm
|
|
||||||
pnpm add @vant/markdown-vetur -D
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
#### parseAndWrite
|
|
||||||
|
|
||||||
解析目录下所有匹配的文件,并输出为 tags.json 和 attributes.json
|
|
||||||
|
|
||||||
```ts
|
|
||||||
interface Options {
|
|
||||||
// 需要解析的文件夹路径
|
|
||||||
path: PathLike;
|
|
||||||
// 文件匹配正则
|
|
||||||
test: RegExp;
|
|
||||||
// 输出目录
|
|
||||||
outputDir: string;
|
|
||||||
// 递归的目录最大深度
|
|
||||||
maxDeep?: number;
|
|
||||||
// 解析出来的组件名前缀
|
|
||||||
tagPrefix?: string;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@vant/markdown-vetur",
|
|
||||||
"version": "2.3.0",
|
|
||||||
"description": "simple parse markdown to vue component description for vetur auto-completion",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"dev": "tsc --watch",
|
|
||||||
"build": "rimraf ./lib && tsc",
|
|
||||||
"release": "pnpm build && npm publish",
|
|
||||||
"prepare": "pnpm build"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public",
|
|
||||||
"registry": "https://registry.npmjs.org/"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/youzan/vant.git",
|
|
||||||
"directory": "packages/vant-markdown-vetur"
|
|
||||||
},
|
|
||||||
"bugs": "https://github.com/youzan/vant/issues",
|
|
||||||
"author": "zhangshuai",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"fast-glob": "^3.2.2",
|
|
||||||
"fs-extra": "^10.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/fs-extra": "^9.0.13"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
import glob from 'fast-glob';
|
|
||||||
import { join } from 'path';
|
|
||||||
import { mdParser } from './parser';
|
|
||||||
import { formatter } from './formatter';
|
|
||||||
import { genWebTypes } from './web-types';
|
|
||||||
import { readFileSync, outputFileSync } from 'fs-extra';
|
|
||||||
import { Options, VueTag } from './type';
|
|
||||||
import { normalizePath } from './utils';
|
|
||||||
import { genVeturTags, genVeturAttributes } from './vetur';
|
|
||||||
|
|
||||||
async function readMarkdown(options: Options) {
|
|
||||||
const mds = await glob(normalizePath(`${options.path}/**/*.md`));
|
|
||||||
return mds
|
|
||||||
.filter((md) => options.test.test(md))
|
|
||||||
.map((path) => readFileSync(path, 'utf-8'));
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function parseAndWrite(options: Options) {
|
|
||||||
if (!options.outputDir) {
|
|
||||||
throw new Error('outputDir can not be empty.');
|
|
||||||
}
|
|
||||||
|
|
||||||
const mds = await readMarkdown(options);
|
|
||||||
const vueTags: VueTag[] = [];
|
|
||||||
|
|
||||||
mds.forEach((md) => {
|
|
||||||
const parsedMd = mdParser(md);
|
|
||||||
formatter(vueTags, parsedMd, options.tagPrefix);
|
|
||||||
});
|
|
||||||
|
|
||||||
const webTypes = genWebTypes(vueTags, options);
|
|
||||||
const veturTags = genVeturTags(vueTags);
|
|
||||||
const veturAttributes = genVeturAttributes(vueTags);
|
|
||||||
|
|
||||||
outputFileSync(
|
|
||||||
join(options.outputDir, 'tags.json'),
|
|
||||||
JSON.stringify(veturTags, null, 2)
|
|
||||||
);
|
|
||||||
outputFileSync(
|
|
||||||
join(options.outputDir, 'attributes.json'),
|
|
||||||
JSON.stringify(veturAttributes, null, 2)
|
|
||||||
);
|
|
||||||
outputFileSync(
|
|
||||||
join(options.outputDir, 'web-types.json'),
|
|
||||||
JSON.stringify(webTypes, null, 2)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default { parseAndWrite };
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user