Skip to content

Commit

Permalink
Merge pull request #23 from tolking/dev
Browse files Browse the repository at this point in the history
chore: updata
  • Loading branch information
tolking authored Feb 2, 2022
2 parents b3001c0 + 5b9dc1e commit a8052bf
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

### 2.0.0

feat

- export all function
- use matchAll replace match
- add RegExp for `titleRegExp` `tableRegExp` and `fileNameRegExp`

#### migration guide

``` diff
- const helper = require('../lib/index')
+ const helper = require('../lib/index').default
# or
- const helper = require('../lib/index')
+ const { main } = require('../lib/index')
```

It is recommended to replace regular strings with RegExp

``` diff
{
- titleRegExp: '#+\\s+(.*)\\n+([^(#|\\n)]*)',
+ titleRegExp: /#+\s+(.*)\n+([^(#|\n)]*)/g,

- titleRegExp: '#+\\s+(.*)\\n+>\\s\*([^(#|\\n)]*)',
+ titleRegExp: /#+\s+(.*)\n+>\s\*([^(#|\n)]*)/g,

- tableRegExp: '#+\\s+(.*)\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)',
+ tableRegExp: /#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,

- tableRegExp: '#+\\s+(.*\\s*Props|.*\\s*Events|.*\\s*Slots|.*\\s*Directives)\\s*\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)',
+ tableRegExp: /#+\s+(.*\s*Props|.*\s*Events|.*\s*Slots|.*\s*Directives)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,

- fileNameRegExp: '\\/((\\w|-)+)\\.\\w+$',
+ fileNameRegExp: /\/((\w|-)+)\.\w+$/,
}
```

### 1.0.5

feat
Expand Down
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ npm i components-helper --save-dev
## Usage

``` js
const helper = require('components-helper')
const { main } = require('components-helper')

helper({
main({
// Options
})
```
Expand All @@ -45,7 +45,6 @@ then in package.json

<details>
<summary>TOC</summary>
<br>

- [entry (required)](#entry)
- [outDir (required)](#outdir)
Expand Down Expand Up @@ -82,7 +81,6 @@ then in package.json
- [tableRegExp](#tableregexp)
- [fileNameRegExp](#filenameregexp)

<br>
</details>

### entry
Expand Down Expand Up @@ -317,22 +315,22 @@ name for directives header type

### titleRegExp

- Type: `string` (**This is a regular string.**)
- Default: `#+\\s+(.*)\\n+([^(#|\\n)]*)`
- Type: `RegExp` | `string` (**This is a regular string.**)
- Default: `/#+\s+(.*)\n+([^(#|\n)]*)/g`

matches the title and description information from docs

### tableRegExp

- Type: `string` (**This is a regular string.**)
- Default: `#+\\s+(.*)\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)`
- 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

### fileNameRegExp

- Type: `string` (**This is a regular string.**)
- Default: `\\/((\\w|-)+)\\.\\w+$`
- Type: `RegExp` | `string` (**This is a regular string.**)
- Default: `/\/((\w|-)+)\.\w+$/`

matches the file name from path

Expand All @@ -342,7 +340,7 @@ matches the file name from path

matches the first format information in the docs

#+\\\\s+(`.*`)\\\\n+(`[^(#|\\n)]*`)
/#+\s+(`.*`)\n+(`[^(#|\n)]*`)/

<div>
# <code>title</code>
Expand All @@ -357,7 +355,7 @@ and

matches other formats, For example:

#+\\\\s+(`.*`)\\n+>\\\\s\*(`[^(#|\\n)]*`)
/#+\s+(`.*`)\n+>\s\*(`[^(#|\n)]*`)/g

<div>
# <code>title</code>
Expand All @@ -368,7 +366,7 @@ matches other formats, For example:

matches the format information in the docs

#+\\\\s+(`.*`)\\\\n+(`\\|?.+\\|.+`)\\\\n\\\\|?\\\\s*:?-+:?\\\\s\*\\\\|.+(`(\\n\\|?.+\\|.+)+`)
/#+\s+(`.*`)\n+(`\|?.+\|.+`)\n\|?\s*:?-+:?\s*\|.+(`(\n\|?.+\|.+)+`)/g

<div>
### <code>title</code>
Expand All @@ -390,7 +388,7 @@ and

by default matches all table, Optimize it through tableRegExp, For example:

#+\\\\s+(`.*\\s*Props|.*\\s*Events|.*\\s*Slots|.*\\s*Directives`)\\\\s*\\\\n+(`\\|?.+\\|.+`)\\\\n\\\\|?\\\\s*:?-+:?\\\\s*\\\\|.+(`(\\n\\|?.+\\|.+)+`)
/#+\s+(`.*\s*Props|.*\s*Events|.*\s*Slots|.*\s*Directives`)\n+(`\|?.+\|.+`)\n\|?\s*:?-+:?\s*\|.+(`(\n\|?.+\|.+)+`)/g

<div>
### <code>Props | Events | Slots | Directives</code>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "components-helper",
"version": "1.0.5",
"version": "2.0.0",
"description": "Based on the docs to provide code prompt files for vue component library",
"main": "lib/index.js",
"module": "lib/index.es.js",
Expand Down

0 comments on commit a8052bf

Please sign in to comment.