data-restructor 3.3.3 → 3.4.0
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/.github/ISSUE_TEMPLATE/bug_report.md +2 -2
- package/.github/workflows/codeql-analysis.yml +4 -4
- package/.github/workflows/continuous-integration.yaml +84 -0
- package/CHANGELOG.md +103 -75
- package/CONTRIBUTING.md +51 -43
- package/Commands.md +15 -15
- package/README.md +188 -137
- package/SECURITY.md +15 -0
- package/coverage/coverage-summary.json +4 -4
- package/coverage/datarestructor.js.html +446 -320
- package/coverage/describedfield.js.html +47 -47
- package/coverage/index.html +19 -19
- package/coverage/templateResolver.js.html +26 -26
- package/devdist/datarestructor-global-all.js +65 -23
- package/devdist/datarestructor-ie-global-all.js +65 -23
- package/devdist/datarestructor-ie.js +1479 -1616
- package/devdist/datarestructor.js +1439 -1559
- package/devdist/describedfield-ie.js +259 -279
- package/devdist/describedfield.js +257 -277
- package/devdist/templateResolver-ie.js +220 -252
- package/devdist/templateResolver.js +196 -227
- package/dist/datarestructor-global-all-min.js +1 -1
- package/dist/datarestructor-ie-global-all-min.js +1 -1
- package/dist/datarestructor-ie.js +1 -1
- package/dist/datarestructor-ie.js.map +1 -1
- package/dist/datarestructor.js +1 -1
- package/dist/datarestructor.js.map +1 -1
- package/dist/describedfield-ie.js +1 -1
- package/dist/describedfield-ie.js.map +1 -1
- package/dist/describedfield.js +1 -1
- package/dist/describedfield.js.map +1 -1
- package/dist/templateResolver-ie.js +1 -1
- package/dist/templateResolver-ie.js.map +1 -1
- package/dist/templateResolver.js +1 -1
- package/dist/templateResolver.js.map +1 -1
- package/docs/datarestructor.js.html +66 -24
- package/docs/describedfield.js.html +1 -1
- package/docs/index.html +49 -44
- package/docs/module-datarestructor.DescribedEntryCreator.html +1 -1
- package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
- package/docs/module-datarestructor.Restructor.html +3 -3
- package/docs/module-datarestructor.Transform.html +7 -30
- package/docs/module-datarestructor.html +100 -3
- package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
- package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
- package/docs/module-described_field.html +1 -1
- package/docs/module-template_resolver.Resolver.html +1 -1
- package/docs/module-template_resolver.html +1 -1
- package/docs/templateResolver.js.html +1 -1
- package/package.json +16 -14
- package/renovate.json +20 -0
- package/src/js/datarestructor.js +65 -23
- package/test/js/DataRestructorUseCaseTest.js +36 -0
- package/.github/workflows/action.yaml +0 -44
|
@@ -24,8 +24,8 @@ If applicable, add screenshots to help explain your problem.
|
|
|
24
24
|
|
|
25
25
|
**Scope:**
|
|
26
26
|
- Version [e.g. v0.8]
|
|
27
|
-
- Module (e.g.
|
|
28
|
-
- Location/Feature within the Module (e.g.
|
|
27
|
+
- Module (e.g. datarestructor.js)
|
|
28
|
+
- Location/Feature within the Module (e.g. recursion duplication removal)
|
|
29
29
|
|
|
30
30
|
**Additional context**
|
|
31
31
|
Add any other context about the problem here.
|
|
@@ -39,11 +39,11 @@ jobs:
|
|
|
39
39
|
|
|
40
40
|
steps:
|
|
41
41
|
- name: Checkout repository
|
|
42
|
-
uses: actions/checkout@
|
|
42
|
+
uses: actions/checkout@v3
|
|
43
43
|
|
|
44
44
|
# Initializes the CodeQL tools for scanning.
|
|
45
45
|
- name: Initialize CodeQL
|
|
46
|
-
uses: github/codeql-action/init@
|
|
46
|
+
uses: github/codeql-action/init@v2
|
|
47
47
|
with:
|
|
48
48
|
languages: ${{ matrix.language }}
|
|
49
49
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
55
55
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
56
56
|
- name: Autobuild
|
|
57
|
-
uses: github/codeql-action/autobuild@
|
|
57
|
+
uses: github/codeql-action/autobuild@v2
|
|
58
58
|
|
|
59
59
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
60
60
|
# 📚 https://git.io/JvXDl
|
|
@@ -68,4 +68,4 @@ jobs:
|
|
|
68
68
|
# make release
|
|
69
69
|
|
|
70
70
|
- name: Perform CodeQL Analysis
|
|
71
|
-
uses: github/codeql-action/analyze@
|
|
71
|
+
uses: github/codeql-action/analyze@v2
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: Continuous Integration
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
# Ignore changes in folders with generated contents or documentation.
|
|
8
|
+
# Need to match git add parameters below.
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- 'coverage/**'
|
|
11
|
+
- 'devdist/**'
|
|
12
|
+
- 'dist/**'
|
|
13
|
+
- 'docs/**'
|
|
14
|
+
- '**/*.md'
|
|
15
|
+
pull_request:
|
|
16
|
+
branches:
|
|
17
|
+
- master
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
env:
|
|
23
|
+
CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts
|
|
24
|
+
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v3
|
|
27
|
+
with:
|
|
28
|
+
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
|
|
29
|
+
|
|
30
|
+
# Build
|
|
31
|
+
- uses: actions/setup-node@v3
|
|
32
|
+
with:
|
|
33
|
+
node-version: '18'
|
|
34
|
+
- name: Install node packages
|
|
35
|
+
run: npm ci
|
|
36
|
+
- name: Build package (lint, test, build, package, merge)
|
|
37
|
+
run: npm run package
|
|
38
|
+
|
|
39
|
+
# Archive generated or updated files
|
|
40
|
+
- name: Archive code coverage results
|
|
41
|
+
uses: actions/upload-artifact@v3
|
|
42
|
+
with:
|
|
43
|
+
name: test-code-coverage-report
|
|
44
|
+
path: coverage
|
|
45
|
+
retention-days: 14
|
|
46
|
+
if-no-files-found: error
|
|
47
|
+
- name: Archive documentation
|
|
48
|
+
uses: actions/upload-artifact@v3
|
|
49
|
+
with:
|
|
50
|
+
name: documentation
|
|
51
|
+
path: docs
|
|
52
|
+
retention-days: 14
|
|
53
|
+
if-no-files-found: error
|
|
54
|
+
- name: Archive build artifacts
|
|
55
|
+
uses: actions/upload-artifact@v3
|
|
56
|
+
with:
|
|
57
|
+
name: distribution-production
|
|
58
|
+
path: dist
|
|
59
|
+
retention-days: 14
|
|
60
|
+
if-no-files-found: error
|
|
61
|
+
- name: Archive build artifacts
|
|
62
|
+
uses: actions/upload-artifact@v3
|
|
63
|
+
with:
|
|
64
|
+
name: distribution-development
|
|
65
|
+
path: devdist
|
|
66
|
+
retention-days: 14
|
|
67
|
+
if-no-files-found: error
|
|
68
|
+
|
|
69
|
+
# Commit and push all changed files
|
|
70
|
+
- name: Display event name
|
|
71
|
+
if: env.is-auto-commit == false
|
|
72
|
+
run: echo "github.event_name=${{ github.event_name }}"
|
|
73
|
+
- name: Commit build artifacts (dist, devdist, docs, coverage)
|
|
74
|
+
# Only run when a pull request gets merged or a commit is pushed to the main branch
|
|
75
|
+
# git add parameters need to match paths-ignore parameters above
|
|
76
|
+
# Git pull before add/commit/push to reduce race conditions on parallel builds
|
|
77
|
+
if: github.event_name == 'push'
|
|
78
|
+
run: |
|
|
79
|
+
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
|
|
80
|
+
git config --global user.email 'joht@users.noreply.github.com'
|
|
81
|
+
git pull
|
|
82
|
+
git add coverage devdist dist docs *.md
|
|
83
|
+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
|
|
84
|
+
git push
|
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
# CHANGELOG.md
|
|
2
|
-
## **v3.3.3** IE support fix (latest)
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## **v3.4.0** Update to Node.js v18 (latest)
|
|
4
|
+
|
|
5
|
+
This version contains version updates including an update to Node.js v18.
|
|
6
|
+
|
|
7
|
+
## **v3.3.5** Automate MergerJS
|
|
8
|
+
|
|
9
|
+
### Automation
|
|
10
|
+
|
|
11
|
+
- [#42](https://github.com/JohT/data-restructor-js/issues/42) The command `npm run merger` is now able to run automatically.
|
|
12
|
+
- [#44](https://github.com/JohT/data-restructor-js/issues/44) Push Continuous Integration build artifacts into the repository.
|
|
13
|
+
|
|
14
|
+
## **v3.3.4** Remove duplicate groups within recursion
|
|
15
|
+
|
|
16
|
+
### Fixes
|
|
17
|
+
|
|
18
|
+
- #12 Zero recursion duplication should be possible
|
|
19
|
+
|
|
20
|
+
## **v3.3.3** IE support fix
|
|
21
|
+
|
|
22
|
+
### Fixes
|
|
23
|
+
|
|
5
24
|
- Use classic property definitions idiom instead of [ES6 PropertyShorthand](http://es6-features.org/#PropertyShorthand) for internet explorer (IE) support.
|
|
6
25
|
|
|
7
26
|
## **v3.3.2** Encourage Open Source Contributing
|
|
8
|
-
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
9
30
|
- [README.md](README.md#build-all) contains a description on how to build the module.
|
|
10
31
|
- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) sets the standard for an open, welcoming,
|
|
11
32
|
diverse, inclusive, and healthy community.
|
|
@@ -16,77 +37,83 @@ diverse, inclusive, and healthy community.
|
|
|
16
37
|
|
|
17
38
|
## **v3.3.1** Output folder fixed
|
|
18
39
|
|
|
19
|
-
### Fixes
|
|
40
|
+
### Fixes
|
|
41
|
+
|
|
20
42
|
- Minified output destination fixed. Minified files are now correctly written into the "dist" folder (instead of "dev").
|
|
21
43
|
|
|
22
44
|
## **v3.3.0** Merged source files for direct use without module system
|
|
23
45
|
|
|
24
|
-
### Features
|
|
46
|
+
### Features
|
|
25
47
|
|
|
26
48
|
- #7 Add merged global JavaScript files in "dist" and "devdist" to use them without module system
|
|
27
49
|
- security vulnerability CVE-2021-23358 https://github.com/advisories/GHSA-cf4h-3jhx-xvhq addressed
|
|
28
50
|
- [README.md](README.md#credits) now contains a lists of credits
|
|
29
51
|
- [COMMANDS.MD](COMMANDS.MD#most-important-commands-for-development) now contains a separate list for commands, that are used on a regular basis
|
|
52
|
+
|
|
30
53
|
## **v3.2.0** Configurable recursion depth above which duplications will be removed
|
|
31
54
|
|
|
32
|
-
### Features
|
|
55
|
+
### Features
|
|
33
56
|
|
|
34
57
|
- #5 Configurable recursion depth above which duplications will be removed.
|
|
35
58
|
|
|
36
59
|
## **v3.1.0** Configurable recursion depth for sub groups
|
|
37
60
|
|
|
38
|
-
### Features
|
|
61
|
+
### Features
|
|
39
62
|
|
|
40
63
|
- Configurable maximum recursion depth for field groups inside groups inside groups...
|
|
41
64
|
- Improved JSDoc structure and contents
|
|
42
|
-
|
|
65
|
+
|
|
66
|
+
### Fixes
|
|
43
67
|
|
|
44
68
|
- [#3](https://github.com/JohT/data-restructor-js/issues/3) Group hierarchy limited to 1 since v3.0.0
|
|
45
69
|
|
|
46
|
-
### Deprecated
|
|
70
|
+
### Deprecated
|
|
47
71
|
|
|
48
72
|
- `datarestructor.Restructor.processJsonUsingDescriptions(jsonData, descriptions)` is deprecated.
|
|
49
73
|
Please use `new datarestructor.Transform(descriptions).processJson(jsonData)` instead.
|
|
50
74
|
|
|
51
75
|
## **v3.0.0** Introducing DescribedDataField
|
|
52
|
-
### Features:
|
|
53
76
|
|
|
54
|
-
|
|
77
|
+
### Features
|
|
55
78
|
|
|
56
|
-
|
|
79
|
+
- Pure, non cyclic data result that can be converted to json without using additional functions
|
|
80
|
+
|
|
81
|
+
### Breaking Changes
|
|
82
|
+
|
|
83
|
+
- DescribedDataField replaces DescribedEntry as an element for the restructured output
|
|
84
|
+
- DescribedEntry remains only for internal use
|
|
85
|
+
- DescribedEntry function "resolveTemplate" is removed. "templateResolver.js" can be used instead.
|
|
86
|
+
- DescribedEntry function "publicFieldsJson" is removed. `JSON.stringify(describedEntry.describedField)` can be used instead.
|
|
57
87
|
|
|
58
|
-
- DescribedDataField replaces DescribedEntry as an element for the restructured output
|
|
59
|
-
- DescribedEntry remains only for internal use
|
|
60
|
-
- DescribedEntry function "resolveTemplate" is removed. "templateResolver.js" can be used instead.
|
|
61
|
-
- DescribedEntry function "publicFieldsJson" is removed. `JSON.stringify(describedEntry.describedField)` can be used instead.
|
|
62
88
|
## **v2.3.0** Continuous Integration
|
|
63
89
|
|
|
64
|
-
### Features
|
|
90
|
+
### Features
|
|
91
|
+
|
|
92
|
+
- Continuous Integration using GitHub Actions
|
|
93
|
+
- Build using nodes package manager (npm)
|
|
94
|
+
- Bundle (minification,...) using Parcel Bundler
|
|
95
|
+
- Automated already existing unit tests using Jasmine
|
|
96
|
+
- Unit-Test coverage measurement using nyc
|
|
97
|
+
- Documentation Generation using JSDoc
|
|
98
|
+
- Static code analysis using ESLint
|
|
99
|
+
- Updated documentation
|
|
65
100
|
|
|
66
|
-
- Continuous Integration using GitHub Actions
|
|
67
|
-
- Build using nodes package manager (npm)
|
|
68
|
-
- Bundle (minification,...) using Parcel Bundler
|
|
69
|
-
- Automated already existing unit tests using Jasmine
|
|
70
|
-
- Unit-Test coverage measurement using nyc
|
|
71
|
-
- Documentation Generation using JSDoc
|
|
72
|
-
- Static code analysis using ESLint
|
|
73
|
-
- Updated documentation
|
|
74
101
|
## **v2.2.0** Resolving template with described fields
|
|
75
102
|
|
|
76
|
-
### Features
|
|
103
|
+
### Features
|
|
77
104
|
|
|
78
|
-
|
|
79
|
-
|
|
105
|
+
- Since v1.2.0 templates containing variables in double curly brackets can be resolved by the function `resolveTemplate(templateString)`. Now, it is not only possible to resolve the contained meta data,
|
|
106
|
+
but also the described fields directly. Based on the JSON below, the resolver would now provide these results:
|
|
80
107
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
108
|
+
- `"{{customerNumber}}"`-> `"123"`
|
|
109
|
+
- `"{{details.name}}"`-> `"Smith"`
|
|
110
|
+
- `"{{details.age}}"`-> `"31"`
|
|
84
111
|
|
|
85
|
-
|
|
112
|
+
Previously (since v1.2.0), these results could only be obtained with (remains unchanged):
|
|
86
113
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
114
|
+
- `"{{value}}"`-> `"123"`
|
|
115
|
+
- `"{{details[0].value}}"`-> `"Smith"`
|
|
116
|
+
- `"{{details[1].value}}"`-> `"31"`
|
|
90
117
|
|
|
91
118
|
```JSON
|
|
92
119
|
{
|
|
@@ -116,29 +143,30 @@ Please use `new datarestructor.Transform(descriptions).processJson(jsonData)` in
|
|
|
116
143
|
|
|
117
144
|
## **v2.1.0** new optional fields "abbreviation" and "image" (2020-12-25)
|
|
118
145
|
|
|
119
|
-
### Features
|
|
146
|
+
### Features
|
|
120
147
|
|
|
121
|
-
|
|
122
|
-
- If the variable `{{fieldName}}` is missing in the property pattern in "template mode", the right most part of the property name is used as field name. This corresponds to the behavior of the "equal mode". Previously this led to an error that forced the use of the "equal mode" in that case.
|
|
148
|
+
- With the two new optional fields **abbreviation** and **image**, that can be specified for each `PropertyStructureDescription`, it is easier to separate display related fields from e.g. the category. These fields are transferred directly into the resulting `DescribedEntry` and do not affect other behavior (grouping, filtering...) in any kind.
|
|
123
149
|
|
|
124
|
-
|
|
150
|
+
- If the variable `{{fieldName}}` is missing in the property pattern in "template mode", the right most part of the property name is used as field name. This corresponds to the behavior of the "equal mode". Previously this led to an error that forced the use of the "equal mode" in that case.
|
|
125
151
|
|
|
126
|
-
|
|
152
|
+
### Fix
|
|
127
153
|
|
|
154
|
+
- Some minor refactoring
|
|
128
155
|
|
|
129
156
|
## **v2.0.0** Added "publicFieldsJson" to "DescribedEntry" (2014-12-12)
|
|
130
157
|
|
|
131
|
-
### Features
|
|
158
|
+
### Features
|
|
132
159
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
- It is now possible to convert the public fields of an `DescribedEntry` to JSON using its function `publicFieldsJson`.
|
|
161
|
+
This includes all contained groups, that may contain `DescribedEntry`s themselves.
|
|
162
|
+
Prior to this release, the following error occurred when calling `JSON.stringify(describedEntry)`:
|
|
163
|
+
`TypeError: Converting circular structure to JSON`
|
|
137
164
|
|
|
138
165
|
**Note:**
|
|
139
166
|
The property `isMatchingIndex` of the `DescribedEntry` had been renamed to `_isMatchingIndex` since it is an internal property and should not be used outside. Since this is a "breaking change" (in theory), it lead to a new major version.
|
|
140
167
|
|
|
141
168
|
This example shows how the returned JSON looks like using parameter "space" = 2 (pretty print with 2 spaces indentation) when the `DescribedEntry` contains the group `options`:
|
|
169
|
+
|
|
142
170
|
```JSON
|
|
143
171
|
{
|
|
144
172
|
"category": "account",
|
|
@@ -165,48 +193,48 @@ Please use `new datarestructor.Transform(descriptions).processJson(jsonData)` in
|
|
|
165
193
|
}
|
|
166
194
|
```
|
|
167
195
|
|
|
168
|
-
|
|
169
196
|
## **v1.2.0** Resolving template containing properties of the described entry as variables (2014-11-29)
|
|
170
197
|
|
|
171
|
-
### Features
|
|
172
|
-
|
|
198
|
+
### Features
|
|
199
|
+
|
|
200
|
+
- It is now possible to resolve a string containing variables in double curly brackets of an `DecribedEntry` using the function `resolveTemplate(templateString)`.
|
|
173
201
|
|
|
174
|
-
|
|
175
|
-
- `"{{fieldName}}"`
|
|
176
|
-
- `"{{displayName}}"`
|
|
177
|
-
- `"{{value}}"`
|
|
178
|
-
- `"{{index}}"`
|
|
179
|
-
- `"{{index[1]}}"`
|
|
202
|
+
#### Variables that can be used
|
|
180
203
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
204
|
+
- `"{{fieldName}}"`
|
|
205
|
+
- `"{{displayName}}"`
|
|
206
|
+
- `"{{value}}"`
|
|
207
|
+
- `"{{index}}"`
|
|
208
|
+
- `"{{index[1]}}"`
|
|
186
209
|
|
|
187
|
-
|
|
188
|
-
// resolved is: "Name: Smith"
|
|
189
|
-
```
|
|
210
|
+
#### Example
|
|
190
211
|
|
|
212
|
+
```javascript
|
|
213
|
+
var rawEntry = { name: "responses[0].hits.hits[3]._source.name", value: "Smith" };
|
|
214
|
+
var description = new datarestructor.PropertyStructureDescriptionBuilder().type("testtype").category("testcategory").build();
|
|
215
|
+
var describedEntry = new datarestructor.DescribedEntryCreator(rawEntry, description);
|
|
216
|
+
|
|
217
|
+
var resolved = describedEntry.resolveTemplate("{{displayName}}: {{value}}");
|
|
218
|
+
// resolved is: "Name: Smith"
|
|
219
|
+
```
|
|
191
220
|
|
|
192
221
|
## **v1.1.0** Joining and renaming groups (2014-11-08)
|
|
193
222
|
|
|
194
|
-
### Features
|
|
223
|
+
### Features
|
|
195
224
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
225
|
+
- Group destination name and joining (JohT@534c368bcb835c110e1255508ed44c790972955c)
|
|
226
|
+
- Groups can now be renamed, when they get moved to another destination.
|
|
227
|
+
- If more than one source group (array) is moved into a single destination, they get joined.
|
|
199
228
|
Previously, only the last one remained, which made it impossible to structure data within one single (e.g. main) entry.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
229
|
+
- Debug mode introduced (JohT@72232e7f23ced9655c1d2693a3a5b3163c312221)
|
|
230
|
+
- Minor refactorings (JohT@14094fe247c1c1551ff518a1378a26b0cfc074c9)
|
|
203
231
|
|
|
204
232
|
## **v1.0.0** Initial Release (2014-10-25)
|
|
205
233
|
|
|
206
|
-
### Features
|
|
234
|
+
### Features
|
|
207
235
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
236
|
+
- Adapter that takes e.g. parsed JSON and transforms it into a standardized structure
|
|
237
|
+
- Multiple transformation steps including flattening, removing duplicates, grouping, ...
|
|
238
|
+
- Takes descriptions that reflect the incoming structure and define the standardized output
|
|
239
|
+
- Reusable and flexible
|
|
240
|
+
- Supports most browser including ie5
|
package/CONTRIBUTING.md
CHANGED
|
@@ -4,20 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
The following is a set of guidelines for contributing to the search menu UI. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Table Of Contents
|
|
8
8
|
|
|
9
9
|
[Code of Conduct](#code-of-conduct)
|
|
10
10
|
|
|
11
11
|
[What should I know before I get started?](#what-should-i-know-before-i-get-started)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
- [Prerequisites](#prerequisites)
|
|
14
|
+
- [First Steps](#first-steps)
|
|
15
|
+
- [Tests](#tests)
|
|
15
16
|
|
|
16
17
|
[How Can I Contribute?](#how-can-i-contribute)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
- [Reporting Bugs](#reporting-bugs)
|
|
20
|
+
- [Suggesting Enhancements](#suggesting-enhancements)
|
|
21
|
+
- [Your First Code Contribution](#your-first-code-contribution)
|
|
22
|
+
- [Pull Requests](#pull-requests)
|
|
21
23
|
|
|
22
24
|
## Code of Conduct
|
|
23
25
|
|
|
@@ -26,16 +28,22 @@ This project and everyone participating in it is governed by the [Code of Conduc
|
|
|
26
28
|
## What should I know before I get started?
|
|
27
29
|
|
|
28
30
|
### Prerequisites
|
|
31
|
+
|
|
29
32
|
- Install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
|
|
30
|
-
- Install [merger.js](https://github.com/joao-neves95/merger-js/blob/master/README.md) using `npm install merger-js -g`
|
|
31
33
|
|
|
32
34
|
### First steps
|
|
33
35
|
|
|
34
|
-
- [Fork](https://docs.github.com/en/github/getting-started-with-github/quickstart/fork-a-repo) this repository
|
|
36
|
+
- [Fork](https://docs.github.com/en/github/getting-started-with-github/quickstart/fork-a-repo) this repository
|
|
35
37
|
- Setup and build the project locally as described in [README.md](README.md#build-all)
|
|
36
38
|
- A list of all commands can be found in [COMMANDS.md](COMMANDS.md)
|
|
37
39
|
|
|
40
|
+
### GIT commit
|
|
41
|
+
|
|
42
|
+
- Create a feature branch before making a commit.
|
|
43
|
+
- Automatically generated build artifacts (`dist`, - `devdist`, `docs`, `coverage` folder contents) shouldn't be included in a commit. The continuous integration pipeline will generate them and commit them separately. This also means that a feature branch needs to be pulled after the pipeline has finished before adding further commits. When the pull request is ready to merge a rebase may be considered to clean up the history and get the feature branch up to date if needed. The same applies here: Build artifacts should be left out since the pipeline will take care of them.
|
|
44
|
+
|
|
38
45
|
### Tests
|
|
46
|
+
|
|
39
47
|
- All unit tests are integrated into the build
|
|
40
48
|
- For immediate feedback open [test/js/SpecRunner.html](test/js/SpecRunner.html) to run JavaScript [Jasmine](https://jasmine.github.io) Unit-Tests in the browser.
|
|
41
49
|
- To assure high automation this project enforces 90% branch coverage within the build, so please provide tests for every change.
|
|
@@ -52,7 +60,7 @@ Before creating bug reports, please check [this list](#before-submitting-a-bug-r
|
|
|
52
60
|
|
|
53
61
|
#### Before Submitting A Bug Report
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
- **Perform a [search](https://github.com/JohT/data-restructor-js/issues)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one.
|
|
56
64
|
|
|
57
65
|
#### How Do I Submit A (Good) Bug Report?
|
|
58
66
|
|
|
@@ -60,26 +68,26 @@ Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/).
|
|
|
60
68
|
|
|
61
69
|
Explain the problem and include additional details to help maintainers reproduce the problem:
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
- **Use a clear and descriptive title** for the issue to identify the problem.
|
|
72
|
+
- **Describe the exact steps which reproduce the problem** in as many details as possible.
|
|
73
|
+
- **If possible, provide a "reproducer"** e.g. in an public example repository containing the easy debugable code to reproduce the problem. It can also be a simple HTML and JS attached as files.
|
|
74
|
+
- **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
|
|
75
|
+
- **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
|
|
76
|
+
- **Explain which behavior you expected to see instead and why.**
|
|
69
77
|
|
|
70
|
-
|
|
78
|
+
- **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
|
|
71
79
|
|
|
72
80
|
Provide more context by answering these questions:
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
- **Did the problem start happening recently** (e.g. after updating to a new version) or was this always a problem?
|
|
83
|
+
- If the problem started happening recently, **can you reproduce the problem in an older version?** What's the most recent version in which the problem doesn't happen?
|
|
84
|
+
- **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
|
|
85
|
+
- If the problem is related to working with files (e.g. opening and editing files), **does the problem happen for all files and projects or only some?** Does the problem happen only when working with local or remote files (e.g. on network drives), with files of a specific type (e.g. only JavaScript or Python files), with large files or files with very long lines, or with files in a specific encoding? Is there anything else special about the files you are using?
|
|
78
86
|
|
|
79
87
|
Include details about your configuration and environment:
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
- **Which version of the search menu UI are you using?**
|
|
90
|
+
- **What's the name and version of the OS and browser you're using**
|
|
83
91
|
|
|
84
92
|
### Suggesting Enhancements
|
|
85
93
|
|
|
@@ -89,20 +97,20 @@ Before creating enhancement suggestions, please check [this list](#before-submit
|
|
|
89
97
|
|
|
90
98
|
#### Before Submitting An Enhancement Suggestion
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
- **Perform a [search](https://github.com/JohT/data-restructor-js/issues)** to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
|
|
93
101
|
|
|
94
102
|
#### How Do I Submit A (Good) Enhancement Suggestion?
|
|
95
103
|
|
|
96
104
|
Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue on that repository and provide the following information:
|
|
97
105
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
- **Use a clear and descriptive title** for the issue to identify the suggestion.
|
|
107
|
+
- **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
|
|
108
|
+
- **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
|
|
109
|
+
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
|
|
110
|
+
- **Explain why this enhancement would be useful** to most search menu UI users.
|
|
111
|
+
- **List some other libraries where this enhancement exists.**
|
|
112
|
+
- **Specify which version you're using.**
|
|
113
|
+
- **Specify the name and version of the OS and browser you're using.**
|
|
106
114
|
|
|
107
115
|
### Your First Code Contribution
|
|
108
116
|
|
|
@@ -132,16 +140,16 @@ The easiest approach is to write code that matches the style of existing one. If
|
|
|
132
140
|
|
|
133
141
|
### Git Commit Messages
|
|
134
142
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
- Use the present tense ("Add feature" not "Added feature")
|
|
144
|
+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
|
145
|
+
- Limit the first line to 72 characters or less
|
|
146
|
+
- Include a reference to the pull request
|
|
147
|
+
- Reference related issues and pull requests as well as further details liberally after the first line
|
|
140
148
|
|
|
141
149
|
### JavaScript
|
|
142
150
|
|
|
143
|
-
|
|
144
|
-
changes with internet explorer developer mode in IE5 mode. Include polyfills or ponyfills
|
|
145
|
-
if necessary. These are included in modules packages especially for ie.
|
|
146
|
-
Including as many browsers as possible is a key feature, that might change someday,
|
|
147
|
-
but only for a good reason.
|
|
151
|
+
- Compatibility with old browser like IE5 is important for now. Please test your
|
|
152
|
+
changes with internet explorer developer mode in IE5 mode. Include polyfills or ponyfills
|
|
153
|
+
if necessary. These are included in modules packages especially for ie.
|
|
154
|
+
Including as many browsers as possible is a key feature, that might change someday,
|
|
155
|
+
but only for a good reason.
|
package/Commands.md
CHANGED
|
@@ -2,20 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Overview of the commands to test, run and build this project as well as those that were used to setup it.
|
|
4
4
|
|
|
5
|
-
## Most important commands for development
|
|
5
|
+
## Most important commands for development
|
|
6
|
+
|
|
6
7
|
- `npm install` Installs all dependencies and creates the folder `node_modules`, that is needed for all following commands.
|
|
7
8
|
- `npm run package` Ready to publish build incl. test, coverage, doc generation, dev+prod build
|
|
8
9
|
- `npm login` + `npm publish` To publish a new release. Be sure to run npm run package first.
|
|
9
10
|
|
|
11
|
+
## Commands to test, run and build the project
|
|
10
12
|
|
|
11
|
-
## Commands that needs to be installed globally to build the project
|
|
12
|
-
- `npm install merger-js -g` Cross-platform CLI build tool to bundle JavaScript files without modules
|
|
13
|
-
|
|
14
|
-
**Notice:** merger needs manual input in the console and prompts to select the source.
|
|
15
|
-
Select "all" using the arrow down key followed by enter to continue the build. If there is a better solution for that, propose it by creating an issue. `merger.js` is helpful to create additional JavaScript bundles without module system.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Commands to test, run and build the project:
|
|
19
13
|
- `npm run coverage` Run all unit tests (using jasmine) **with** reporting coverage (using nyc/istanbul)
|
|
20
14
|
- `npm test` Only all unit tests (using jasmine) **without** coverage report
|
|
21
15
|
- `npm run coverage-badge` Updates code coverage badge inside `README.md`
|
|
@@ -23,8 +17,12 @@ Select "all" using the arrow down key followed by enter to continue the build. I
|
|
|
23
17
|
- `npm run build` Builds the application for production including minification,...
|
|
24
18
|
- `npm run dev` Builds the application for development (without minification) and starts the live server
|
|
25
19
|
- `npm run watch` Builds the application for development (without minification) without starting the server.
|
|
20
|
+
- `npm run merger` Merges JavaScript source files javascript file bundles that can be used with/without module system and can therefore be used directly within the browser (without node.js e.g.).
|
|
21
|
+
The command itself needs to send the letter "k" and the enter key to the merger command to automate
|
|
22
|
+
the key prompt that would otherwise block continuous integration.
|
|
23
|
+
|
|
24
|
+
## Commands used to setup the project
|
|
26
25
|
|
|
27
|
-
## Commands used to setup the project:
|
|
28
26
|
- `npm init` Initialize node package manager, creates `package.json` file.
|
|
29
27
|
- `npm install jasmine --save-dev` Adds jasmine unit test framework as development dependency.
|
|
30
28
|
- `npx jasmine init` Initializes jasmine, creates `spec/support/jasmine.json` file.
|
|
@@ -34,14 +32,16 @@ Select "all" using the arrow down key followed by enter to continue the build. I
|
|
|
34
32
|
- `npm install eslint --save-dev` Setup linter (static code quality analyzer)
|
|
35
33
|
- `npx eslint --init` Initialize linter configuration file
|
|
36
34
|
- `npm install istanbul-badges-readme --save-dev` Setup for code coverage badge for README.MD.
|
|
35
|
+
- `npm install --save-exact --save-dev node-notifier inquirer merger-js` Setup file merger for vanilla JS distributions.
|
|
37
36
|
- `npm audit fix` Fixes vulnerabilities
|
|
38
37
|
|
|
38
|
+
## Further steps
|
|
39
39
|
|
|
40
|
-
## Further steps:
|
|
41
40
|
- It would be great to get SpecRunner.html up and running in dev mode like: "dev": "parcel ./test/js/SpecRunner.html". [parcel issue 3407](https://github.com/parcel-bundler/parcel/issues/3407) may be key for that.
|
|
42
41
|
|
|
43
42
|
## References
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
|
|
44
|
+
- [Parcel - Getting Started](https://parceljs.org/getting_started.html)
|
|
45
|
+
- [Jasmine - Using Jasmine with node](https://jasmine.github.io/setup/nodejs.html)
|
|
46
|
+
- [Istanbul/nyc - Installation & Usage](https://github.com/istanbuljs/nyc#installation--usage)
|
|
47
|
+
- [ESLint - Getting Started](https://eslint.org/docs/user-guide/getting-started)
|