@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 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
- - 1.Out-of-the-box component library development environment
8
- - 2.Out-of-the-box component library compilation tool, support exporting `esm` and `umd` two module codes
9
- - 3.Component library document site based on configuration files, support Baidu statistics and theme customization
10
- - 4.Supports `single file component (sfc)` and `tsx, jsx` two styles of component library writing styles
11
- - 5.Code inspection tool out of the box
12
- - 6.Unit testing tools out of the box
13
- - 7.Out-of-the-box code publishing tool, publish to npm and github, and automatically generate a change log
14
- - 8.Support `Typescript`
15
- - 9.Support `Dark Mode`
16
- - 10.Based on `pnpm`
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 `single file component (sfc)` and `tsx, jsx` two styles of component library project templates, which can be directly generated by the `gen` command.
21
- To help users directly enter the development of the component itself, it is recommended to use `pnpm` as a package management tool.
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
- # Use the gen command to generate the project
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
- | `name` | Full name of the component library | _string_ | `Varlet` |
47
- | `namespace` | Component library namespace, Will be used as a component prefix | _string_ | `var` |
48
- | `title` | The title of the component library in the document | _string_ | `VARLET` |
49
- | `logo` | The logo of the component library in the document | _string_ | `-` |
50
- | `defaultLanguage` | Document default language | _string_ | `zh-CN` |
51
- | `useMobile` | Whether to display the right mobile phone preview | _boolean_ | `false` |
52
- | `themes` | Document themes | _SiteThemes_ | `-` |
53
- | `darkThemes` | Document dark mode themes | _SiteThemes_ | `-` |
54
- | `highlight` | Document code snippet style related | _SiteHighlight_ | `-` |
55
- | `analysis` | Document statistics related | _SiteAnalysis_ | `-` |
56
- | `pc` | PC-side document structure configuration | _SitePC_ | `-` |
57
- | `mobile` | Mobile document structure configuration | _SiteMobile_ | `-` |
58
- | `moduleCompatible` | Module compatible config | _Record<string, string>_ | `-` |
59
-
60
- #### Module Compatible
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
- import * as dayjs from 'dayjs'
72
- ```
73
-
74
- In the project, we embrace the first way of writing the `esmodule` module, and make the following configuration for adaptation
75
-
76
- ```js
77
- // varlet.config.js
78
- module.exports = {
79
- moduleCompatible: {
80
- "import dayjs from 'dayjs/esm'\n": "import * as dayjs from 'dayjs'\n"
81
- }
82
- }
83
- ```
84
-
85
- #### SiteThemes
86
-
87
- Theme variables are related,
88
- because the default theme variables may be modified from time to time,
89
- subject to the theme of the `varlet` official document
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
- #### SiteAnalysis
137
-
138
- Statistics related to buried points
139
-
140
- | Parameter | Description | Type | Default |
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 Intro
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 <projectName>
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
- ### babel
176
+ #### Create a component template file
278
177
 
279
- To configure `babel`, first specify the target browser in `package.json`
178
+ ```shell
179
+ varlet-cli create
280
180
 
281
- ```json
282
- {
283
- "browserslist": [
284
- "Chrome >= 54",
285
- "iOS >= 10"
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
- create `babel.config,js`
196
+ ### Note before release
291
197
 
292
- ```js
293
- // babel.config.js
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
- ### git and npm
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
- Mount Git Hooks
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
- ```shell
357
- npx simple-git-hooks
205
+ ```js
206
+ import dayjs from 'dayjs/esm'
358
207
  ```
359
208
 
360
- create `.prettierignore`
209
+ In order to build `commonjs`, the writing method is
361
210
 
362
- ```text
363
- // .prettierignore
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
- ### typescript
374
-
375
- create `tsconfig.json`
376
-
377
- ```json
378
- {
379
- "compilerOptions": {
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>