From 4af560573fec178311f4941d9ba422fdf390cbba Mon Sep 17 00:00:00 2001 From: tolking Date: Sun, 4 Sep 2022 18:10:09 +0800 Subject: [PATCH 1/2] docs: update --- README.md | 40 +++++++++++++++++++++------------------- test/demo.md | 6 ++++++ test/mult.md | 4 ++-- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9176d95..ef2a4ee 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ then in package.json
TOC - - [entry (required)](#entry) - [outDir (required)](#outdir) - [name (required)](#name) @@ -57,6 +56,7 @@ then in package.json - [reAttribute](#reattribute) - [reVeturDescription](#reveturdescription) - [reWebTypesSource](#rewebtypessource) +- [reWebTypesType](#rewebtypestype) - [tags](#tags) - [attributes](#attributes) - [webTypes](#webtypes) @@ -80,7 +80,6 @@ then in package.json - [titleRegExp](#titleregexp) - [tableRegExp](#tableregexp) - [fileNameRegExp](#filenameregexp) -
### entry @@ -93,16 +92,14 @@ entry path, refer: [fast-glob](https://github.com/mrmlnc/fast-glob#pattern-synta for example: - `docs/*.md` -- matches all files in the docs - `docs/(a|b).md` -- matches files `a.md` and `b.md` - - `docs/!(a|b).md` -- matches files except `a.md` and `b.md` + - `docs/!(a|b).md` -- matches files except for `a.md` and `b.md` ### outDir - Required: `true` - Type: `string` -outDir path - -For example: `lib` +outDir path, For example `lib` ### name @@ -116,7 +113,7 @@ name of the component library. - Required: `true` - Type: `string` -version of the component library. +the version of the component library. ### space @@ -138,7 +135,7 @@ the separator for propsOptions, slotsSubtags, type ... rewriting the name of the component -for example: `(title) => 'prefix-' + title.replace(/\B([A-Z])/g, '-$1').toLowerCase()` +for example `(title) => 'prefix-' + title.replace(/\B([A-Z])/g, '-$1').toLowerCase()` ### reDocUrl @@ -168,10 +165,15 @@ rewriting the description of vetur ### reWebTypesSource -- Type: `(title: string, fileName: string, path: string) => { module?: string; symbol: string } | { file: string; offset: number }` -- Default: `{ symbol: title }` +- Type: `(title: string, fileName: string, path: string) => Source` + +rewriting the source of web-types. (the name of export from the component library) + +### reWebTypesType + +- Type: `(type: string) => undefined | string | BaseContribution` -rewriting the source of web-types. (the name of export from conmonents library) +Only some common types are processed internally, and the rest are exported from the component library by default. If your document also references types in third-party libraries, you can choose to override the relevant behavior through this function ### tags @@ -206,7 +208,7 @@ name of props table. **other string in the header will be identified as sub-comp - Type: `string` - Default: `Name` -name for props header name +name for the props header name ### propsDescription @@ -248,7 +250,7 @@ name of events table. **other string in the header will be identified as sub-com - Type: `string` - Default: `Name` -name for events header name +name for the events header name ### eventsDescription @@ -269,7 +271,7 @@ name of slots table. **other string in the header will be identified as sub-comp - Type: `string` - Default: `Name` -name for slots header name +name for the slots header name ### slotsDescription @@ -297,7 +299,7 @@ name of directives table. **other string in the header will be identified as sub - Type: `string` - Default: `Name` -name for directives header name +name for the directives header name ### directivesDescription @@ -325,14 +327,14 @@ matches the title and description information from docs - Type: `RegExp` | `string` (**This is a regular string.**) - Default: `/#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g` -matches the title and table header and table content information from docs +matches the title and table header and the table contains information from docs ### fileNameRegExp - Type: `RegExp` | `string` (**This is a regular string.**) - Default: `/\/((\w|-)+)\.\w+$/` -matches the file name from path +matches the file name from the path ## Advancement @@ -386,7 +388,7 @@ and
| column |
-by default matches all table, Optimize it through tableRegExp, For example: +by default matches all tables, Optimize it through tableRegExp, For example: /#+\s+(`.*\s*Props|.*\s*Events|.*\s*Slots|.*\s*Directives`)\n+(`\|?.+\|.+`)\n\|?\s*:?-+:?\s*\|.+(`(\n\|?.+\|.+)+`)/g @@ -410,7 +412,7 @@ and ### other -- When this docs not included the primary title or `Props` `Events` `Slots` and `Directives`, this component are not created. +When this document does not include the primary title or `Props` `Events` `Slots` and `Directives`, this component is not created. ## License diff --git a/test/demo.md b/test/demo.md index ddfcfe4..d814977 100644 --- a/test/demo.md +++ b/test/demo.md @@ -13,6 +13,12 @@ This is a description of the Demo component | v-model | bind value | string | top / bottom || + ## Events diff --git a/test/mult.md b/test/mult.md index d86803a..7f35309 100644 --- a/test/mult.md +++ b/test/mult.md @@ -18,7 +18,7 @@ This is a description of the Third component | Name | Description | Type | Options | Default | |----- |------------ |----- |-------- | ------- | -| v-model | bind value | string | top / bottom | top | +| v-model | bind value | string / number || top | ## First Slots @@ -30,7 +30,7 @@ This is a description of the Third component | Name | Description | Type | Options | Default | |----- |------------ |----- |-------- | ------- | -| v-model | bind value | string | top / bottom || +| v-model | bind value | string / number ||| ## Third Events From 94419a00118e4784c4c1bef4878578f5f0687bb4 Mon Sep 17 00:00:00 2001 From: tolking Date: Sun, 4 Sep 2022 18:24:22 +0800 Subject: [PATCH 2/2] chore: update --- CHANGELOG.md | 7 +++++++ package.json | 2 +- test/demo.md | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a961ebe..71ed22c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### 2.1.1 + +feat + +- add config reWebTypesType +- improve types for web-types + ### 2.1.0 feat diff --git a/package.json b/package.json index b5abb8c..2c60c5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "components-helper", - "version": "2.1.0", + "version": "2.1.1", "description": "Based on the docs to provide code prompt files for vue component library", "main": "lib/index.js", "module": "lib/index.es.js", diff --git a/test/demo.md b/test/demo.md index d814977..5fafb4b 100644 --- a/test/demo.md +++ b/test/demo.md @@ -16,7 +16,7 @@ This is a description of the Demo component