@zentered/issue-forms-body-parser 1.3.0 → 1.4.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/.eslintignore +2 -0
- package/.nyc_output/51515bde-d360-43af-9735-c6f3cb6894f8.json +1 -0
- package/.nyc_output/734d5a73-99f9-445f-a028-1b09587e3677.json +1 -0
- package/.nyc_output/processinfo/51515bde-d360-43af-9735-c6f3cb6894f8.json +1 -0
- package/.nyc_output/processinfo/734d5a73-99f9-445f-a028-1b09587e3677.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/action.yml +1 -1
- package/package.json +19 -10
- package/pkg/parse.cjs +2 -0
- package/pkg/parse.cjs.map +1 -0
- package/pkg/parse.modern.js +2 -0
- package/pkg/parse.modern.js.map +1 -0
- package/pkg/parse.module.js +2 -0
- package/pkg/parse.module.js.map +1 -0
- package/pkg/parse.umd.js +2 -0
- package/pkg/parse.umd.js.map +1 -0
- package/src/parse.js +58 -35
- package/src/parsers/duration.js +21 -4
- package/dist/index.js +0 -53406
- package/dist/licenses.txt +0 -1772
- package/dist/package.json +0 -3
- package/test/issue.json +0 -6
- package/test/parse-issue.test.js +0 -109
- package/test/test-issue-1.md +0 -58
- package/test/test-issue-2.md +0 -10
package/dist/package.json
DELETED
package/test/issue.json
DELETED
package/test/parse-issue.test.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import t from 'tap'
|
|
4
|
-
import fn from '../src/parse.js'
|
|
5
|
-
import { readFile } from 'fs/promises'
|
|
6
|
-
import { join } from 'path'
|
|
7
|
-
|
|
8
|
-
const test = t.test
|
|
9
|
-
|
|
10
|
-
test('parse(md) should parse GitHub Issue Form data into useful, structured data', async (t) => {
|
|
11
|
-
const expected = {
|
|
12
|
-
'event-description': {
|
|
13
|
-
order: 0,
|
|
14
|
-
title: 'Event Description',
|
|
15
|
-
text: "Let's meet for coffee and chat about tech, coding, Cyprus and the newly formed\nCDC (Cyprus Developer Community)."
|
|
16
|
-
},
|
|
17
|
-
location: {
|
|
18
|
-
order: 1,
|
|
19
|
-
title: 'Location',
|
|
20
|
-
text: '[Cafe Nero Finikoudes, Larnaka](https://goo.gl/maps/Bzjxdeat3BSdsUSVA)'
|
|
21
|
-
},
|
|
22
|
-
date: {
|
|
23
|
-
order: 2,
|
|
24
|
-
title: 'Date',
|
|
25
|
-
text: '11.03.2022',
|
|
26
|
-
date: '2022-03-11'
|
|
27
|
-
},
|
|
28
|
-
time: { order: 3, title: 'Time', text: '16:00', time: '16:00' },
|
|
29
|
-
duration: {
|
|
30
|
-
order: 4,
|
|
31
|
-
title: 'Duration',
|
|
32
|
-
text: '2h',
|
|
33
|
-
duration: { hours: 2, minutes: 0 }
|
|
34
|
-
},
|
|
35
|
-
'list-item-checked': {
|
|
36
|
-
order: 5,
|
|
37
|
-
title: 'List Item Checked',
|
|
38
|
-
list: [
|
|
39
|
-
{
|
|
40
|
-
checked: true,
|
|
41
|
-
text: "I agree to follow this project's\nCode of Conduct"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
text: "* [x] I agree to follow this project's\n [Code of Conduct](https://berlincodeofconduct.org)"
|
|
45
|
-
},
|
|
46
|
-
'list-item-unchecked': {
|
|
47
|
-
order: 6,
|
|
48
|
-
title: 'List Item Unchecked',
|
|
49
|
-
list: [
|
|
50
|
-
{
|
|
51
|
-
checked: false,
|
|
52
|
-
text: "I agree to follow this project's\nCode of Conduct"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
text: "* [ ] I agree to follow this project's\n [Code of Conduct](https://berlincodeofconduct.org)"
|
|
56
|
-
},
|
|
57
|
-
'mixed-task-list': {
|
|
58
|
-
order: 7,
|
|
59
|
-
title: 'Mixed Task List',
|
|
60
|
-
list: [
|
|
61
|
-
{ checked: true, text: 'checked' },
|
|
62
|
-
{ checked: false, text: 'unchecked' },
|
|
63
|
-
{ checked: true, text: 'checked 2' },
|
|
64
|
-
{ checked: true, text: 'checked 3' },
|
|
65
|
-
{ checked: false, text: 'unchecked 2' }
|
|
66
|
-
],
|
|
67
|
-
text: '* [x] checked\n* [ ] unchecked\n* [x] checked 2\n* [x] checked 3\n* [ ] unchecked 2'
|
|
68
|
-
},
|
|
69
|
-
'complex-list': {
|
|
70
|
-
order: 8,
|
|
71
|
-
title: 'Complex List',
|
|
72
|
-
list: [
|
|
73
|
-
{ checked: null, text: 'one' },
|
|
74
|
-
{ checked: null, text: 'two' }
|
|
75
|
-
],
|
|
76
|
-
text: '* one\n* two\n * three\n * four\n 1. five\n 2. six'
|
|
77
|
-
},
|
|
78
|
-
repositories: {
|
|
79
|
-
order: 9,
|
|
80
|
-
title: 'Repositories',
|
|
81
|
-
text: '```csv\nhttps://example.com/repository-1\nhttps://example.com/repository-2\n```'
|
|
82
|
-
},
|
|
83
|
-
visibility: {
|
|
84
|
-
order: 10,
|
|
85
|
-
title: 'Visibility',
|
|
86
|
-
text: 'Internal'
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const md = await readFile(
|
|
91
|
-
join(process.cwd(), 'test', 'test-issue-1.md'),
|
|
92
|
-
'utf8'
|
|
93
|
-
)
|
|
94
|
-
const actual = await fn(md)
|
|
95
|
-
// console.log(JSON.stringify(actual, null, 0))
|
|
96
|
-
t.deepEqual(actual, expected)
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
test('parse(md) return nothing', async (t) => {
|
|
100
|
-
const expected = {}
|
|
101
|
-
|
|
102
|
-
const md = await readFile(
|
|
103
|
-
join(process.cwd(), 'test', 'test-issue-2.md'),
|
|
104
|
-
'utf8'
|
|
105
|
-
)
|
|
106
|
-
const actual = await fn(md)
|
|
107
|
-
// console.log(JSON.stringify(actual, null, 0))
|
|
108
|
-
t.deepEqual(actual, expected)
|
|
109
|
-
})
|
package/test/test-issue-1.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
### Event Description
|
|
2
|
-
|
|
3
|
-
Let's meet for coffee and chat about tech, coding, Cyprus and the newly formed
|
|
4
|
-
CDC (Cyprus Developer Community).
|
|
5
|
-
|
|
6
|
-
### Location
|
|
7
|
-
|
|
8
|
-
[Cafe Nero Finikoudes, Larnaka](https://goo.gl/maps/Bzjxdeat3BSdsUSVA)
|
|
9
|
-
|
|
10
|
-
### Date
|
|
11
|
-
|
|
12
|
-
11.03.2022
|
|
13
|
-
|
|
14
|
-
### Time
|
|
15
|
-
|
|
16
|
-
16:00
|
|
17
|
-
|
|
18
|
-
### Duration
|
|
19
|
-
|
|
20
|
-
2h
|
|
21
|
-
|
|
22
|
-
### List Item Checked
|
|
23
|
-
|
|
24
|
-
- [x] I agree to follow this project's
|
|
25
|
-
[Code of Conduct](https://berlincodeofconduct.org)
|
|
26
|
-
|
|
27
|
-
### List Item Unchecked
|
|
28
|
-
|
|
29
|
-
- [ ] I agree to follow this project's
|
|
30
|
-
[Code of Conduct](https://berlincodeofconduct.org)
|
|
31
|
-
|
|
32
|
-
### Mixed Task List
|
|
33
|
-
|
|
34
|
-
- [x] checked
|
|
35
|
-
- [ ] unchecked
|
|
36
|
-
- [x] checked 2
|
|
37
|
-
- [x] checked 3
|
|
38
|
-
- [ ] unchecked 2
|
|
39
|
-
|
|
40
|
-
### Complex List
|
|
41
|
-
|
|
42
|
-
- one
|
|
43
|
-
- two
|
|
44
|
-
- three
|
|
45
|
-
- four
|
|
46
|
-
1. five
|
|
47
|
-
2. six
|
|
48
|
-
|
|
49
|
-
### Repositories
|
|
50
|
-
|
|
51
|
-
```csv
|
|
52
|
-
https://example.com/repository-1
|
|
53
|
-
https://example.com/repository-2
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Visibility
|
|
57
|
-
|
|
58
|
-
Internal
|