$git clone https://github.com/tolking/components-helper:warning: This library is no longer maintained.
| 1 | :warning: This library is no longer maintained. |
| 2 | |
| 3 | With the [WebStorm](https://blog.jetbrains.com/webstorm/2023/05/webstorm-2023-2-eap2/#volar_support_for_vue) support of [Volar](https://github.com/vuejs/language-tools#readme), you may no longer need this library. |
| 4 | |
| 5 | It is more recommended that you use Volar's code prompt by improving the type declaration. |
| 6 | |
| 7 | If you still need this library, you can continue to use it, but this library will no longer have new feature updates. |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | # components-helper |
| 12 | |
| 13 | > Based on the documents to provide code prompt files for vue component library |
| 14 | |
| 15 | Reference documents format reference test files |
| 16 | |
| 17 | [Changelog](./CHANGELOG.md) |
| 18 | |
| 19 | ## Installation |
| 20 | |
| 21 | ``` sh |
| 22 | yarn add components-helper -D |
| 23 | # or |
| 24 | npm i components-helper --save-dev |
| 25 | ``` |
| 26 | |
| 27 | ## Usage |
| 28 | |
| 29 | ``` js |
| 30 | const { main } = require('components-helper') |
| 31 | |
| 32 | main({ |
| 33 | // Options |
| 34 | }) |
| 35 | ``` |
| 36 | |
| 37 | [example](./test/index.js) |
| 38 | |
| 39 | then in package.json |
| 40 | |
| 41 | ``` diff |
| 42 | { |
| 43 | "scripts": { |
| 44 | + "build:helper": "node helper/file.js" |
| 45 | }, |
| 46 | + "vetur": { |
| 47 | + "tags": "config outDir/tags.json", |
| 48 | + "attributes": "config outDir/attributes.json" |
| 49 | + }, |
| 50 | + "web-types": "config outDir/web-types.json" |
| 51 | } |
| 52 | ``` |
| 53 | |
| 54 | ## Options |
| 55 | |
| 56 | <details> |
| 57 | <summary>TOC</summary> |
| 58 | |
| 59 | - [entry (required)](#entry) |
| 60 | - [fastGlobConfig](#fastglobconfig) |
| 61 | - [outDir (required)](#outdir) |
| 62 | - [name (required)](#name) |
| 63 | - [version (required)](#version) |
| 64 | - [space](#space) |
| 65 | - [separator](#separator) |
| 66 | - [reComponentName](#recomponentname) |
| 67 | - [reDocUrl](#redocurl) |
| 68 | - [reAttribute](#reattribute) |
| 69 | - [reVeturDescription](#reveturdescription) |
| 70 | - [reWebTypesSource](#rewebtypessource) |
| 71 | - [reWebTypesType](#rewebtypestype) |
| 72 | - [tags](#tags) |
| 73 | - [attributes](#attributes) |
| 74 | - [webTypes](#webtypes) |
| 75 | - [props](#props) |
| 76 | - [propsName](#propsname) |
| 77 | - [propsDescription](#propsdescription) |
| 78 | - [propsType](#propstype) |
| 79 | - [propsOptions](#propsoptions) |
| 80 | - [propsDefault](#propsdefault) |
| 81 | - [events](#events) |
| 82 | - [eventsName](#eventsname) |
| 83 | - [eventsDescription](#eventsdescription) |
| 84 | - [slots](#slots) |
| 85 | - [slotsName](#slotsname) |
| 86 | - [slotsDescription](#slotsdescription) |
| 87 | - [slotsType](#slotsType) |
| 88 | - [slotsSubtags](#slotssubtags) |
| 89 | - [directives](#directives) |
| 90 | - [directivesName](#directivesname) |
| 91 | - [directivesDescription](#directivesdescription) |
| 92 | - [directivesType](#directivestype) |
| 93 | - [titleRegExp](#titleregexp) |
| 94 | - [tableRegExp](#tableregexp) |
| 95 | - [fileNameRegExp](#filenameregexp) |
| 96 | |
| 97 | </details> |
| 98 | |
| 99 | ### entry |
| 100 | |
| 101 | - Required: `true` |
| 102 | - Type: `string` | `string[]` |
| 103 | |
| 104 | Specify the entry directory. refer: [fast-glob](https://github.com/mrmlnc/fast-glob#pattern-syntax) |
| 105 | |
| 106 | for example: |
| 107 | - `docs/*.md` -- matches all files in the docs |
| 108 | - `docs/(a|b).md` -- matches files `a.md` and `b.md` |
| 109 | - `docs/!(a|b).md` -- matches files except for `a.md` and `b.md` |
| 110 | |
| 111 | ### fastGlobConfig |
| 112 | |
| 113 | - Type: `object` |
| 114 | |
| 115 | The config of [fast-glob](https://github.com/mrmlnc/fast-glob#options-3) |
| 116 | |
| 117 | ### outDir |
| 118 | |
| 119 | - Required: `true` |
| 120 | - Type: `string` |
| 121 | |
| 122 | Specify the output directory. For example, `lib`` |
| 123 | |
| 124 | ### name |
| 125 | |
| 126 | - Required: `true` |
| 127 | - Type: `string` |
| 128 | |
| 129 | name of the component library. |
| 130 | |
| 131 | ### version |
| 132 | |
| 133 | - Required: `true` |
| 134 | - Type: `string` |
| 135 | |
| 136 | the version of the component library. |
| 137 | |
| 138 | ### space |
| 139 | |
| 140 | - Type: `number` | `string` |
| 141 | |
| 142 | Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read |
| 143 | |
| 144 | ### separator |
| 145 | |
| 146 | - Type: `string` |
| 147 | - Default: `/` |
| 148 | |
| 149 | the separator for propsOptions, slotsSubtags, type ... |
| 150 | |
| 151 | ### reComponentName |
| 152 | |
| 153 | - Type: `(title: string, fileName: string, path: string) => string` |
| 154 | - Defult: `hyphenate(title || fileName)` |
| 155 | |
| 156 | rewriting the name of the component |
| 157 | |
| 158 | for example `(title) => 'prefix-' + title.replace(/\B([A-Z])/g, '-$1').toLowerCase()` |
| 159 | |
| 160 | ### reDocUrl |
| 161 | |
| 162 | - Type: `(fileName: string, header?: string, path: string) => string | undefind` |
| 163 | |
| 164 | rewriting the doc url of the component |
| 165 | |
| 166 | ### reAttribute |
| 167 | |
| 168 | - Type: `(value: string, key: string, row: string[], title: string) => string | undefined` |
| 169 | |
| 170 | ##### arg |
| 171 | |
| 172 | - value: current value |
| 173 | - key: the key value of the current column |
| 174 | - row: all values of the current row |
| 175 | - title: the title of current tabel |
| 176 | |
| 177 | rewriting the attribute of the |