sportident.js 1.0.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/.dependency-cruiser.js +233 -0
- package/.editorconfig +12 -0
- package/.eslintignore +6 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/.github/workflows/npm.yml +17 -0
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/babel.config.js +21 -0
- package/build-docs.sh +25 -0
- package/docs/index.md +9 -0
- package/docs/typedoc/index.md +11 -0
- package/eslint.base.js +232 -0
- package/install.sh +6 -0
- package/jest.config.ts +49 -0
- package/nx.json +39 -0
- package/package.json +51 -0
- package/src/SiCard/BaseSiCard.test.ts +187 -0
- package/src/SiCard/BaseSiCard.ts +101 -0
- package/src/SiCard/IRaceResultData.ts +16 -0
- package/src/SiCard/ISiCard.ts +23 -0
- package/src/SiCard/ISiCardExamples.ts +4 -0
- package/src/SiCard/index.ts +2 -0
- package/src/SiCard/raceResultTools.test.ts +260 -0
- package/src/SiCard/raceResultTools.ts +150 -0
- package/src/SiCard/types/FCard.test.ts +19 -0
- package/src/SiCard/types/FCard.ts +14 -0
- package/src/SiCard/types/ModernSiCard.test.ts +186 -0
- package/src/SiCard/types/ModernSiCard.ts +241 -0
- package/src/SiCard/types/PCard.test.ts +19 -0
- package/src/SiCard/types/PCard.ts +14 -0
- package/src/SiCard/types/SIAC.test.ts +84 -0
- package/src/SiCard/types/SIAC.ts +19 -0
- package/src/SiCard/types/SiCard10.test.ts +85 -0
- package/src/SiCard/types/SiCard10.ts +17 -0
- package/src/SiCard/types/SiCard11.test.ts +84 -0
- package/src/SiCard/types/SiCard11.ts +19 -0
- package/src/SiCard/types/SiCard5.test.ts +149 -0
- package/src/SiCard/types/SiCard5.ts +129 -0
- package/src/SiCard/types/SiCard6.test.ts +179 -0
- package/src/SiCard/types/SiCard6.ts +222 -0
- package/src/SiCard/types/SiCard8.test.ts +137 -0
- package/src/SiCard/types/SiCard8.ts +129 -0
- package/src/SiCard/types/SiCard9.test.ts +132 -0
- package/src/SiCard/types/SiCard9.ts +128 -0
- package/src/SiCard/types/TCard.test.ts +19 -0
- package/src/SiCard/types/TCard.ts +14 -0
- package/src/SiCard/types/index.test.ts +26 -0
- package/src/SiCard/types/index.ts +15 -0
- package/src/SiCard/types/modernSiCardExamples.ts +364 -0
- package/src/SiCard/types/siCard5Examples.ts +73 -0
- package/src/SiCard/types/siCard6Examples.ts +262 -0
- package/src/SiCard/types/siCard8Examples.ts +152 -0
- package/src/SiCard/types/siCard9Examples.ts +143 -0
- package/src/SiDevice/INavigatorWebSerial.ts +78 -0
- package/src/SiDevice/INavigatorWebUsb.ts +62 -0
- package/src/SiDevice/ISiDevice.ts +48 -0
- package/src/SiDevice/ISiDeviceDriver.ts +35 -0
- package/src/SiDevice/README.md +13 -0
- package/src/SiDevice/SiDevice.test.ts +354 -0
- package/src/SiDevice/SiDevice.ts +132 -0
- package/src/SiDevice/WebSerialSiDeviceDriver.ts +146 -0
- package/src/SiDevice/WebUsbSiDeviceDriver.ts +343 -0
- package/src/SiDevice/index.ts +3 -0
- package/src/SiDevice/testUtils/index.ts +2 -0
- package/src/SiDevice/testUtils/testISiDeviceDriver.ts +63 -0
- package/src/SiDevice/testUtils/testISiDeviceDriverWithAutodetection.ts +72 -0
- package/src/SiStation/BaseSiStation.test.ts +221 -0
- package/src/SiStation/BaseSiStation.ts +253 -0
- package/src/SiStation/CoupledSiStation.test.ts +41 -0
- package/src/SiStation/CoupledSiStation.ts +130 -0
- package/src/SiStation/ISiMainStation.ts +29 -0
- package/src/SiStation/ISiSendTask.ts +9 -0
- package/src/SiStation/ISiStation.ts +88 -0
- package/src/SiStation/ISiTargetMultiplexer.ts +51 -0
- package/src/SiStation/SiMainStation.test.ts +222 -0
- package/src/SiStation/SiMainStation.ts +133 -0
- package/src/SiStation/SiSendTask.ts +50 -0
- package/src/SiStation/SiTargetMultiplexer.targeting.test.ts +112 -0
- package/src/SiStation/SiTargetMultiplexer.test.ts +605 -0
- package/src/SiStation/SiTargetMultiplexer.ts +241 -0
- package/src/SiStation/index.ts +5 -0
- package/src/SiStation/siStationExamples.ts +103 -0
- package/src/constants.test.ts +17 -0
- package/src/constants.ts +92 -0
- package/src/fakes/FakeSiCard/BaseFakeSiCard.test.ts +11 -0
- package/src/fakes/FakeSiCard/BaseFakeSiCard.ts +10 -0
- package/src/fakes/FakeSiCard/IFakeSiCard.ts +6 -0
- package/src/fakes/FakeSiCard/index.ts +2 -0
- package/src/fakes/FakeSiCard/types/FakeModernSiCard.test.ts +62 -0
- package/src/fakes/FakeSiCard/types/FakeModernSiCard.ts +43 -0
- package/src/fakes/FakeSiCard/types/FakeSIAC.ts +17 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard10.ts +17 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard11.ts +17 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard5.test.ts +42 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard5.ts +40 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard6.test.ts +62 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard6.ts +44 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard8.ts +16 -0
- package/src/fakes/FakeSiCard/types/FakeSiCard9.ts +16 -0
- package/src/fakes/FakeSiCard/types/index.ts +7 -0
- package/src/fakes/FakeSiDeviceDriver.ts +148 -0
- package/src/fakes/FakeSiMainStation.test.ts +141 -0
- package/src/fakes/FakeSiMainStation.ts +118 -0
- package/src/fakes/IFakeSiMainStation.ts +15 -0
- package/src/fakes/index.ts +2 -0
- package/src/index.ts +24 -0
- package/src/siProtocol.test.ts +509 -0
- package/src/siProtocol.ts +417 -0
- package/src/storage/SiArray.test.ts +103 -0
- package/src/storage/SiArray.ts +56 -0
- package/src/storage/SiBool.test.ts +81 -0
- package/src/storage/SiBool.ts +47 -0
- package/src/storage/SiDataType.test.ts +81 -0
- package/src/storage/SiDataType.ts +60 -0
- package/src/storage/SiDict.test.ts +115 -0
- package/src/storage/SiDict.ts +60 -0
- package/src/storage/SiEnum.test.ts +77 -0
- package/src/storage/SiEnum.ts +48 -0
- package/src/storage/SiFieldValue.test.ts +58 -0
- package/src/storage/SiFieldValue.ts +23 -0
- package/src/storage/SiInt.test.ts +80 -0
- package/src/storage/SiInt.ts +84 -0
- package/src/storage/SiModified.test.ts +135 -0
- package/src/storage/SiModified.ts +59 -0
- package/src/storage/SiStorage.test.ts +51 -0
- package/src/storage/SiStorage.ts +44 -0
- package/src/storage/index.test.ts +222 -0
- package/src/storage/index.ts +12 -0
- package/src/storage/interfaces.ts +41 -0
- package/src/storage/siStringEncoding.ts +1361 -0
- package/src/testUtils.test.ts +266 -0
- package/src/testUtils.ts +75 -0
- package/src/utils/NumberRange.test.ts +66 -0
- package/src/utils/NumberRange.ts +46 -0
- package/src/utils/NumberRangeRegistry.test.ts +49 -0
- package/src/utils/NumberRangeRegistry.ts +43 -0
- package/src/utils/bytes.test.ts +126 -0
- package/src/utils/bytes.ts +69 -0
- package/src/utils/errors.test.ts +29 -0
- package/src/utils/errors.ts +20 -0
- package/src/utils/events.test.ts +112 -0
- package/src/utils/events.ts +68 -0
- package/src/utils/general.test.ts +139 -0
- package/src/utils/general.ts +69 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/mixins.test.ts +40 -0
- package/src/utils/mixins.ts +13 -0
- package/src/utils/typed.ts +3 -0
- package/tsconfig.base.json +22 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* global module */
|
|
2
|
+
/* exported module */
|
|
3
|
+
|
|
4
|
+
const recommendedForbidden = [
|
|
5
|
+
{
|
|
6
|
+
name: 'no-circular',
|
|
7
|
+
severity: 'warn',
|
|
8
|
+
comment: 'Warn in case there\'s circular dependencies',
|
|
9
|
+
from: {},
|
|
10
|
+
to: {
|
|
11
|
+
circular: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'no-orphans',
|
|
16
|
+
severity: 'info',
|
|
17
|
+
comment: 'Inform in case there\'s orphans hiding in the code base',
|
|
18
|
+
from: {
|
|
19
|
+
orphan: true,
|
|
20
|
+
pathNot: '\\.d\\.ts$',
|
|
21
|
+
},
|
|
22
|
+
to: {},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'no-deprecated-core',
|
|
26
|
+
comment: 'Warn about dependencies on deprecated core modules.',
|
|
27
|
+
severity: 'warn',
|
|
28
|
+
from: {},
|
|
29
|
+
to: {
|
|
30
|
+
dependencyTypes: [
|
|
31
|
+
'core',
|
|
32
|
+
],
|
|
33
|
+
path: '^(punycode|domain|constants|sys|_linklist|_stream_wrap)$',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'no-deprecated-npm',
|
|
38
|
+
comment: 'These npm modules are deprecated - find an alternative.',
|
|
39
|
+
severity: 'warn',
|
|
40
|
+
from: {},
|
|
41
|
+
to: {
|
|
42
|
+
dependencyTypes: [
|
|
43
|
+
'deprecated',
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'no-non-package-json',
|
|
49
|
+
severity: 'error',
|
|
50
|
+
comment: 'Don\'t allow dependencies to packages not in package.json',
|
|
51
|
+
from: {},
|
|
52
|
+
to: {
|
|
53
|
+
dependencyTypes: [
|
|
54
|
+
'npm-no-pkg',
|
|
55
|
+
'npm-unknown',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'not-to-unresolvable',
|
|
61
|
+
comment: 'Don\'t allow dependencies on modules dependency-cruiser can\'t resolve to files on disk (which probably means they don\'t exist)',
|
|
62
|
+
severity: 'error',
|
|
63
|
+
from: {},
|
|
64
|
+
to: {
|
|
65
|
+
couldNotResolve: true,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// We want this for react stuff
|
|
69
|
+
// {
|
|
70
|
+
// name: 'no-duplicate-dep-types',
|
|
71
|
+
// comment: 'Warn if a dependency you\'re actually using occurs in your package.json more than once (technically: has more than one dependency type)',
|
|
72
|
+
// severity: 'warn',
|
|
73
|
+
// from: {},
|
|
74
|
+
// to: {
|
|
75
|
+
// moreThanOneDependencyType: true,
|
|
76
|
+
// },
|
|
77
|
+
// },
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const customForbidden = [
|
|
81
|
+
{
|
|
82
|
+
name: 'not-to-test',
|
|
83
|
+
comment: 'Don\'t allow dependencies from outside to test files',
|
|
84
|
+
severity: 'error',
|
|
85
|
+
from: {
|
|
86
|
+
pathNot: '\\.test\\.(j|t)sx?$|testUtils\\.(j|t)sx?$|/testUtils/',
|
|
87
|
+
},
|
|
88
|
+
to: {
|
|
89
|
+
path: '\\.test\\.(j|t)sx?$|testUtils\\.(j|t)sx?$|/testUtils/',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'not-to-testbench',
|
|
94
|
+
comment: 'Don\'t allow dependencies from outside to testbench',
|
|
95
|
+
severity: 'error',
|
|
96
|
+
from: {
|
|
97
|
+
pathNot: '^testbench',
|
|
98
|
+
},
|
|
99
|
+
to: {
|
|
100
|
+
path: '^testbench',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'not-to-src-si-device-drivers',
|
|
105
|
+
comment: 'Don\'t allow dependencies from outside to src/SiDevice/drivers',
|
|
106
|
+
severity: 'error',
|
|
107
|
+
from: {
|
|
108
|
+
pathNot: '^(src/SiDevice/)',
|
|
109
|
+
},
|
|
110
|
+
to: {
|
|
111
|
+
path: '^src/SiDevice/drivers',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'not-from-testbench-inside-src',
|
|
116
|
+
comment: 'Don\'t allow dependencies from testbench to src except index.(j|t)s[x]',
|
|
117
|
+
severity: 'error',
|
|
118
|
+
from: {
|
|
119
|
+
path: '^testbench',
|
|
120
|
+
},
|
|
121
|
+
to: {
|
|
122
|
+
path: '^src',
|
|
123
|
+
pathNot: '^src/index\\.(j|t)sx?',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'not-from-utils-outside',
|
|
128
|
+
comment: 'Don\'t allow dependencies from utils outside utils',
|
|
129
|
+
severity: 'error',
|
|
130
|
+
from: {
|
|
131
|
+
path: '^utils/',
|
|
132
|
+
},
|
|
133
|
+
to: {
|
|
134
|
+
pathNot: '^utils/',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'not-to-simulation',
|
|
139
|
+
comment: 'Don\'t allow dependencies from non-tests to simulation',
|
|
140
|
+
severity: 'error',
|
|
141
|
+
from: {
|
|
142
|
+
pathNot: '\\.test\\.(j|t)sx?$|testUtils\\.(j|t)sx?$|/testUtils/|/simulation/',
|
|
143
|
+
},
|
|
144
|
+
to: {
|
|
145
|
+
path: '^simulation/',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
module.exports = {
|
|
151
|
+
forbidden: [
|
|
152
|
+
...recommendedForbidden,
|
|
153
|
+
...customForbidden,
|
|
154
|
+
],
|
|
155
|
+
options: {
|
|
156
|
+
|
|
157
|
+
/* conditions specifying which files not to follow further when encountered:
|
|
158
|
+
- path: a regular expression to match
|
|
159
|
+
- dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/develop/doc/rules-reference.md#dependencytypes
|
|
160
|
+
for a complete list
|
|
161
|
+
*/
|
|
162
|
+
doNotFollow: {
|
|
163
|
+
// path: 'node_modules',
|
|
164
|
+
dependencyTypes: [
|
|
165
|
+
'npm',
|
|
166
|
+
'npm-dev',
|
|
167
|
+
'npm-optional',
|
|
168
|
+
'npm-peer',
|
|
169
|
+
'npm-bundled',
|
|
170
|
+
'npm-no-pkg',
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
/* pattern specifying which files to exclude (regular expression) */
|
|
175
|
+
exclude: '\\.min\\.(j|t)sx?$|webpack\\.config\\.(j|t)sx?$',
|
|
176
|
+
|
|
177
|
+
/* pattern specifying which files to include (regular expression)
|
|
178
|
+
dependency-cruiser will skip everything not matching this pattern
|
|
179
|
+
*/
|
|
180
|
+
// , includeOnly : ''
|
|
181
|
+
|
|
182
|
+
/* list of module systems to cruise */
|
|
183
|
+
// , moduleSystems: ['amd', 'cjs', 'es6', 'tsd']
|
|
184
|
+
|
|
185
|
+
/* prefix for links in html and svg output (e.g. https://github.com/you/yourrepo/blob/develop/) */
|
|
186
|
+
// , prefix: ''
|
|
187
|
+
|
|
188
|
+
/* if true detect dependencies that only exist before typescript-to-javascript compilation */
|
|
189
|
+
// , tsPreCompilationDeps: false
|
|
190
|
+
|
|
191
|
+
/* if true combines the package.jsons found from the module up to the base
|
|
192
|
+
folder the cruise is initiated from. Useful for how (some) mono-repos
|
|
193
|
+
manage dependencies & dependency definitions.
|
|
194
|
+
*/
|
|
195
|
+
// , combinedDependencies: false
|
|
196
|
+
|
|
197
|
+
/* if true leave symlinks untouched, otherwise use the realpath */
|
|
198
|
+
// , preserveSymlinks: false
|
|
199
|
+
|
|
200
|
+
/* Typescript project file ('tsconfig.json') to use for
|
|
201
|
+
(1) compilation and
|
|
202
|
+
(2) resolution (e.g. with the paths property)
|
|
203
|
+
|
|
204
|
+
The (optional) fileName attribute specifies which file to take (relative to
|
|
205
|
+
dependency-cruiser's current working directory). When not provided
|
|
206
|
+
defaults to './tsconfig.json'.
|
|
207
|
+
*/
|
|
208
|
+
// , tsConfig: {
|
|
209
|
+
// fileName: './tsconfig.json'
|
|
210
|
+
// }
|
|
211
|
+
|
|
212
|
+
/* Webpack configuration to use to get resolve options from.
|
|
213
|
+
|
|
214
|
+
The (optional) fileName attribute specifies which file to take (relative to dependency-cruiser's
|
|
215
|
+
current working directory. When not provided defaults to './webpack.conf.js'.
|
|
216
|
+
|
|
217
|
+
The (optional) `env` and `args` attributes contain the parameters to be passed if
|
|
218
|
+
your webpack config is a function and takes them (see webpack documentation
|
|
219
|
+
for details)
|
|
220
|
+
*/
|
|
221
|
+
// , webpackConfig: {
|
|
222
|
+
// fileName: './webpack.conf.js'
|
|
223
|
+
// , env: {}
|
|
224
|
+
// , args: {}
|
|
225
|
+
// }
|
|
226
|
+
|
|
227
|
+
/* How to resolve external modules - use "yarn-pnp" if you're using yarn's Plug'n'Play.
|
|
228
|
+
otherwise leave it out (or set to the default, which is 'node_modules')
|
|
229
|
+
*/
|
|
230
|
+
// , externalModuleResolutionStrategy: 'node_modules'
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
// generated: dependency-cruiser@4.21.0 on 2019-06-09T07:26:46.829Z
|
package/.editorconfig
ADDED
package/.eslintignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Describe the bug**
|
|
8
|
+
A clear and concise description of what the bug is.
|
|
9
|
+
|
|
10
|
+
**To Reproduce**
|
|
11
|
+
Steps to reproduce the behavior:
|
|
12
|
+
1. Go to '...'
|
|
13
|
+
2. Click on '....'
|
|
14
|
+
3. Scroll down to '....'
|
|
15
|
+
4. See error
|
|
16
|
+
|
|
17
|
+
**Expected behavior**
|
|
18
|
+
A clear and concise description of what you expected to happen.
|
|
19
|
+
|
|
20
|
+
**Screenshots**
|
|
21
|
+
If applicable, add screenshots to help explain your problem.
|
|
22
|
+
|
|
23
|
+
**Desktop (please complete the following information):**
|
|
24
|
+
- OS: [e.g. iOS]
|
|
25
|
+
- Browser [e.g. chrome, safari]
|
|
26
|
+
- Version [e.g. 22]
|
|
27
|
+
|
|
28
|
+
**Smartphone (please complete the following information):**
|
|
29
|
+
- Device: [e.g. iPhone6]
|
|
30
|
+
- OS: [e.g. iOS8.1]
|
|
31
|
+
- Browser [e.g. stock browser, safari]
|
|
32
|
+
- Version [e.g. 22]
|
|
33
|
+
|
|
34
|
+
**Additional context**
|
|
35
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Is your feature request related to a problem? Please describe.**
|
|
8
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
9
|
+
|
|
10
|
+
**Describe the solution you'd like**
|
|
11
|
+
A clear and concise description of what you want to happen.
|
|
12
|
+
|
|
13
|
+
**Describe alternatives you've considered**
|
|
14
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
15
|
+
|
|
16
|
+
**Additional context**
|
|
17
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
on:
|
|
2
|
+
push:
|
|
3
|
+
branches: main
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
publish:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
|
+
- uses: actions/setup-node@v3
|
|
11
|
+
with:
|
|
12
|
+
node-version: "20"
|
|
13
|
+
- run: npm ci
|
|
14
|
+
- run: npm test
|
|
15
|
+
- uses: JS-DevTools/npm-publish@v3
|
|
16
|
+
with:
|
|
17
|
+
token: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Simon Hatt / 2024 Marcel Würsten
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# sportident.js
|
|
2
|
+
JavaScript/TypeScript interface to SportIdent devices
|
|
3
|
+
|
|
4
|
+
There are [generated docs](https://allestuetsmerweh.github.io/sportident.js/).
|
|
5
|
+
|
|
6
|
+
## How to install
|
|
7
|
+
|
|
8
|
+
- [Install node.js](https://nodejs.org/en/download/)
|
|
9
|
+
- `git clone` this repository and `cd` to the root directory of it
|
|
10
|
+
- `npm install`
|
|
11
|
+
- `npm run lerna bootstrap`
|
|
12
|
+
|
|
13
|
+
## How to run testbench
|
|
14
|
+
- `npm run testbench-client`
|
|
15
|
+
- `npm run testbench-server`
|
|
16
|
+
|
|
17
|
+
## How to run...
|
|
18
|
+
- Tests: `npm run test`
|
|
19
|
+
- Linter: `npm run lint`
|
|
20
|
+
- Build: `npm run build` (this compiles TypeScript for the libraries and builds the webpack file for `sportident-testbench-client`)
|
|
21
|
+
|
|
22
|
+
## Development
|
|
23
|
+
We use `lerna` to manage multiple packages in the same repository:
|
|
24
|
+
- [sportident](./tree/main/packages/sportident/#readme)
|
|
25
|
+
- [sportident-node-usb](./tree/main/packages/sportident-node-usb/#readme)
|
|
26
|
+
- [sportident-react](./tree/main/packages/sportident-react/#readme)
|
|
27
|
+
- [sportident-testbench-client](./tree/main/packages/sportident-testbench-client/#readme)
|
|
28
|
+
- [sportident-testbench-node](./tree/main/packages/sportident-testbench-node/#readme)
|
|
29
|
+
- [sportident-testbench-server](./tree/main/packages/sportident-testbench-server/#readme)
|
|
30
|
+
- [sportident-testbench-shell](./tree/main/packages/sportident-testbench-shell/#readme)
|
|
31
|
+
- [sportident-webusb](./tree/main/packages/sportident-webusb/#readme)
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* global module */
|
|
2
|
+
/* exported module */
|
|
3
|
+
|
|
4
|
+
module.exports = (api) => {
|
|
5
|
+
api.cache(true);
|
|
6
|
+
|
|
7
|
+
const presets = [
|
|
8
|
+
['@babel/typescript'],
|
|
9
|
+
['@babel/preset-env', {useBuiltIns: 'usage', corejs: '2'}],
|
|
10
|
+
['@babel/preset-react'],
|
|
11
|
+
];
|
|
12
|
+
const plugins = [
|
|
13
|
+
'@babel/proposal-class-properties',
|
|
14
|
+
'@babel/proposal-object-rest-spread'
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
presets: presets,
|
|
19
|
+
plugins: plugins,
|
|
20
|
+
};
|
|
21
|
+
};
|
package/build-docs.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Assumes the following commands have been run:
|
|
2
|
+
# - npm run webpack-testbench
|
|
3
|
+
# - npm run jest
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
mkdir -p docs/.circleci
|
|
8
|
+
cp .circleci/config.yml docs/.circleci/
|
|
9
|
+
|
|
10
|
+
mkdir -p docs/testbench
|
|
11
|
+
cp packages/sportident-testbench-client/build/sportident-testbench-client.min.js docs/testbench/
|
|
12
|
+
cp packages/sportident-testbench-client/build/index.html docs/testbench/
|
|
13
|
+
|
|
14
|
+
mkdir -p docs/coverage
|
|
15
|
+
cp -R coverage/* docs/coverage/
|
|
16
|
+
|
|
17
|
+
mkdir -p docs/generated
|
|
18
|
+
npx depcruise --config=./.dependency-cruiser.js --max-depth=1 --output-type=dot packages/sportident/src | dot -T svg > docs/generated/dependencygraph-src.svg
|
|
19
|
+
npx depcruise --config=./.dependency-cruiser.js --max-depth=1 --output-type=dot packages/sportident/src/SiCard | dot -T svg > docs/generated/dependencygraph-src-sicard.svg
|
|
20
|
+
npx depcruise --config=./.dependency-cruiser.js --max-depth=1 --output-type=dot packages/sportident/src/SiDevice | dot -T svg > docs/generated/dependencygraph-src-sidevice.svg
|
|
21
|
+
npx depcruise --config=./.dependency-cruiser.js --max-depth=1 --output-type=dot packages/sportident/src/SiStation | dot -T svg > docs/generated/dependencygraph-src-sistation.svg
|
|
22
|
+
npx depcruise --config=./.dependency-cruiser.js --max-depth=1 --output-type=dot packages/sportident/src/utils | dot -T svg > docs/generated/dependencygraph-src-utils.svg
|
|
23
|
+
npx depcruise --config=./.dependency-cruiser.js --max-depth=1 --output-type=dot packages/sportident-testbench-client/src | dot -T svg > docs/generated/dependencygraph-testbench.svg
|
|
24
|
+
|
|
25
|
+
lerna run typedoc
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
There is an [online testbench](./testbench/).
|
|
2
|
+
|
|
3
|
+
There is a [test coverage report](./coverage/lcov-report/index.html).
|
|
4
|
+
|
|
5
|
+
These are the current `src` dependencies:
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
These are the current `testbench` dependencies:
|
|
9
|
+

|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Typedoc API docs
|
|
2
|
+
|
|
3
|
+
[`sportident`](./sportident/)
|
|
4
|
+
|
|
5
|
+
[`sportident-node-usb`](./sportident-node-usb/)
|
|
6
|
+
|
|
7
|
+
[`sportident-react`](./sportident-react/)
|
|
8
|
+
|
|
9
|
+
[`sportident-testbench-shell`](./sportident-testbench-shell/)
|
|
10
|
+
|
|
11
|
+
[`sportident-webusb`](./sportident-webusb/)
|
package/eslint.base.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
const javaScriptRules = {
|
|
2
|
+
'indent': ['warn', 4, { 'SwitchCase': 1 }],
|
|
3
|
+
'semi': ['error', 'always'],
|
|
4
|
+
'no-console': [0],
|
|
5
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
6
|
+
'array-bracket-newline': ['error', 'consistent'],
|
|
7
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
8
|
+
'arrow-parens': ['error', 'always'],
|
|
9
|
+
'arrow-spacing': 'error',
|
|
10
|
+
'block-scoped-var': 'error',
|
|
11
|
+
'block-spacing': 'error',
|
|
12
|
+
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
|
13
|
+
'comma-dangle': ['error', { 'arrays': 'always-multiline', 'objects': 'always-multiline', 'imports': 'always-multiline', 'exports': 'always-multiline', 'functions': 'always-multiline' }],
|
|
14
|
+
'comma-spacing': ['error', { 'before': false, 'after': true }],
|
|
15
|
+
'comma-style': ['error', 'last'],
|
|
16
|
+
'computed-property-spacing': ['error', 'never'],
|
|
17
|
+
'consistent-return': 'error',
|
|
18
|
+
'curly': ['error', 'all'],
|
|
19
|
+
'default-case': 'error',
|
|
20
|
+
'dot-location': ['error', 'property'],
|
|
21
|
+
'dot-notation': 'error',
|
|
22
|
+
'eol-last': ['error', 'always'],
|
|
23
|
+
'eqeqeq': ['error', 'always'],
|
|
24
|
+
'for-direction': 'warn',
|
|
25
|
+
'func-call-spacing': ['error', 'never'],
|
|
26
|
+
'func-name-matching': 'warn',
|
|
27
|
+
'func-names': ['error', 'always'],
|
|
28
|
+
'func-style': ['error', 'declaration', { 'allowArrowFunctions': true }],
|
|
29
|
+
'function-paren-newline': ['error', 'consistent'],
|
|
30
|
+
'generator-star-spacing': ['error', { 'before': false, 'after': true }],
|
|
31
|
+
'getter-return': 'error',
|
|
32
|
+
'guard-for-in': 'warn',
|
|
33
|
+
'key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
|
|
34
|
+
'keyword-spacing': 'error',
|
|
35
|
+
'linebreak-style': ['error', 'unix'],
|
|
36
|
+
'lines-around-directive': 'error',
|
|
37
|
+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
|
38
|
+
'no-alert': 'error',
|
|
39
|
+
'no-array-constructor': 'error',
|
|
40
|
+
'no-await-in-loop': 'error',
|
|
41
|
+
'no-buffer-constructor': 'error',
|
|
42
|
+
'no-caller': 'error',
|
|
43
|
+
'no-confusing-arrow': ['error', { 'allowParens': true }],
|
|
44
|
+
'no-continue': 'error',
|
|
45
|
+
'no-duplicate-imports': 'error',
|
|
46
|
+
'no-else-return': 'error',
|
|
47
|
+
'no-empty-function': 'off',
|
|
48
|
+
'no-eval': 'error',
|
|
49
|
+
'no-extend-native': 'error',
|
|
50
|
+
'no-floating-decimal': 'error',
|
|
51
|
+
'no-implied-eval': 'error',
|
|
52
|
+
'no-invalid-this': 'error',
|
|
53
|
+
'no-labels': 'error',
|
|
54
|
+
'no-lone-blocks': 'error',
|
|
55
|
+
'no-lonely-if': 'error',
|
|
56
|
+
'no-multi-assign': 'error',
|
|
57
|
+
'no-multi-spaces': 'error',
|
|
58
|
+
'no-multiple-empty-lines': 'error',
|
|
59
|
+
'no-native-reassign': 'error',
|
|
60
|
+
'no-negated-in-lhs': 'error',
|
|
61
|
+
'no-new-func': 'error',
|
|
62
|
+
'no-new-require': 'error',
|
|
63
|
+
'no-octal-escape': 'error',
|
|
64
|
+
'no-param-reassign': 'error',
|
|
65
|
+
'no-proto': 'error',
|
|
66
|
+
'no-return-assign': 'error',
|
|
67
|
+
'no-return-await': 'error',
|
|
68
|
+
'no-script-url': 'error',
|
|
69
|
+
'no-self-compare': 'error',
|
|
70
|
+
'no-sequences': 'error',
|
|
71
|
+
'no-shadow-restricted-names': 'error',
|
|
72
|
+
'no-spaced-func': 'error',
|
|
73
|
+
'no-tabs': 'error',
|
|
74
|
+
'no-template-curly-in-string': 'error',
|
|
75
|
+
'no-throw-literal': 'error',
|
|
76
|
+
'no-trailing-spaces': 'error',
|
|
77
|
+
'no-unneeded-ternary': 'error',
|
|
78
|
+
'no-unused-expressions': 'error',
|
|
79
|
+
'no-unused-vars': ['error', {'args': 'none'}],
|
|
80
|
+
'no-use-before-define': 'off',
|
|
81
|
+
'no-useless-concat': 'error',
|
|
82
|
+
'no-useless-constructor': 'error',
|
|
83
|
+
'no-useless-rename': 'error',
|
|
84
|
+
'no-useless-return': 'error',
|
|
85
|
+
'no-var': 'error',
|
|
86
|
+
'no-warning-comments': 'warn',
|
|
87
|
+
'no-whitespace-before-property': 'error',
|
|
88
|
+
'no-with': 'error',
|
|
89
|
+
'object-curly-newline': ['error', { 'consistent': true }],
|
|
90
|
+
'prefer-const': 'error',
|
|
91
|
+
'prefer-numeric-literals': 'error',
|
|
92
|
+
'prefer-promise-reject-errors': 'error',
|
|
93
|
+
'prefer-rest-params': 'error',
|
|
94
|
+
'prefer-template': 'error',
|
|
95
|
+
'quotes': ['error', 'single'],
|
|
96
|
+
'radix': 'error',
|
|
97
|
+
'rest-spread-spacing': 'error',
|
|
98
|
+
'semi-spacing': 'error',
|
|
99
|
+
'space-before-blocks': 'error',
|
|
100
|
+
'space-infix-ops': 'error',
|
|
101
|
+
'space-unary-ops': ['error', { 'words': true, 'nonwords': false }],
|
|
102
|
+
'spaced-comment': ['error', 'always', { 'block': { 'balanced': true } }],
|
|
103
|
+
'symbol-description': 'error',
|
|
104
|
+
'template-curly-spacing': 'error',
|
|
105
|
+
'wrap-iife': 'error',
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const typeScriptRules = {
|
|
109
|
+
...javaScriptRules,
|
|
110
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
111
|
+
'@typescript-eslint/ban-ts-ignore': 'off',
|
|
112
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
113
|
+
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
114
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
115
|
+
'@typescript-eslint/member-delimiter-style': 'off',
|
|
116
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
117
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
118
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
119
|
+
'@typescript-eslint/no-unused-vars': ['error', {
|
|
120
|
+
'vars': 'all',
|
|
121
|
+
'args': 'all',
|
|
122
|
+
'ignoreRestSiblings': true,
|
|
123
|
+
'argsIgnorePattern': '^_',
|
|
124
|
+
'varsIgnorePattern': '^_',
|
|
125
|
+
}],
|
|
126
|
+
'@typescript-eslint/no-shadow': ['error'],
|
|
127
|
+
'@typescript-eslint/no-use-before-define': ['error', {'classes': false, 'functions': false}],
|
|
128
|
+
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
129
|
+
'no-shadow': 'off',
|
|
130
|
+
'no-unused-vars': 'off',
|
|
131
|
+
'no-useless-constructor': 'off',
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
module.exports = {
|
|
135
|
+
frontendConfig: {
|
|
136
|
+
env: {
|
|
137
|
+
browser: true,
|
|
138
|
+
es6: true,
|
|
139
|
+
},
|
|
140
|
+
extends: [
|
|
141
|
+
'eslint:recommended',
|
|
142
|
+
'plugin:react/recommended',
|
|
143
|
+
],
|
|
144
|
+
parserOptions: {
|
|
145
|
+
ecmaVersion: 2018,
|
|
146
|
+
ecmaFeatures: {
|
|
147
|
+
jsx: true,
|
|
148
|
+
},
|
|
149
|
+
sourceType: 'module',
|
|
150
|
+
},
|
|
151
|
+
plugins: [
|
|
152
|
+
'react',
|
|
153
|
+
],
|
|
154
|
+
settings: {
|
|
155
|
+
react: {
|
|
156
|
+
createClass: 'createReactClass',
|
|
157
|
+
pragma: 'React',
|
|
158
|
+
version: 'detect',
|
|
159
|
+
flowVersion: '0.53',
|
|
160
|
+
},
|
|
161
|
+
propWrapperFunctions: [
|
|
162
|
+
'forbidExtraProps',
|
|
163
|
+
{ property: 'freeze', object: 'Object' },
|
|
164
|
+
{ property: 'myFavoriteWrapper' },
|
|
165
|
+
],
|
|
166
|
+
linkComponents: [
|
|
167
|
+
'Hyperlink',
|
|
168
|
+
{ name: 'Link', linkAttribute: 'to' },
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
rules: javaScriptRules,
|
|
172
|
+
overrides: [
|
|
173
|
+
{
|
|
174
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
175
|
+
env: {
|
|
176
|
+
browser: true,
|
|
177
|
+
es6: true,
|
|
178
|
+
},
|
|
179
|
+
extends: [
|
|
180
|
+
'eslint:recommended',
|
|
181
|
+
'plugin:react/recommended',
|
|
182
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
183
|
+
'plugin:@typescript-eslint/recommended',
|
|
184
|
+
],
|
|
185
|
+
globals: { 'Atomics': 'readonly', 'SharedArrayBuffer': 'readonly' },
|
|
186
|
+
parser: '@typescript-eslint/parser',
|
|
187
|
+
parserOptions: {
|
|
188
|
+
'ecmaVersion': 2018,
|
|
189
|
+
'sourceType': 'module',
|
|
190
|
+
},
|
|
191
|
+
plugins: ['@typescript-eslint'],
|
|
192
|
+
rules: typeScriptRules,
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
nodeConfig: {
|
|
197
|
+
env: {
|
|
198
|
+
node: true,
|
|
199
|
+
es6: true,
|
|
200
|
+
},
|
|
201
|
+
extends: [
|
|
202
|
+
'eslint:recommended',
|
|
203
|
+
],
|
|
204
|
+
parserOptions: {
|
|
205
|
+
ecmaVersion: 2018,
|
|
206
|
+
sourceType: 'module',
|
|
207
|
+
},
|
|
208
|
+
rules: javaScriptRules,
|
|
209
|
+
overrides: [
|
|
210
|
+
{
|
|
211
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
212
|
+
env: {
|
|
213
|
+
browser: true,
|
|
214
|
+
es6: true,
|
|
215
|
+
},
|
|
216
|
+
extends: [
|
|
217
|
+
'eslint:recommended',
|
|
218
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
219
|
+
'plugin:@typescript-eslint/recommended',
|
|
220
|
+
],
|
|
221
|
+
globals: { 'Atomics': 'readonly', 'SharedArrayBuffer': 'readonly' },
|
|
222
|
+
parser: '@typescript-eslint/parser',
|
|
223
|
+
parserOptions: {
|
|
224
|
+
'ecmaVersion': 2018,
|
|
225
|
+
'sourceType': 'module',
|
|
226
|
+
},
|
|
227
|
+
plugins: ['@typescript-eslint'],
|
|
228
|
+
rules: typeScriptRules,
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
};
|