@oneblink/release-cli 2.0.3 → 2.1.0-beta.2
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/dist/bin.js +2 -2
- package/dist/startReleaseProcess.js +1 -1
- package/node_modules/changelog-parser/.github/dependabot.yml +17 -0
- package/node_modules/changelog-parser/.github/workflows/tests.yml +25 -0
- package/node_modules/changelog-parser/CHANGELOG.md +51 -19
- package/node_modules/changelog-parser/README.md +35 -13
- package/node_modules/changelog-parser/bin/cli.js +3 -3
- package/node_modules/changelog-parser/index.js +19 -19
- package/node_modules/changelog-parser/log.png +0 -0
- package/node_modules/changelog-parser/package.json +12 -9
- package/node_modules/changelog-parser/test/fixtures/CHANGELOG.md +6 -0
- package/node_modules/changelog-parser/test/fixtures/expected.js +23 -9
- package/node_modules/changelog-parser/test/fixtures/remove-markdown-expected.js +23 -9
- package/node_modules/changelog-parser/test/index.js +20 -20
- package/node_modules/remove-markdown/.circleci/config.yml +84 -0
- package/node_modules/remove-markdown/LICENSE +0 -0
- package/node_modules/remove-markdown/README.md +7 -4
- package/node_modules/remove-markdown/index.js +48 -12
- package/node_modules/remove-markdown/package.json +1 -1
- package/node_modules/remove-markdown/test/remove-markdown.js +56 -8
- package/package.json +20 -20
- package/patches/{changelog-parser+2.8.0.patch → changelog-parser+3.0.1.patch} +5 -5
- package/node_modules/changelog-parser/.DS_Store +0 -0
- package/node_modules/changelog-parser/.travis.yml +0 -7
- package/node_modules/remove-markdown/.npmignore +0 -1
package/dist/bin.js
CHANGED
|
@@ -102,7 +102,7 @@ ${dependenciesChangelogEntries}
|
|
|
102
102
|
catch (error) {
|
|
103
103
|
// ignore errors attempting to find prettier configuration
|
|
104
104
|
}
|
|
105
|
-
const changelog = prettier.format(`
|
|
105
|
+
const changelog = await prettier.format(`
|
|
106
106
|
# ${parsedChangelog.title}
|
|
107
107
|
|
|
108
108
|
${parsedChangelog.description || ''}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Basic dependabot.yml file with
|
|
2
|
+
# minimum configuration for two package managers
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
# Enable version updates for npm
|
|
7
|
+
- package-ecosystem: "npm"
|
|
8
|
+
# Look for `package.json` and `lock` files in the `root` directory
|
|
9
|
+
directory: "/"
|
|
10
|
+
# Check the npm registry for updates every day (weekdays)
|
|
11
|
+
schedule:
|
|
12
|
+
interval: "daily"
|
|
13
|
+
# Enable updates to github actions
|
|
14
|
+
- package-ecosystem: "github-actions"
|
|
15
|
+
directory: "/"
|
|
16
|
+
schedule:
|
|
17
|
+
interval: "daily"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tests
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
node: [14, 16, 18]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v3
|
|
21
|
+
- uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node }}
|
|
24
|
+
- run: npm i
|
|
25
|
+
- run: npm test
|
|
@@ -5,55 +5,87 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [3.0.1](https://github.com/ungoldman/changelog-parser/compare/v3.0.0...v3.0.1) - 2022-12-23
|
|
9
|
+
|
|
10
|
+
### Fixes
|
|
11
|
+
|
|
12
|
+
- fix(pkg): specify minimum supported node version (14)
|
|
13
|
+
|
|
14
|
+
## [3.0.0](https://github.com/ungoldman/changelog-parser/compare/v2.8.1...v3.0.0) - 2022-12-20
|
|
15
|
+
|
|
16
|
+
### Breaking Changes
|
|
17
|
+
|
|
18
|
+
- Drop support for Node 12 (EOL)
|
|
19
|
+
|
|
20
|
+
### Fixes
|
|
21
|
+
|
|
22
|
+
- parse dates in parentheses (#49)
|
|
23
|
+
|
|
24
|
+
### Misc
|
|
25
|
+
|
|
26
|
+
- deps: remove-markdown@0.5.0 (#44)
|
|
27
|
+
|
|
28
|
+
## [2.8.1](https://github.com/ungoldman/changelog-parser/compare/v2.8.0...v2.8.1) - 2022-03-13
|
|
29
|
+
|
|
30
|
+
### Fixes
|
|
31
|
+
|
|
32
|
+
- ci: drop support for non-LTS node versions (#39)
|
|
33
|
+
- fix: update URLs for ownership transfer
|
|
34
|
+
- ci: add dependabot.yml
|
|
35
|
+
- docs: update status badges
|
|
36
|
+
- deps(dev): tape@5, tap-spec@5, standard@16, gh-release@6 (#38)
|
|
37
|
+
- ci: multi-arch tests (mac, windows, linux)
|
|
38
|
+
- docs: add examples to options
|
|
39
|
+
|
|
40
|
+
## [2.8.0](https://github.com/ungoldman/changelog-parser/compare/v2.7.0...v2.8.0) - 2019-05-02
|
|
9
41
|
|
|
10
42
|
### Features
|
|
11
43
|
|
|
12
44
|
- accept input text instead of file (#32) - @jedwards1211 & @ungoldman
|
|
13
45
|
|
|
14
|
-
## [2.7.0](https://github.com/
|
|
46
|
+
## [2.7.0](https://github.com/ungoldman/changelog-parser/compare/v2.6.0...v2.7.0) - 2019-03-07
|
|
15
47
|
|
|
16
48
|
### Features
|
|
17
49
|
|
|
18
50
|
- accept options object, add removeMarkdown option (#29) - @cironunes & @ungoldman
|
|
19
51
|
|
|
20
|
-
## [2.6.0](https://github.com/
|
|
52
|
+
## [2.6.0](https://github.com/ungoldman/changelog-parser/compare/v2.5.0...v2.5.1) - 2018-12-18
|
|
21
53
|
|
|
22
54
|
### Features
|
|
23
55
|
|
|
24
56
|
- allow version headers in CHANGELOG to use either H1 (#) or H2 (##) headers (#14) - @eladb
|
|
25
57
|
|
|
26
|
-
## [2.5.1](https://github.com/
|
|
58
|
+
## [2.5.1](https://github.com/ungoldman/changelog-parser/compare/v2.5.0...v2.5.1) - 2018-12-05
|
|
27
59
|
|
|
28
60
|
### Fixes
|
|
29
61
|
|
|
30
62
|
- Protect against no current value (#24) - thanks @sabrehagen
|
|
31
63
|
|
|
32
|
-
## [2.5.0](https://github.com/
|
|
64
|
+
## [2.5.0](https://github.com/ungoldman/changelog-parser/compare/v2.4.0...v2.5.0) - 2018-05-30
|
|
33
65
|
|
|
34
66
|
### Features
|
|
35
67
|
|
|
36
68
|
- add international date format support (#25) - thanks @godban
|
|
37
69
|
|
|
38
|
-
## [2.4.0](https://github.com/
|
|
70
|
+
## [2.4.0](https://github.com/ungoldman/changelog-parser/compare/v2.3.0...v2.4.0) - 2018-02-13
|
|
39
71
|
|
|
40
72
|
### Features
|
|
41
73
|
|
|
42
74
|
- stringify results in CLI (#22) - thanks @benmonro
|
|
43
75
|
|
|
44
|
-
## [2.3.0](https://github.com/
|
|
76
|
+
## [2.3.0](https://github.com/ungoldman/changelog-parser/compare/v2.2.0...v2.3.0) - 2018-01-09
|
|
45
77
|
|
|
46
78
|
### Features
|
|
47
79
|
|
|
48
80
|
- add support for parsed body (#20) (#21) - thanks @jrmykolyn
|
|
49
81
|
|
|
50
|
-
## [2.2.0](https://github.com/
|
|
82
|
+
## [2.2.0](https://github.com/ungoldman/changelog-parser/compare/v2.1.0...v2.2.0) - 2017-12-29
|
|
51
83
|
|
|
52
84
|
### Features
|
|
53
85
|
|
|
54
86
|
- add promise support (#18) (#19) - thanks @jrmykolyn
|
|
55
87
|
|
|
56
|
-
## [2.1.0](https://github.com/
|
|
88
|
+
## [2.1.0](https://github.com/ungoldman/changelog-parser/compare/v2.0.5...v2.1.0) - 2017-12-12
|
|
57
89
|
|
|
58
90
|
### Features
|
|
59
91
|
|
|
@@ -63,7 +95,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
63
95
|
|
|
64
96
|
- add release script
|
|
65
97
|
|
|
66
|
-
## [2.0.5](https://github.com/
|
|
98
|
+
## [2.0.5](https://github.com/ungoldman/changelog-parser/compare/v2.0.4...v2.0.5) - 2017-06-28
|
|
67
99
|
|
|
68
100
|
### Changes
|
|
69
101
|
|
|
@@ -74,31 +106,31 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
74
106
|
- chore(gitignore): ignore lock files
|
|
75
107
|
- docs(readme): update repo web address
|
|
76
108
|
|
|
77
|
-
## [2.0.4](https://github.com/
|
|
109
|
+
## [2.0.4](https://github.com/ungoldman/changelog-parser/compare/v2.0.3...v2.0.4)
|
|
78
110
|
|
|
79
111
|
### Fixes
|
|
80
112
|
|
|
81
113
|
- reset log & current vars after each execution (#10)
|
|
82
114
|
|
|
83
|
-
## [2.0.3](https://github.com/
|
|
115
|
+
## [2.0.3](https://github.com/ungoldman/changelog-parser/compare/v2.0.2...v2.0.3) - 2016-09-09
|
|
84
116
|
|
|
85
117
|
- bump dev dependencies
|
|
86
118
|
- update repo URL
|
|
87
119
|
- update maintainer email
|
|
88
120
|
|
|
89
|
-
## [2.0.2](https://github.com/
|
|
121
|
+
## [2.0.2](https://github.com/ungoldman/changelog-parser/compare/v2.0.1...v2.0.2) - 2015-06-15
|
|
90
122
|
|
|
91
123
|
- readme updates
|
|
92
124
|
- change log fix
|
|
93
125
|
- add keywords to package.json
|
|
94
126
|
|
|
95
|
-
## [2.0.1](https://github.com/
|
|
127
|
+
## [2.0.1](https://github.com/ungoldman/changelog-parser/compare/v2.0.0...v2.0.1) - 2015-06-07
|
|
96
128
|
|
|
97
129
|
### Changes
|
|
98
130
|
|
|
99
|
-
- use `os` module to support cross-platform EOL parsing ([#4](https://github.com/
|
|
131
|
+
- use `os` module to support cross-platform EOL parsing ([#4](https://github.com/ungoldman/changelog-parser/pull/4))
|
|
100
132
|
|
|
101
|
-
## [2.0.0](https://github.com/
|
|
133
|
+
## [2.0.0](https://github.com/ungoldman/changelog-parser/compare/v1.1.0...v2.0.0) - 2015-04-02
|
|
102
134
|
|
|
103
135
|
### Breaking Changes
|
|
104
136
|
|
|
@@ -106,21 +138,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
106
138
|
|
|
107
139
|
### Changes
|
|
108
140
|
|
|
109
|
-
- parse out `v` prefix for version numbers ([gh-release#23](https://github.com/
|
|
141
|
+
- parse out `v` prefix for version numbers ([gh-release#23](https://github.com/ungoldman/gh-release/issues/23))
|
|
110
142
|
|
|
111
143
|
### Additions
|
|
112
144
|
|
|
113
145
|
- add `title` key to version object
|
|
114
146
|
- add a real test
|
|
115
147
|
|
|
116
|
-
## [1.1.0](https://github.com/
|
|
148
|
+
## [1.1.0](https://github.com/ungoldman/changelog-parser/compare/v1.0.1...v1.1.0) - 2015-03-07
|
|
117
149
|
|
|
118
150
|
- add cli support
|
|
119
151
|
- remove `description` key if empty
|
|
120
152
|
- add `CONTRIBUTING.md`
|
|
121
153
|
- add node 0.10 to travis-ci testing environments
|
|
122
154
|
|
|
123
|
-
## [1.0.1](https://github.com/
|
|
155
|
+
## [1.0.1](https://github.com/ungoldman/changelog-parser/compare/v1.0.0...v1.0.1) - 2015-03-02
|
|
124
156
|
|
|
125
157
|
- fix readme example for [paulcpederson](http://github.com/paulcpederson/)
|
|
126
158
|
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="./log.png">
|
|
4
|
+
|
|
1
5
|
# changelog-parser
|
|
2
6
|
|
|
3
|
-
[![npm][npm-
|
|
7
|
+
[![npm][npm-image]][npm-url]
|
|
8
|
+
[![build][build-image]][build-url]
|
|
9
|
+
[![downloads][downloads-image]][npm-url]
|
|
4
10
|
|
|
5
11
|
Change log parser for node.
|
|
6
12
|
|
|
7
|
-
[npm-
|
|
13
|
+
[npm-image]: https://img.shields.io/npm/v/changelog-parser.svg
|
|
8
14
|
[npm-url]: https://www.npmjs.com/package/changelog-parser
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
[build-image]: https://github.com/ungoldman/changelog-parser/actions/workflows/tests.yml/badge.svg
|
|
16
|
+
[build-url]: https://github.com/ungoldman/changelog-parser/actions/workflows/tests.yml
|
|
17
|
+
[downloads-image]: https://img.shields.io/npm/dm/changelog-parser.svg
|
|
18
|
+
|
|
19
|
+
</div>
|
|
14
20
|
|
|
15
21
|
## Install
|
|
16
22
|
|
|
@@ -59,25 +65,39 @@ parseChangelog('path/to/CHANGELOG.md')
|
|
|
59
65
|
|
|
60
66
|
You can optionally provide a configuration object `parseChangelog` function.
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
parseChangelog({
|
|
64
|
-
filePath: 'path/to/CHANGELOG.md',
|
|
65
|
-
removeMarkdown: false // default: true
|
|
66
|
-
})
|
|
67
|
-
```
|
|
68
|
+
You must provide either `filePath` or `text`.
|
|
68
69
|
|
|
69
70
|
#### filePath
|
|
70
71
|
|
|
71
72
|
Path to changelog file.
|
|
72
73
|
|
|
74
|
+
```js
|
|
75
|
+
parseChangelog({
|
|
76
|
+
filePath: 'path/to/CHANGELOG.md'
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
|
|
73
80
|
#### text
|
|
74
81
|
|
|
75
82
|
Text of changelog file (you can use this instead of `filePath`).
|
|
76
83
|
|
|
84
|
+
```js
|
|
85
|
+
parseChangelog({
|
|
86
|
+
text: 'raw changelog text in string format'
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
77
90
|
#### removeMarkdown
|
|
78
91
|
|
|
79
92
|
Removes the markdown markup from the changelog entries by default. You can change its value to `false` to keep the markdown.
|
|
80
93
|
|
|
94
|
+
```js
|
|
95
|
+
parseChangelog({
|
|
96
|
+
filePath: 'path/to/CHANGELOG.md',
|
|
97
|
+
removeMarkdown: false // default: true
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
81
101
|
### Command-line interface
|
|
82
102
|
|
|
83
103
|
There is also a command-line interface available if you install it with `-g`.
|
|
@@ -245,3 +265,5 @@ Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md
|
|
|
245
265
|
## License
|
|
246
266
|
|
|
247
267
|
[ISC](LICENSE.md)
|
|
268
|
+
|
|
269
|
+
Log image is from [emojipedia](https://emojipedia.org/wood/).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const parseChangelog = require('..')
|
|
4
|
+
const file = process.argv[2] || 'CHANGELOG.md'
|
|
5
|
+
const help = process.argv[2] === '-h' || process.argv[2] === '--help'
|
|
6
6
|
|
|
7
7
|
if (help) {
|
|
8
8
|
console.log('usage: changelog-parser [filename]')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const EOL = '\n'
|
|
2
|
+
const lineReader = require('line-reader')
|
|
3
|
+
const removeMarkdown = require('remove-markdown')
|
|
4
4
|
|
|
5
5
|
// patterns
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const semver = /\[?v?([\w\d.-]+\.[\w\d.-]+[a-zA-Z0-9])\]?/
|
|
7
|
+
const date = /.*[ ]\(?(\d\d?\d?\d?[-/.]\d\d?[-/.]\d\d?\d?\d?)\)?.*/
|
|
8
|
+
const subhead = /^###/
|
|
9
|
+
const listitem = /^[*-]/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const defaultOptions = { removeMarkdown: true }
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Changelog parser.
|
|
@@ -24,10 +24,10 @@ function parseChangelog (options, callback) {
|
|
|
24
24
|
if (typeof options === 'undefined') throw new Error('missing options argument')
|
|
25
25
|
if (typeof options === 'string') options = { filePath: options }
|
|
26
26
|
if (typeof options === 'object') {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const hasFilePath = typeof options.filePath !== 'undefined'
|
|
28
|
+
const hasText = typeof options.text !== 'undefined'
|
|
29
|
+
const invalidFilePath = typeof options.filePath !== 'string'
|
|
30
|
+
const invalidText = typeof options.text !== 'string'
|
|
31
31
|
|
|
32
32
|
if (!hasFilePath && !hasText) {
|
|
33
33
|
throw new Error('must provide filePath or text')
|
|
@@ -42,8 +42,8 @@ function parseChangelog (options, callback) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const opts = Object.assign({}, defaultOptions, options)
|
|
46
|
+
const changelog = parse(opts)
|
|
47
47
|
|
|
48
48
|
if (typeof callback === 'function') {
|
|
49
49
|
changelog
|
|
@@ -65,15 +65,15 @@ function parseChangelog (options, callback) {
|
|
|
65
65
|
* @returns {Promise<object>} - parsed changelog object
|
|
66
66
|
*/
|
|
67
67
|
function parse (options) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const filePath = options.filePath
|
|
69
|
+
const text = options.text
|
|
70
|
+
const data = {
|
|
71
71
|
log: { versions: [] },
|
|
72
72
|
current: null
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// allow `handleLine` to mutate log/current data as `this`.
|
|
76
|
-
|
|
76
|
+
const cb = handleLine.bind(data, options)
|
|
77
77
|
|
|
78
78
|
return new Promise(function (resolve, reject) {
|
|
79
79
|
function done () {
|
|
@@ -138,7 +138,7 @@ function handleLine (options, line) {
|
|
|
138
138
|
// - 'handleize' subhead.
|
|
139
139
|
// - add subhead to 'parsed' data if not already present.
|
|
140
140
|
if (subhead.exec(line)) {
|
|
141
|
-
|
|
141
|
+
const key = line.replace('###', '').trim()
|
|
142
142
|
|
|
143
143
|
if (!this.current.parsed[key]) {
|
|
144
144
|
this.current.parsed[key] = []
|
|
Binary file
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "changelog-parser",
|
|
3
3
|
"description": "Change log parser for node.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"author": "Nate Goldman <ungoldman@gmail.com>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"changelog-parser": "./bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"bugs": {
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/ungoldman/changelog-parser/issues"
|
|
11
11
|
},
|
|
12
12
|
"contributors": [
|
|
13
13
|
"Nate Goldman <ungoldman@gmail.com>",
|
|
@@ -20,15 +20,18 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"line-reader": "^0.2.4",
|
|
23
|
-
"remove-markdown": "^0.
|
|
23
|
+
"remove-markdown": "^0.5.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"gh-release": "^
|
|
27
|
-
"standard": "^
|
|
28
|
-
"tap-spec": "^
|
|
29
|
-
"tape": "^
|
|
26
|
+
"gh-release": "^7.0.0",
|
|
27
|
+
"standard": "^17.0.0",
|
|
28
|
+
"tap-spec": "^5.0.0",
|
|
29
|
+
"tape": "^5.5.2"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=14"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/ungoldman/changelog-parser",
|
|
32
35
|
"keywords": [
|
|
33
36
|
"CHANGELOG.md",
|
|
34
37
|
"changelog",
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
"main": "index.js",
|
|
42
45
|
"repository": {
|
|
43
46
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/
|
|
47
|
+
"url": "https://github.com/ungoldman/changelog-parser.git"
|
|
45
48
|
},
|
|
46
49
|
"scripts": {
|
|
47
50
|
"release": "gh-release && npm publish",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const EOL = require('os').EOL
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
title: 'changelog title',
|
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
{
|
|
8
8
|
version: null,
|
|
9
9
|
title: 'unreleased',
|
|
10
|
-
|
|
10
|
+
date: null,
|
|
11
11
|
body: '* foo',
|
|
12
12
|
parsed: {
|
|
13
13
|
_: [
|
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
{
|
|
19
19
|
version: 'x.y.z',
|
|
20
20
|
title: 'x.y.z - YYYY-MM-DD',
|
|
21
|
-
|
|
21
|
+
date: null,
|
|
22
22
|
body: '* bar',
|
|
23
23
|
parsed: {
|
|
24
24
|
_: [
|
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
{
|
|
30
30
|
version: 'a.b.c',
|
|
31
31
|
title: '[a.b.c]',
|
|
32
|
-
|
|
32
|
+
date: null,
|
|
33
33
|
body: '### Changes' + EOL + EOL + '* Update API' + EOL + '* Fix bug #1',
|
|
34
34
|
parsed: {
|
|
35
35
|
_: [
|
|
@@ -42,10 +42,24 @@ module.exports = {
|
|
|
42
42
|
]
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
version: '2.3.1',
|
|
47
|
+
title: '2.3.1 (2018-12-19)',
|
|
48
|
+
date: '2018-12-19',
|
|
49
|
+
body: '### Fixed' + EOL + EOL + '- Support dates in parentheses.',
|
|
50
|
+
parsed: {
|
|
51
|
+
_: [
|
|
52
|
+
'Support dates in parentheses.'
|
|
53
|
+
],
|
|
54
|
+
Fixed: [
|
|
55
|
+
'Support dates in parentheses.'
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
45
59
|
{
|
|
46
60
|
version: '2.3.0',
|
|
47
61
|
title: '2.3.0 - 2018-12-18',
|
|
48
|
-
|
|
62
|
+
date: '2018-12-18',
|
|
49
63
|
body: '### Added' + EOL + EOL + '- Some changelog generators such as [standard-version](https://github.com/conventional-changelog/standard-version) would produce H1s for major versions and H2s for minor versions. We want the parser to be able to parse both.',
|
|
50
64
|
parsed: {
|
|
51
65
|
_: [
|
|
@@ -59,7 +73,7 @@ module.exports = {
|
|
|
59
73
|
{
|
|
60
74
|
version: '2.2.3-pre.1',
|
|
61
75
|
title: '2.2.3-pre.1 - 2013-02-14',
|
|
62
|
-
|
|
76
|
+
date: '2013-02-14',
|
|
63
77
|
body: '### Added' + EOL + '- Added an item.' + EOL + '* Added another item.' + EOL + EOL + '* Update API',
|
|
64
78
|
parsed: {
|
|
65
79
|
_: [
|
|
@@ -77,7 +91,7 @@ module.exports = {
|
|
|
77
91
|
{
|
|
78
92
|
version: '2.0.0-x.7.z.92',
|
|
79
93
|
title: '2.0.0-x.7.z.92 - 2013-02-14',
|
|
80
|
-
|
|
94
|
+
date: '2013-02-14',
|
|
81
95
|
body: '* bark bark' + EOL + '* woof' + EOL + '* arf',
|
|
82
96
|
parsed: {
|
|
83
97
|
_: [
|
|
@@ -90,7 +104,7 @@ module.exports = {
|
|
|
90
104
|
{
|
|
91
105
|
version: '1.3.0',
|
|
92
106
|
title: 'v1.3.0',
|
|
93
|
-
|
|
107
|
+
date: null,
|
|
94
108
|
body: '* make it so',
|
|
95
109
|
parsed: {
|
|
96
110
|
_: [
|
|
@@ -101,7 +115,7 @@ module.exports = {
|
|
|
101
115
|
{
|
|
102
116
|
version: '1.2.3',
|
|
103
117
|
title: '[1.2.3](link)',
|
|
104
|
-
|
|
118
|
+
date: null,
|
|
105
119
|
body: '* init',
|
|
106
120
|
parsed: {
|
|
107
121
|
_: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const EOL = require('os').EOL
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
title: 'changelog title',
|
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
{
|
|
8
8
|
version: null,
|
|
9
9
|
title: 'unreleased',
|
|
10
|
-
|
|
10
|
+
date: null,
|
|
11
11
|
body: '* foo',
|
|
12
12
|
parsed: {
|
|
13
13
|
_: [
|
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
{
|
|
19
19
|
version: 'x.y.z',
|
|
20
20
|
title: 'x.y.z - YYYY-MM-DD',
|
|
21
|
-
|
|
21
|
+
date: null,
|
|
22
22
|
body: '* bar',
|
|
23
23
|
parsed: {
|
|
24
24
|
_: [
|
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
{
|
|
30
30
|
version: 'a.b.c',
|
|
31
31
|
title: '[a.b.c]',
|
|
32
|
-
|
|
32
|
+
date: null,
|
|
33
33
|
body: '### Changes' + EOL + EOL + '* Update API' + EOL + '* Fix bug #1',
|
|
34
34
|
parsed: {
|
|
35
35
|
_: [
|
|
@@ -42,10 +42,24 @@ module.exports = {
|
|
|
42
42
|
]
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
version: '2.3.1',
|
|
47
|
+
title: '2.3.1 (2018-12-19)',
|
|
48
|
+
date: '2018-12-19',
|
|
49
|
+
body: '### Fixed' + EOL + EOL + '- Support dates in parentheses.',
|
|
50
|
+
parsed: {
|
|
51
|
+
_: [
|
|
52
|
+
'- Support dates in parentheses.'
|
|
53
|
+
],
|
|
54
|
+
Fixed: [
|
|
55
|
+
'- Support dates in parentheses.'
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
45
59
|
{
|
|
46
60
|
version: '2.3.0',
|
|
47
61
|
title: '2.3.0 - 2018-12-18',
|
|
48
|
-
|
|
62
|
+
date: '2018-12-18',
|
|
49
63
|
body: '### Added' + EOL + EOL + '- Some changelog generators such as [standard-version](https://github.com/conventional-changelog/standard-version) would produce H1s for major versions and H2s for minor versions. We want the parser to be able to parse both.',
|
|
50
64
|
parsed: {
|
|
51
65
|
_: [
|
|
@@ -59,7 +73,7 @@ module.exports = {
|
|
|
59
73
|
{
|
|
60
74
|
version: '2.2.3-pre.1',
|
|
61
75
|
title: '2.2.3-pre.1 - 2013-02-14',
|
|
62
|
-
|
|
76
|
+
date: '2013-02-14',
|
|
63
77
|
body: '### Added' + EOL + '- Added an item.' + EOL + '* Added another item.' + EOL + EOL + '* Update API',
|
|
64
78
|
parsed: {
|
|
65
79
|
_: [
|
|
@@ -77,7 +91,7 @@ module.exports = {
|
|
|
77
91
|
{
|
|
78
92
|
version: '2.0.0-x.7.z.92',
|
|
79
93
|
title: '2.0.0-x.7.z.92 - 2013-02-14',
|
|
80
|
-
|
|
94
|
+
date: '2013-02-14',
|
|
81
95
|
body: '* bark bark' + EOL + '* woof' + EOL + '* arf',
|
|
82
96
|
parsed: {
|
|
83
97
|
_: [
|
|
@@ -90,7 +104,7 @@ module.exports = {
|
|
|
90
104
|
{
|
|
91
105
|
version: '1.3.0',
|
|
92
106
|
title: 'v1.3.0',
|
|
93
|
-
|
|
107
|
+
date: null,
|
|
94
108
|
body: '* make it so',
|
|
95
109
|
parsed: {
|
|
96
110
|
_: [
|
|
@@ -101,7 +115,7 @@ module.exports = {
|
|
|
101
115
|
{
|
|
102
116
|
version: '1.2.3',
|
|
103
117
|
title: '[1.2.3](link)',
|
|
104
|
-
|
|
118
|
+
date: null,
|
|
105
119
|
body: '* init',
|
|
106
120
|
parsed: {
|
|
107
121
|
_: [
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const parseChangelog = require('..')
|
|
2
|
+
const test = require('tape')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const fs = require('fs')
|
|
5
|
+
const expected = require('./fixtures/expected')
|
|
6
|
+
const removeMarkdownExpected = require('./fixtures/remove-markdown-expected')
|
|
7
|
+
const filePath = path.join(__dirname, 'fixtures', 'CHANGELOG.md')
|
|
8
8
|
|
|
9
9
|
test('throws on bad params', function (t) {
|
|
10
10
|
t.plan(3)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const missing = 'must provide filePath or text'
|
|
13
|
+
const invalidPath = 'invalid filePath, expected string'
|
|
14
|
+
const invalidText = 'invalid text, expected string'
|
|
15
15
|
|
|
16
16
|
t.throws(parseChangelog, missing, missing)
|
|
17
17
|
t.throws(function () {
|
|
@@ -36,7 +36,7 @@ test('parses example changelog', function (t) {
|
|
|
36
36
|
test('parses example changelog as text', function (t) {
|
|
37
37
|
t.plan(1)
|
|
38
38
|
|
|
39
|
-
parseChangelog({text: fs.readFileSync(filePath, 'utf8')}, function (err, result) {
|
|
39
|
+
parseChangelog({ text: fs.readFileSync(filePath, 'utf8') }, function (err, result) {
|
|
40
40
|
if (err) throw err
|
|
41
41
|
|
|
42
42
|
t.deepEqual(result, expected)
|
|
@@ -47,7 +47,7 @@ test('parses example changelog as text', function (t) {
|
|
|
47
47
|
test('returns a Promise when invoked without a valid `callback`', function (t) {
|
|
48
48
|
t.plan(2)
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const result = parseChangelog(filePath)
|
|
51
51
|
|
|
52
52
|
t.true(typeof result === 'object')
|
|
53
53
|
t.true(result instanceof Promise)
|
|
@@ -69,18 +69,18 @@ test('callback and Promise methods should yield identical values', function (t)
|
|
|
69
69
|
if (err) t.fail()
|
|
70
70
|
|
|
71
71
|
parseChangelog(filePath)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
.then(function (resultB) {
|
|
73
|
+
t.deepEqual(resultA, resultB)
|
|
74
|
+
t.end()
|
|
75
|
+
})
|
|
76
|
+
.catch(t.fail)
|
|
77
77
|
})
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
test('accepts object as first argument', function (t) {
|
|
81
81
|
t.plan(1)
|
|
82
82
|
|
|
83
|
-
parseChangelog({ filePath
|
|
83
|
+
parseChangelog({ filePath }, function (err, result) {
|
|
84
84
|
if (err) throw err
|
|
85
85
|
|
|
86
86
|
t.deepEqual(result, expected)
|
|
@@ -91,8 +91,8 @@ test('accepts object as first argument', function (t) {
|
|
|
91
91
|
test('accepts { removeMardown: false } option', function (t) {
|
|
92
92
|
t.plan(1)
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
filePath
|
|
94
|
+
const options = {
|
|
95
|
+
filePath,
|
|
96
96
|
removeMarkdown: false
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# This configuration was automatically generated from a CircleCI 1.0 config.
|
|
2
|
+
# It should include any build commands you had along with commands that CircleCI
|
|
3
|
+
# inferred from your project structure. We strongly recommend you read all the
|
|
4
|
+
# comments in this file to understand the structure of CircleCI 2.0, as the idiom
|
|
5
|
+
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather
|
|
6
|
+
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated
|
|
7
|
+
# configuration as a reference rather than using it in production, though in most
|
|
8
|
+
# cases it should duplicate the execution of your original 1.0 config.
|
|
9
|
+
version: 2
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
working_directory: ~/stiang/remove-markdown
|
|
13
|
+
parallelism: 1
|
|
14
|
+
shell: /bin/bash --login
|
|
15
|
+
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
|
|
16
|
+
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables .
|
|
17
|
+
environment:
|
|
18
|
+
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
|
19
|
+
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
|
20
|
+
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages.
|
|
21
|
+
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images.
|
|
22
|
+
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job.
|
|
23
|
+
# We have selected a pre-built image that mirrors the build environment we use on
|
|
24
|
+
# the 1.0 platform, but we recommend you choose an image more tailored to the needs
|
|
25
|
+
# of each job. For more information on choosing an image (or alternatively using a
|
|
26
|
+
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/
|
|
27
|
+
# To see the list of pre-built images that CircleCI provides for most common languages see
|
|
28
|
+
# https://circleci.com/docs/2.0/circleci-images/
|
|
29
|
+
docker:
|
|
30
|
+
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
|
|
31
|
+
command: /sbin/init
|
|
32
|
+
steps:
|
|
33
|
+
# Machine Setup
|
|
34
|
+
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
|
35
|
+
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
|
36
|
+
- checkout
|
|
37
|
+
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
|
|
38
|
+
# In many cases you can simplify this from what is generated here.
|
|
39
|
+
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
|
|
40
|
+
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
|
41
|
+
# Dependencies
|
|
42
|
+
# This would typically go in either a build or a build-and-test job when using workflows
|
|
43
|
+
# Restore the dependency cache
|
|
44
|
+
- restore_cache:
|
|
45
|
+
keys:
|
|
46
|
+
# This branch if available
|
|
47
|
+
- v1-dep-{{ .Branch }}-
|
|
48
|
+
# Default branch if not
|
|
49
|
+
- v1-dep-master-
|
|
50
|
+
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
|
|
51
|
+
- v1-dep-
|
|
52
|
+
# The following line was run implicitly in your 1.0 builds based on what CircleCI inferred about the structure of your project. In 2.0 you need to be explicit about which commands should be run. In some cases you can discard inferred commands if they are not relevant to your project.
|
|
53
|
+
- run: if [ -z "${NODE_ENV:-}" ]; then export NODE_ENV=test; fi
|
|
54
|
+
- run: export PATH="~/stiang/remove-markdown/node_modules/.bin:$PATH"
|
|
55
|
+
- run: npm install
|
|
56
|
+
# Save dependency cache
|
|
57
|
+
- save_cache:
|
|
58
|
+
key: v1-dep-{{ .Branch }}-{{ epoch }}
|
|
59
|
+
paths:
|
|
60
|
+
# This is a broad list of cache paths to include many possible development environments
|
|
61
|
+
# You can probably delete some of these entries
|
|
62
|
+
- vendor/bundle
|
|
63
|
+
- ~/virtualenvs
|
|
64
|
+
- ~/.m2
|
|
65
|
+
- ~/.ivy2
|
|
66
|
+
- ~/.bundle
|
|
67
|
+
- ~/.go_workspace
|
|
68
|
+
- ~/.gradle
|
|
69
|
+
- ~/.cache/bower
|
|
70
|
+
- ./node_modules
|
|
71
|
+
# Test
|
|
72
|
+
# This would typically be a build job when using workflows, possibly combined with build
|
|
73
|
+
# The following line was run implicitly in your 1.0 builds based on what CircleCI inferred about the structure of your project. In 2.0 you need to be explicit about which commands should be run. In some cases you can discard inferred commands if they are not relevant to your project.
|
|
74
|
+
- run: npm test
|
|
75
|
+
# Teardown
|
|
76
|
+
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
|
77
|
+
# Save test results
|
|
78
|
+
- store_test_results:
|
|
79
|
+
path: /tmp/circleci-test-results
|
|
80
|
+
# Save artifacts
|
|
81
|
+
- store_artifacts:
|
|
82
|
+
path: /tmp/circleci-artifacts
|
|
83
|
+
- store_artifacts:
|
|
84
|
+
path: /tmp/circleci-test-results
|
|
File without changes
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
[](https://circleci.com/gh/stiang/remove-markdown)
|
|
2
2
|
|
|
3
3
|
## What is it?
|
|
4
|
-
**remove-markdown** is a node.js module that will remove (strip) Markdown formatting from
|
|
4
|
+
**remove-markdown** is a node.js module that will remove (strip) Markdown formatting from text.
|
|
5
|
+
*Markdown formatting* means pretty much anything that doesn’t look like regular text, like square brackets, asterisks etc.
|
|
5
6
|
|
|
6
7
|
## When do I need it?
|
|
7
|
-
The typical use case is to display an excerpt
|
|
8
|
+
The typical use case is to display an excerpt from some Markdown text, without any of the actual Markdown syntax - for example in a list of posts.
|
|
8
9
|
|
|
9
10
|
## Installation
|
|
10
11
|
|
|
@@ -22,17 +23,19 @@ const plainText = removeMd(markdown); // plainText is now 'This is a heading\n\n
|
|
|
22
23
|
You can also supply an options object to the function. Currently, the following options are supported:
|
|
23
24
|
|
|
24
25
|
```js
|
|
25
|
-
|
|
26
|
+
const plainText = removeMd(markdown, {
|
|
26
27
|
stripListLeaders: true , // strip list leaders (default: true)
|
|
27
28
|
listUnicodeChar: '', // char to insert instead of stripped list leaders (default: '')
|
|
28
29
|
gfm: true // support GitHub-Flavored Markdown (default: true)
|
|
30
|
+
useImgAltText: true // replace images with alt-text, if present (default: true)
|
|
29
31
|
});
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
Setting `stripListLeaders` to false will retain any list characters (`*, -, +, (digit).`).
|
|
33
35
|
|
|
34
36
|
## TODO
|
|
35
|
-
PRs are very much welcome.
|
|
37
|
+
PRs are very much welcome. Here are some ideas for future enhancements:
|
|
38
|
+
|
|
36
39
|
* Allow the RegEx expressions to be customized per rule
|
|
37
40
|
* Make the rules more robust, support more edge cases
|
|
38
41
|
* Add more (comprehensive) tests
|
|
@@ -3,11 +3,15 @@ module.exports = function(md, options) {
|
|
|
3
3
|
options.listUnicodeChar = options.hasOwnProperty('listUnicodeChar') ? options.listUnicodeChar : false;
|
|
4
4
|
options.stripListLeaders = options.hasOwnProperty('stripListLeaders') ? options.stripListLeaders : true;
|
|
5
5
|
options.gfm = options.hasOwnProperty('gfm') ? options.gfm : true;
|
|
6
|
+
options.useImgAltText = options.hasOwnProperty('useImgAltText') ? options.useImgAltText : true;
|
|
7
|
+
options.abbr = options.hasOwnProperty('abbr') ? options.abbr : false;
|
|
8
|
+
options.replaceLinksWithURL = options.hasOwnProperty('replaceLinksWithURL') ? options.replaceLinksWithURL : false;
|
|
9
|
+
options.htmlTagsToSkip = options.hasOwnProperty('htmlTagsToSkip') ? options.htmlTagsToSkip : [];
|
|
6
10
|
|
|
7
11
|
var output = md || '';
|
|
8
12
|
|
|
9
13
|
// Remove horizontal rules (stripListHeaders conflict with this rule, which is why it has been moved to the top)
|
|
10
|
-
output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s
|
|
14
|
+
output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*/gm, '');
|
|
11
15
|
|
|
12
16
|
try {
|
|
13
17
|
if (options.stripListLeaders) {
|
|
@@ -18,40 +22,72 @@ module.exports = function(md, options) {
|
|
|
18
22
|
}
|
|
19
23
|
if (options.gfm) {
|
|
20
24
|
output = output
|
|
21
|
-
|
|
25
|
+
// Header
|
|
22
26
|
.replace(/\n={2,}/g, '\n')
|
|
27
|
+
// Fenced codeblocks
|
|
28
|
+
.replace(/~{3}.*\n/g, '')
|
|
23
29
|
// Strikethrough
|
|
24
30
|
.replace(/~~/g, '')
|
|
25
31
|
// Fenced codeblocks
|
|
26
32
|
.replace(/`{3}.*\n/g, '');
|
|
27
33
|
}
|
|
34
|
+
if (options.abbr) {
|
|
35
|
+
// Remove abbreviations
|
|
36
|
+
output = output.replace(/\*\[.*\]:.*\n/, '');
|
|
37
|
+
}
|
|
28
38
|
output = output
|
|
29
|
-
|
|
39
|
+
// Remove HTML tags
|
|
30
40
|
.replace(/<[^>]*>/g, '')
|
|
41
|
+
|
|
42
|
+
var htmlReplaceRegex = new RegExp('<[^>]*>', 'g');
|
|
43
|
+
if (options.htmlTagsToSkip.length > 0) {
|
|
44
|
+
// Using negative lookahead. Eg. (?!sup|sub) will not match 'sup' and 'sub' tags.
|
|
45
|
+
var joinedHtmlTagsToSkip = '(?!' + options.htmlTagsToSkip.join("|") + ')';
|
|
46
|
+
|
|
47
|
+
// Adding the lookahead literal with the default regex for html. Eg./<(?!sup|sub)[^>]*>/ig
|
|
48
|
+
htmlReplaceRegex = new RegExp(
|
|
49
|
+
'<' +
|
|
50
|
+
joinedHtmlTagsToSkip +
|
|
51
|
+
'[^>]*>',
|
|
52
|
+
'ig'
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
output = output
|
|
57
|
+
// Remove HTML tags
|
|
58
|
+
.replace(htmlReplaceRegex, '')
|
|
31
59
|
// Remove setext-style headers
|
|
32
60
|
.replace(/^[=\-]{2,}\s*$/g, '')
|
|
33
61
|
// Remove footnotes?
|
|
34
62
|
.replace(/\[\^.+?\](\: .*?$)?/g, '')
|
|
35
63
|
.replace(/\s{0,2}\[.*?\]: .*?$/g, '')
|
|
36
64
|
// Remove images
|
|
37
|
-
.replace(/\!\[
|
|
65
|
+
.replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? '$1' : '')
|
|
38
66
|
// Remove inline links
|
|
39
|
-
.replace(/\[(
|
|
67
|
+
.replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g, options.replaceLinksWithURL ? '$2' : '$1')
|
|
40
68
|
// Remove blockquotes
|
|
41
|
-
.replace(/^\s{0,3}>\s?/
|
|
69
|
+
.replace(/^\s{0,3}>\s?/gm, '')
|
|
70
|
+
// .replace(/(^|\n)\s{0,3}>\s?/g, '\n\n')
|
|
42
71
|
// Remove reference-style links?
|
|
43
72
|
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
|
|
44
73
|
// Remove atx-style headers
|
|
45
|
-
.replace(/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm, '$1$2$3')
|
|
46
|
-
// Remove
|
|
47
|
-
.replace(/([\*
|
|
48
|
-
.
|
|
74
|
+
.replace(/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} #{0,}(\n)?\s{0,}$/gm, '$1$2$3')
|
|
75
|
+
// Remove * emphasis
|
|
76
|
+
.replace(/([\*]+)(\S)(.*?\S)??\1/g, '$2$3')
|
|
77
|
+
// Remove _ emphasis. Unlike *, _ emphasis gets rendered only if
|
|
78
|
+
// 1. Either there is a whitespace character before opening _ and after closing _.
|
|
79
|
+
// 2. Or _ is at the start/end of the string.
|
|
80
|
+
.replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, '$1$3$4$5')
|
|
49
81
|
// Remove code blocks
|
|
50
82
|
.replace(/(`{3,})(.*?)\1/gm, '$2')
|
|
51
83
|
// Remove inline code
|
|
52
84
|
.replace(/`(.+?)`/g, '$1')
|
|
53
|
-
// Replace two or more newlines with exactly two? Not entirely sure this belongs here...
|
|
54
|
-
.replace(/\n{2,}/g, '\n\n')
|
|
85
|
+
// // Replace two or more newlines with exactly two? Not entirely sure this belongs here...
|
|
86
|
+
// .replace(/\n{2,}/g, '\n\n')
|
|
87
|
+
// // Remove newlines in a paragraph
|
|
88
|
+
// .replace(/(\S+)\n\s*(\S+)/g, '$1 $2')
|
|
89
|
+
// Replace strike through
|
|
90
|
+
.replace(/~(.*?)~/g, '$1');
|
|
55
91
|
} catch(e) {
|
|
56
92
|
console.error(e);
|
|
57
93
|
return md;
|
|
@@ -40,11 +40,17 @@ describe('remove Markdown', function () {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
it('should strip img tags', function () {
|
|
43
|
-
const string = '*Javascript* developers are the _best_.';
|
|
44
44
|
const expected = 'Javascript developers are the best.';
|
|
45
45
|
expect(removeMd(string)).to.equal(expected);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
it('should use the alt-text of an image, if it is provided', function () {
|
|
49
|
+
const string = '';
|
|
50
|
+
const expected = 'This is the alt-text';
|
|
51
|
+
expect(removeMd(string)).to.equal(expected);
|
|
52
|
+
});
|
|
53
|
+
|
|
48
54
|
it('should strip code tags', function () {
|
|
49
55
|
const string = 'In `Getting Started` we set up `something` foo.';
|
|
50
56
|
const expected = 'In Getting Started we set up something foo.';
|
|
@@ -63,6 +69,18 @@ describe('remove Markdown', function () {
|
|
|
63
69
|
expect(removeMd(string)).to.equal(expected);
|
|
64
70
|
});
|
|
65
71
|
|
|
72
|
+
it('should remove emphasis only if there is no space between word and emphasis characters.', function () {
|
|
73
|
+
const string = 'There should be no _space_, *before* *closing * _ephasis character _.';
|
|
74
|
+
const expected = 'There should be no space, before *closing * _ephasis character _.';
|
|
75
|
+
expect(removeMd(string)).to.equal(expected);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should remove "_" emphasis only if there is space before opening and after closing emphasis characters.', function () {
|
|
79
|
+
const string = '._Spaces_ _ before_ and _after _ emphasised character results in no emphasis.';
|
|
80
|
+
const expected = '.Spaces _ before_ and _after _ emphasised character results in no emphasis.';
|
|
81
|
+
expect(removeMd(string)).to.equal(expected);
|
|
82
|
+
});
|
|
83
|
+
|
|
66
84
|
it('should remove double emphasis', function () {
|
|
67
85
|
const string = '**this sentence has __double styling__**';
|
|
68
86
|
const expected = 'this sentence has double styling';
|
|
@@ -103,18 +121,31 @@ describe('remove Markdown', function () {
|
|
|
103
121
|
expect(removeMd(test.string)).to.equal(test.expected);
|
|
104
122
|
});
|
|
105
123
|
});
|
|
124
|
+
|
|
125
|
+
it('should remove blockquotes over multiple lines', function () {
|
|
126
|
+
const string = '> I am a blockquote firstline \n>I am a blockquote secondline';
|
|
127
|
+
const expected = 'I am a blockquote firstline\nI am a blockquote secondline';
|
|
128
|
+
expect(removeMd(string)).to.equal(expected);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// it('should remove blockquotes following other content', function () {
|
|
132
|
+
// const string = '## A headline\n\nA paragraph of text\n\n> I am a blockquote';
|
|
133
|
+
// const expected = 'A headline\n\nA paragraph of text\n\nI am a blockquote';
|
|
134
|
+
|
|
135
|
+
// expect(removeMd(string)).to.equal(expected);
|
|
136
|
+
// });
|
|
106
137
|
|
|
107
138
|
it('should not remove greater than signs', function () {
|
|
108
139
|
var tests = [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
140
|
+
{ string: '100 > 0', expected: '100 > 0' },
|
|
141
|
+
{ string: '100 >= 0', expected: '100 >= 0' },
|
|
142
|
+
{ string: '100>0', expected: '100>0' },
|
|
143
|
+
{ string: '> 100 > 0', expected: '100 > 0' },
|
|
144
|
+
{ string: '1 < 100', expected: '1 < 100' },
|
|
145
|
+
{ string: '1 <= 100', expected: '1 <= 100' },
|
|
115
146
|
];
|
|
116
147
|
tests.forEach(function (test) {
|
|
117
|
-
|
|
148
|
+
expect(removeMd(test.string)).to.equal(test.expected);
|
|
118
149
|
});
|
|
119
150
|
});
|
|
120
151
|
|
|
@@ -135,5 +166,22 @@ describe('remove Markdown', function () {
|
|
|
135
166
|
const expected = '\nThis is a heading\n\nThis is a paragraph with a link.\n\nThis is another heading\n\nIn Getting Started we set up something foo.\n\n Some list\n With items\n Even indented';
|
|
136
167
|
expect(removeMd(paragraph)).to.equal(expected);
|
|
137
168
|
});
|
|
169
|
+
|
|
170
|
+
it('should not strip paragraphs without content', function() {
|
|
171
|
+
const paragraph = '\n#This paragraph\n##This paragraph#';
|
|
172
|
+
const expected = paragraph;
|
|
173
|
+
expect(removeMd(paragraph)).to.equal(expected);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should not trigger ReDoS with atx-headers', function () {
|
|
177
|
+
const start = Date.now();
|
|
178
|
+
|
|
179
|
+
const paragraph = '\n## This is a long "'+' '.repeat(200)+'" heading ##\n';
|
|
180
|
+
const expected = /\nThis is a long " {200}" heading\n/;
|
|
181
|
+
expect(removeMd(paragraph)).to.match(expected);
|
|
182
|
+
|
|
183
|
+
const duration = Date.now()-start;
|
|
184
|
+
expect(duration).to.be.lt(500);
|
|
185
|
+
});
|
|
138
186
|
});
|
|
139
187
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/release-cli",
|
|
3
3
|
"description": "Used internally by OneBlink to release code bases quickly and consistently",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.1.0-beta.2",
|
|
5
5
|
"author": "OneBlink <developers@oneblink> (https://github.com/oneblink)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"oneblink-release": "dist/bin.js"
|
|
@@ -10,35 +10,35 @@
|
|
|
10
10
|
"url": "https://github.com/oneblink/release-cli/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"changelog-parser": "^
|
|
14
|
-
"enquirer": "^2.
|
|
15
|
-
"execa": "^
|
|
16
|
-
"meow": "^
|
|
17
|
-
"ora": "^
|
|
13
|
+
"changelog-parser": "^3.0.1",
|
|
14
|
+
"enquirer": "^2.4.1",
|
|
15
|
+
"execa": "^8.0.1",
|
|
16
|
+
"meow": "^12.1.1",
|
|
17
|
+
"ora": "^7.0.1",
|
|
18
18
|
"package-diff-summary": "^3.0.1",
|
|
19
|
-
"patch-package": "^
|
|
20
|
-
"prettier": "^
|
|
21
|
-
"read-pkg-up": "^
|
|
22
|
-
"semver": "^7.
|
|
19
|
+
"patch-package": "^8.0.0",
|
|
20
|
+
"prettier": "^3.0.3",
|
|
21
|
+
"read-pkg-up": "^10.1.0",
|
|
22
|
+
"semver": "^7.5.4",
|
|
23
23
|
"update-notifier": "^6.0.2"
|
|
24
24
|
},
|
|
25
25
|
"bundleDependencies": [
|
|
26
26
|
"changelog-parser"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/changelog-parser": "^2.8.
|
|
30
|
-
"@types/jest": "^29.5.
|
|
29
|
+
"@types/changelog-parser": "^2.8.2",
|
|
30
|
+
"@types/jest": "^29.5.5",
|
|
31
31
|
"@types/node": "^18.15.11",
|
|
32
|
-
"@types/semver": "^7.3
|
|
32
|
+
"@types/semver": "^7.5.3",
|
|
33
33
|
"@types/update-notifier": "^6.0.2",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
35
|
-
"@typescript-eslint/parser": "^
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
|
35
|
+
"@typescript-eslint/parser": "^6.7.5",
|
|
36
36
|
"cross-env": "^7.0.3",
|
|
37
|
-
"eslint": "^8.
|
|
38
|
-
"eslint-config-prettier": "^
|
|
39
|
-
"eslint-plugin-prettier": "^
|
|
40
|
-
"jest": "^29.
|
|
41
|
-
"ts-jest": "^29.1.
|
|
37
|
+
"eslint": "^8.51.0",
|
|
38
|
+
"eslint-config-prettier": "^9.0.0",
|
|
39
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
40
|
+
"jest": "^29.7.0",
|
|
41
|
+
"ts-jest": "^29.1.1",
|
|
42
42
|
"typescript": "^5.0.3"
|
|
43
43
|
},
|
|
44
44
|
"directories": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
diff --git a/node_modules/changelog-parser/index.js b/node_modules/changelog-parser/index.js
|
|
2
|
-
index
|
|
2
|
+
index 9cb6a79..02bafbc 100644
|
|
3
3
|
--- a/node_modules/changelog-parser/index.js
|
|
4
4
|
+++ b/node_modules/changelog-parser/index.js
|
|
5
5
|
@@ -1,4 +1,4 @@
|
|
6
|
-
-
|
|
7
|
-
+
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
-const EOL = require('os').EOL
|
|
7
|
+
+const EOL = '\n'
|
|
8
|
+
const lineReader = require('line-reader')
|
|
9
|
+
const removeMarkdown = require('remove-markdown')
|
|
10
10
|
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules/
|