@varlet/cli 2.0.0-alpha.1664332224687 → 2.0.0-alpha.1665387432577
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en-US.md +110 -288
- package/README.md +102 -277
- package/package.json +6 -6
- package/site/components/code-example/CodeExample.vue +6 -6
- package/site/components/progress/Progress.vue +3 -4
- package/site/components/progress/props.ts +9 -12
- package/site/components/utils/components.ts +2 -2
- package/site/mobile/App.vue +7 -6
- package/site/pc/Layout.vue +15 -13
- package/site/pc/components/AppHeader.vue +11 -11
- package/site/pc/components/AppSidebar.vue +1 -2
- package/site/pc/pages/index/index.vue +6 -6
- package/site/useProgress.ts +1 -1
- package/site/utils.ts +6 -0
- package/template/generators/config/default/base/package.json +1 -1
- package/template/generators/config/default/sfc/src/button/docs/zh-CN.md +2 -2
- package/template/generators/config/default/tsx/src/button/docs/zh-CN.md +2 -2
- package/template/generators/config/i18n/base/package.json +1 -1
- package/template/generators/config/i18n/sfc/src/button/Button.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/docs/zh-CN.md +2 -2
- package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +1 -1
- package/template/generators/config/i18n/tsx/src/button/docs/zh-CN.md +2 -2
- package/varlet.default.config.js +1 -1
package/README.en-US.md
CHANGED
|
@@ -4,30 +4,27 @@ The out-of-the-box `Vue3 component library` rapid prototyping tool provides a se
|
|
|
4
4
|
|
|
5
5
|
### Feature
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
7
|
+
- 📦 Out-of-the-box component library development environment
|
|
8
|
+
- 📦 An out-of-the-box component library compilation tool that supports exporting `esm`, `cjs`, `umd` module codes
|
|
9
|
+
- 🛠️ Configuration file-based component library documentation site, support Baidu statistics and theme customization
|
|
10
|
+
- 🛠️ Supports both `sfc` and `tsx` styles for writing component libraries
|
|
11
|
+
- 📦 Out-of-the-box code inspection tool
|
|
12
|
+
- 📦 Out-of-the-box unit testing tools
|
|
13
|
+
- 📦 Out-of-the-box code publishing tool, publishes to both `npm` and `github`, and automatically generates changelogs
|
|
14
|
+
- 💪 Support for `Typescript`
|
|
15
|
+
- 💪 Support `Dark Mode`
|
|
16
|
+
- 🌍 Support `Internationalization`
|
|
17
|
+
- 🚀 Based on `pnpm`
|
|
17
18
|
|
|
18
19
|
### Quickstart
|
|
19
20
|
|
|
20
|
-
`@varlet/cli` has built-in `
|
|
21
|
-
|
|
21
|
+
`@varlet/cli` has built-in `sfc` and `tsx` style component library project templates, which can be generated directly by the `gen` command.
|
|
22
|
+
It is convenient for you to directly enter the component library development.
|
|
22
23
|
|
|
23
24
|
```shell
|
|
24
25
|
# Install command line tools
|
|
25
26
|
pnpm add @varlet/cli -g
|
|
26
|
-
|
|
27
|
-
varlet-cli gen projectName
|
|
28
|
-
cd projectName
|
|
29
|
-
pnpm install
|
|
30
|
-
pnpm dev
|
|
27
|
+
varlet-cli gen
|
|
31
28
|
```
|
|
32
29
|
|
|
33
30
|
Then by simply modifying some basic information of the component library template,
|
|
@@ -37,175 +34,62 @@ you can start the development of the component library
|
|
|
37
34
|
|
|
38
35
|
### Configuration file
|
|
39
36
|
|
|
40
|
-
The `varlet.config.js` in the project root directory is used to manage the specific details of the entire component library project
|
|
37
|
+
The `varlet.config.js` in the project root directory is used to manage the specific details of the entire component library project.
|
|
38
|
+
The default configuration can be viewed [varlet.default.config.js](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/varlet.default.config.js)。
|
|
39
|
+
Also refer to `@varlet/ui` [varlet.config.js](https://github.com/varletjs/varlet/blob/dev/packages/varlet-ui/varlet.config.js)
|
|
41
40
|
|
|
42
41
|
| Parameter | Description | Type | Default |
|
|
43
|
-
|
|
|
42
|
+
| -- | -------------- | -------- | ---------- |
|
|
43
|
+
| `name` | The full name of the component library, which will be used as the package name | _string_ | `Varlet` |
|
|
44
|
+
| `namespace` | Component library namespace, which will be used as a component prefix | _string_ | `var` |
|
|
44
45
|
| `host` | Development server host | _number_ | `localhost` |
|
|
45
46
|
| `port` | Development server port | _number_ | `8080` |
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Some external dependencies may need to be compatible with module syntax to achieve the purpose of compiling correctly to `commonjs` and `esmodule`. For example, the wording of `esmodule` of `dayjs` is
|
|
63
|
-
|
|
64
|
-
```js
|
|
65
|
-
import dayjs from 'dayjs/esm'
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
In order to build `commonjs`, the writing method is
|
|
47
|
+
| `title` | The title of the component library in the documentation | _string_ | `VARLET` |
|
|
48
|
+
| `logo` | The logo of the component library in the documentation | _string_ | `-` |
|
|
49
|
+
| `defaultLanguage` | Documentation default language | _string_ | `zh-CN` |
|
|
50
|
+
| `useMobile` | Whether to show the preview of the right mobile phone | _boolean_ | `false` |
|
|
51
|
+
| `lightTheme` | Light Mode Documentation Theme | _Record<string, any>_ | `-` |
|
|
52
|
+
| `darkTheme` | Dark Mode Documentation Theme | _Record<string, any>_ | `-` |
|
|
53
|
+
| `highlight` | Documentation snippet style related | _{ style: string }_ | `-` |
|
|
54
|
+
| `analysis` | Document statistics related | _{ baidu: string }_ | `-` |
|
|
55
|
+
| `pc` | PC-side document structure configuration | _Record<string, any>_ | `-` |
|
|
56
|
+
| `mobile` | Mobile side document structure configuration | _Record<string, any>_ | `-` |
|
|
57
|
+
| `moduleCompatible` | Module Compatible Configurations | _Record<string, string>_ | `-` |
|
|
58
|
+
|
|
59
|
+
### Custom pages
|
|
60
|
+
|
|
61
|
+
If you want to insert other pages into the component library, you can create a `pages` folder in the project root directory to write a vue component to generate other pages.
|
|
62
|
+
The directory structure is as follows:
|
|
69
63
|
|
|
70
64
|
```js
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
| Variable |
|
|
92
|
-
| ----- |
|
|
93
|
-
| `color-body` |
|
|
94
|
-
| `color-bar` |
|
|
95
|
-
| `color-sub-bar` |
|
|
96
|
-
| `color-text` |
|
|
97
|
-
| `color-sub-text` |
|
|
98
|
-
| `color-border` |
|
|
99
|
-
| `color-shadow` |
|
|
100
|
-
| `color-introduce-border` |
|
|
101
|
-
| `color-primary` |
|
|
102
|
-
| `color-link` |
|
|
103
|
-
| `color-type` |
|
|
104
|
-
| `color-progress` |
|
|
105
|
-
| `color-progress-track` |
|
|
106
|
-
| `color-side-bar` |
|
|
107
|
-
| `color-side-bar-active-background` |
|
|
108
|
-
| `color-app-bar` |
|
|
109
|
-
| `color-nav-button-hover-background` |
|
|
110
|
-
| `color-mobile-cell-hover` |
|
|
111
|
-
| `color-pc-language-active` |
|
|
112
|
-
| `color-pc-language-active-background` |
|
|
113
|
-
| `color-mobile-language-active` |
|
|
114
|
-
| `color-mobile-language-active-background` |
|
|
115
|
-
| `color-hl-background` |
|
|
116
|
-
| `color-hl-code` |
|
|
117
|
-
| `color-hl-border` |
|
|
118
|
-
| `color-hl-group-a` |
|
|
119
|
-
| `color-hl-group-b` |
|
|
120
|
-
| `color-hl-group-c` |
|
|
121
|
-
| `color-hl-group-d` |
|
|
122
|
-
| `color-hl-group-e` |
|
|
123
|
-
| `color-hl-group-f` |
|
|
124
|
-
| `color-hl-group-g` |
|
|
125
|
-
| `color-hl-group-h` |
|
|
126
|
-
| `color-hl-group-i` |
|
|
127
|
-
|
|
128
|
-
#### SiteHighlight
|
|
129
|
-
|
|
130
|
-
Code snippets are highlighted, based on [highlight.js](https://highlightjs.org/)
|
|
131
|
-
|
|
132
|
-
| Parameter | Description | Type | Default |
|
|
133
|
-
| ----- | -------------- | -------- | ---------- |
|
|
134
|
-
| `style` | highlight css link | _string_ | `-` |
|
|
65
|
+
|-- varlet-ui
|
|
66
|
+
|-- src
|
|
67
|
+
|-- docs
|
|
68
|
+
|-- pages
|
|
69
|
+
|-- sponsor
|
|
70
|
+
|-- index.vue
|
|
71
|
+
|-- contributor
|
|
72
|
+
|-- locale
|
|
73
|
+
|-- en-US.ts
|
|
74
|
+
|-- index.vue
|
|
75
|
+
|-- changelog
|
|
76
|
+
|-- locale
|
|
77
|
+
|-- zh-CN.ts
|
|
78
|
+
|-- en-US.ts
|
|
79
|
+
|-- index.vue
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The resulting route is as follows:
|
|
135
84
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
| ----- | -------------- | -------- | ---------- |
|
|
142
|
-
| `baidu` | Baidu statistics script address | _string_ | `-` |
|
|
143
|
-
|
|
144
|
-
#### SitePC, SiteMobile
|
|
145
|
-
|
|
146
|
-
The document structure is partly related, and the example configuration is as follows
|
|
147
|
-
|
|
148
|
-
```js
|
|
149
|
-
module.exports = {
|
|
150
|
-
defaultLanguage: 'en-US',
|
|
151
|
-
pc: {
|
|
152
|
-
redirect: '/home',
|
|
153
|
-
title: {
|
|
154
|
-
'en-US': 'A components library',
|
|
155
|
-
},
|
|
156
|
-
header: {
|
|
157
|
-
darkMode: null,
|
|
158
|
-
i18n: null,
|
|
159
|
-
github: 'https://github.com/varletjs/varlet',
|
|
160
|
-
},
|
|
161
|
-
menu: [
|
|
162
|
-
{
|
|
163
|
-
text: {
|
|
164
|
-
'en-US': 'Develop Guide',
|
|
165
|
-
},
|
|
166
|
-
// Sidebar menu directory
|
|
167
|
-
type: 1,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
text: {
|
|
171
|
-
'en-US': 'Basic Intro',
|
|
172
|
-
},
|
|
173
|
-
doc: 'home',
|
|
174
|
-
// Index the md document in the root directory of the project
|
|
175
|
-
type: 3,
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
text: {
|
|
179
|
-
'en-US': 'Basic Component',
|
|
180
|
-
},
|
|
181
|
-
type: 1,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
text: {
|
|
185
|
-
'en-US': 'Button',
|
|
186
|
-
},
|
|
187
|
-
doc: 'button',
|
|
188
|
-
// Md document in the root directory of the index component
|
|
189
|
-
type: 2,
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
},
|
|
193
|
-
mobile: {
|
|
194
|
-
redirect: '/home',
|
|
195
|
-
title: {
|
|
196
|
-
'en-US': 'A components library',
|
|
197
|
-
},
|
|
198
|
-
header: {
|
|
199
|
-
darkMode: null,
|
|
200
|
-
i18n: null,
|
|
201
|
-
playground: null,
|
|
202
|
-
github: 'https://github.com/varletjs/varlet',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
}
|
|
85
|
+
```text
|
|
86
|
+
/zh-CN/sponsor
|
|
87
|
+
/en-US/contributor
|
|
88
|
+
/zh-CN/changelog
|
|
89
|
+
/en-US/changelog
|
|
206
90
|
```
|
|
207
91
|
|
|
208
|
-
### Commands
|
|
92
|
+
### Commands related
|
|
209
93
|
|
|
210
94
|
#### Start the development server
|
|
211
95
|
|
|
@@ -270,133 +154,71 @@ varlet-cli release
|
|
|
270
154
|
```
|
|
271
155
|
|
|
272
156
|
#### Generate a project template
|
|
157
|
+
|
|
273
158
|
```shell
|
|
274
|
-
varlet-cli gen
|
|
159
|
+
varlet-cli gen
|
|
160
|
+
|
|
161
|
+
# Options
|
|
162
|
+
-n
|
|
163
|
+
--name
|
|
164
|
+
project name
|
|
165
|
+
-s
|
|
166
|
+
--sfc
|
|
167
|
+
Generate sfc-style project templates
|
|
168
|
+
-t
|
|
169
|
+
--tsx
|
|
170
|
+
Generate tsx-style project templates
|
|
171
|
+
-l
|
|
172
|
+
--locale
|
|
173
|
+
Need to support internationalization
|
|
275
174
|
```
|
|
276
175
|
|
|
277
|
-
|
|
176
|
+
#### Create a component template file
|
|
278
177
|
|
|
279
|
-
|
|
178
|
+
```shell
|
|
179
|
+
varlet-cli create
|
|
280
180
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
181
|
+
# Options
|
|
182
|
+
-n
|
|
183
|
+
--name
|
|
184
|
+
project name
|
|
185
|
+
-s
|
|
186
|
+
--sfc
|
|
187
|
+
Generate sfc-style component
|
|
188
|
+
-t
|
|
189
|
+
--tsx
|
|
190
|
+
Generate tsx-style component
|
|
191
|
+
-l
|
|
192
|
+
--locale
|
|
193
|
+
Need to support internationalization
|
|
288
194
|
```
|
|
289
195
|
|
|
290
|
-
|
|
196
|
+
### Note before release
|
|
291
197
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
module.exports = {
|
|
295
|
-
presets: [
|
|
296
|
-
[
|
|
297
|
-
'@varlet/cli/preset',
|
|
298
|
-
{
|
|
299
|
-
loose: process.env.NODE_ENV === 'compile',
|
|
300
|
-
},
|
|
301
|
-
],
|
|
302
|
-
],
|
|
303
|
-
}
|
|
304
|
-
```
|
|
198
|
+
- 1.`npm` repository registry must set to `npm` official mirror
|
|
199
|
+
- 2.Execute `npm login` to log in
|
|
305
200
|
|
|
306
|
-
###
|
|
307
|
-
|
|
308
|
-
#### git-hook
|
|
309
|
-
|
|
310
|
-
`simple-git-hooks`, `lint-staged` cooperate with `eslint`, `stylelint`, `varlet-cli commit-lint` to check before commit,
|
|
311
|
-
`package.json` configuration is as follows
|
|
312
|
-
|
|
313
|
-
```json
|
|
314
|
-
{
|
|
315
|
-
"simple-git-hooks": {
|
|
316
|
-
"pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
|
|
317
|
-
"commit-msg": "npx --no-install varlet-cli commit-lint $1"
|
|
318
|
-
},
|
|
319
|
-
"lint-staged": {
|
|
320
|
-
"*.{ts,tsx,js,vue,less}": "prettier --write",
|
|
321
|
-
"*.{ts,tsx,js,vue}": "eslint --fix",
|
|
322
|
-
"*.{vue,css,less}": "stylelint --fix"
|
|
323
|
-
},
|
|
324
|
-
"eslintConfig": {
|
|
325
|
-
"root": true,
|
|
326
|
-
"ignorePatterns": [
|
|
327
|
-
"es/**",
|
|
328
|
-
"umd/**",
|
|
329
|
-
"site/**",
|
|
330
|
-
"public/**",
|
|
331
|
-
"src/*/__tests__/**",
|
|
332
|
-
".varlet/**"
|
|
333
|
-
],
|
|
334
|
-
"extends": [
|
|
335
|
-
"@varlet"
|
|
336
|
-
]
|
|
337
|
-
},
|
|
338
|
-
"stylelint": {
|
|
339
|
-
"extends": [
|
|
340
|
-
"@varlet/stylelint-config"
|
|
341
|
-
],
|
|
342
|
-
"ignoreFiles": [
|
|
343
|
-
"es/**",
|
|
344
|
-
"umd/**",
|
|
345
|
-
"site/**",
|
|
346
|
-
"coverage/**",
|
|
347
|
-
"public/**",
|
|
348
|
-
"highlight/**"
|
|
349
|
-
]
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
```
|
|
201
|
+
### Module Compatible
|
|
353
202
|
|
|
354
|
-
|
|
203
|
+
Some external dependencies may need to be compatible with module syntax to achieve the purpose of compiling correctly to `commonjs` and `esmodule`. For example, the wording of `esmodule` of `dayjs` is
|
|
355
204
|
|
|
356
|
-
```
|
|
357
|
-
|
|
205
|
+
```js
|
|
206
|
+
import dayjs from 'dayjs/esm'
|
|
358
207
|
```
|
|
359
208
|
|
|
360
|
-
|
|
209
|
+
In order to build `commonjs`, the writing method is
|
|
361
210
|
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
coverage/**
|
|
365
|
-
es/**
|
|
366
|
-
umd/**
|
|
367
|
-
site/**
|
|
368
|
-
public/**
|
|
369
|
-
src/*/__tests__/**
|
|
370
|
-
*.md
|
|
211
|
+
```js
|
|
212
|
+
import * as dayjs from 'dayjs'
|
|
371
213
|
```
|
|
372
214
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
"strict": true,
|
|
381
|
-
"downlevelIteration": true,
|
|
382
|
-
"declaration": true,
|
|
383
|
-
"skipLibCheck": true,
|
|
384
|
-
"esModuleInterop": true,
|
|
385
|
-
"allowJs": true,
|
|
386
|
-
"lib": ["esnext", "dom"],
|
|
387
|
-
"allowSyntheticDefaultImports": true,
|
|
388
|
-
"jsx": "preserve"
|
|
215
|
+
In the project, we embrace the first way of writing the `esmodule` module, and make the following configuration for adaptation
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
// varlet.config.js
|
|
219
|
+
module.exports = {
|
|
220
|
+
moduleCompatible: {
|
|
221
|
+
"import dayjs from 'dayjs/esm'\n": "import * as dayjs from 'dayjs'\n"
|
|
389
222
|
}
|
|
390
223
|
}
|
|
391
224
|
```
|
|
392
|
-
|
|
393
|
-
#### Note before release
|
|
394
|
-
|
|
395
|
-
- 1.The registry of npm must set to the official npm mirror
|
|
396
|
-
- 2.The npm must execute the login command for user login
|
|
397
|
-
|
|
398
|
-
### Contributors
|
|
399
|
-
|
|
400
|
-
<a href="https://github.com/varletjs/varlet/graphs/contributors">
|
|
401
|
-
<img src="https://contrib.rocks/image?repo=haoziqaq/varlet" />
|
|
402
|
-
</a>
|