@nordicsemiconductor/pc-nrfconnect-shared 90.0.0 → 91.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/Changelog.md +26 -0
- package/config/jest.config.js +0 -1
- package/coverage/cobertura-coverage.xml +6 -81
- package/ipc/MetaFiles.ts +15 -7
- package/package.json +1 -4
- package/scripts/check-app-properties.ts +49 -22
- package/scripts/esbuild-renderer.js +0 -1
- package/scripts/nordic-publish.js +6 -6
- package/src/index.ts +0 -1
- package/src/utils/packageJson.ts +11 -1
- package/typings/generated/ipc/MetaFiles.d.ts +13 -7
- package/typings/generated/ipc/MetaFiles.d.ts.map +1 -1
- package/typings/generated/src/index.d.ts +0 -1
- package/typings/generated/src/index.d.ts.map +1 -1
- package/typings/generated/src/utils/packageJson.d.ts.map +1 -1
- package/mocks/deviceLibMock.ts +0 -21
- package/src/Device/deviceLibWrapper.test.ts +0 -97
- package/src/Device/deviceLibWrapper.ts +0 -66
- package/typings/generated/src/Device/deviceLibWrapper.d.ts +0 -6
- package/typings/generated/src/Device/deviceLibWrapper.d.ts.map +0 -1
- package/typings/generated/src/Device/deviceLibWrapper.test.d.ts +0 -2
- package/typings/generated/src/Device/deviceLibWrapper.test.d.ts.map +0 -1
package/Changelog.md
CHANGED
|
@@ -7,6 +7,32 @@ This project does _not_ adhere to
|
|
|
7
7
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
|
|
8
8
|
every new version is a new major version.
|
|
9
9
|
|
|
10
|
+
## 91 - 2023-08-23
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Assert that the properties of objects in `nrfConnectForDesktop.nrfutil` in
|
|
15
|
+
`package.json` are really arrays with at least one entry. So e.g. all of
|
|
16
|
+
these entries would be rejected:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"nrfConnectForDesktop": {
|
|
21
|
+
"nrfutil": {
|
|
22
|
+
"device": [], // Wrong: Empty array
|
|
23
|
+
"legacy": null, // Wrong: null
|
|
24
|
+
"toolchain-manager": "1.0.0" // Wrong: Not an array
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
- Exported, obsolete function `getDeviceLibContext()`.
|
|
33
|
+
- Peer dependency and any remaining support for
|
|
34
|
+
`@nordicsemiconductor/nrf-device-lib-js`.
|
|
35
|
+
|
|
10
36
|
## 90 - 2023-08-21
|
|
11
37
|
|
|
12
38
|
### Changed
|
package/config/jest.config.js
CHANGED
|
@@ -16,7 +16,6 @@ module.exports = (disabledMocks = []) => ({
|
|
|
16
16
|
'pc-nrfjprog-js|nrf-device-setup|usb': `${mockDir}/emptyMock.ts`,
|
|
17
17
|
'^electron$': `${mockDir}/electronMock.ts`,
|
|
18
18
|
'^electron-store$': `${mockDir}/electronStoreMock.ts`,
|
|
19
|
-
'@nordicsemiconductor/nrf-device-lib-js': `${mockDir}/deviceLibMock.ts`,
|
|
20
19
|
'@electron/remote': `${mockDir}/remoteMock.ts`,
|
|
21
20
|
...(disabledMocks.includes('packageJson')
|
|
22
21
|
? {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" ?>
|
|
2
2
|
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
|
3
|
-
<coverage lines-valid="
|
|
3
|
+
<coverage lines-valid="2964" lines-covered="1644" line-rate="0.5546" branches-valid="1446" branches-covered="381" branch-rate="0.2634" timestamp="1692780987528" complexity="0" version="0.1">
|
|
4
4
|
<sources>
|
|
5
5
|
<source>/home/vsts/work/1/s</source>
|
|
6
6
|
</sources>
|
|
@@ -299,21 +299,8 @@
|
|
|
299
299
|
</class>
|
|
300
300
|
</classes>
|
|
301
301
|
</package>
|
|
302
|
-
<package name="mocks" line-rate="0.
|
|
302
|
+
<package name="mocks" line-rate="0.875" branch-rate="1">
|
|
303
303
|
<classes>
|
|
304
|
-
<class name="deviceLibMock.ts" filename="mocks/deviceLibMock.ts" line-rate="1" branch-rate="1">
|
|
305
|
-
<methods>
|
|
306
|
-
</methods>
|
|
307
|
-
<lines>
|
|
308
|
-
<line number="7" hits="1" branch="false"/>
|
|
309
|
-
<line number="8" hits="1" branch="false"/>
|
|
310
|
-
<line number="9" hits="1" branch="false"/>
|
|
311
|
-
<line number="10" hits="1" branch="false"/>
|
|
312
|
-
<line number="11" hits="1" branch="false"/>
|
|
313
|
-
<line number="12" hits="1" branch="false"/>
|
|
314
|
-
<line number="14" hits="1" branch="false"/>
|
|
315
|
-
</lines>
|
|
316
|
-
</class>
|
|
317
304
|
<class name="electronMock.ts" filename="mocks/electronMock.ts" line-rate="1" branch-rate="1">
|
|
318
305
|
<methods>
|
|
319
306
|
</methods>
|
|
@@ -389,10 +376,10 @@
|
|
|
389
376
|
</method>
|
|
390
377
|
</methods>
|
|
391
378
|
<lines>
|
|
392
|
-
<line number="9" hits="
|
|
393
|
-
<line number="10" hits="
|
|
379
|
+
<line number="9" hits="12" branch="false"/>
|
|
380
|
+
<line number="10" hits="12" branch="false"/>
|
|
394
381
|
<line number="13" hits="0" branch="false"/>
|
|
395
|
-
<line number="15" hits="
|
|
382
|
+
<line number="15" hits="12" branch="false"/>
|
|
396
383
|
<line number="16" hits="0" branch="false"/>
|
|
397
384
|
</lines>
|
|
398
385
|
</class>
|
|
@@ -2542,7 +2529,7 @@
|
|
|
2542
2529
|
</class>
|
|
2543
2530
|
</classes>
|
|
2544
2531
|
</package>
|
|
2545
|
-
<package name="src.Device" line-rate="0.
|
|
2532
|
+
<package name="src.Device" line-rate="0.3734" branch-rate="0.16949999999999998">
|
|
2546
2533
|
<classes>
|
|
2547
2534
|
<class name="deviceAutoSelectSlice.ts" filename="src/Device/deviceAutoSelectSlice.ts" line-rate="0.62" branch-rate="0.44439999999999996">
|
|
2548
2535
|
<methods>
|
|
@@ -2685,68 +2672,6 @@
|
|
|
2685
2672
|
<line number="150" hits="0" branch="false"/>
|
|
2686
2673
|
</lines>
|
|
2687
2674
|
</class>
|
|
2688
|
-
<class name="deviceLibWrapper.ts" filename="src/Device/deviceLibWrapper.ts" line-rate="0.6666" branch-rate="0.6842">
|
|
2689
|
-
<methods>
|
|
2690
|
-
<method name="(anonymous_4)" hits="0" signature="()V">
|
|
2691
|
-
<lines>
|
|
2692
|
-
<line number="16" hits="0"/>
|
|
2693
|
-
</lines>
|
|
2694
|
-
</method>
|
|
2695
|
-
<method name="(anonymous_5)" hits="0" signature="()V">
|
|
2696
|
-
<lines>
|
|
2697
|
-
<line number="22" hits="0"/>
|
|
2698
|
-
</lines>
|
|
2699
|
-
</method>
|
|
2700
|
-
<method name="(anonymous_6)" hits="5" signature="()V">
|
|
2701
|
-
<lines>
|
|
2702
|
-
<line number="47" hits="5"/>
|
|
2703
|
-
</lines>
|
|
2704
|
-
</method>
|
|
2705
|
-
<method name="(anonymous_7)" hits="7" signature="()V">
|
|
2706
|
-
<lines>
|
|
2707
|
-
<line number="48" hits="7"/>
|
|
2708
|
-
</lines>
|
|
2709
|
-
</method>
|
|
2710
|
-
<method name="(anonymous_8)" hits="3" signature="()V">
|
|
2711
|
-
<lines>
|
|
2712
|
-
<line number="50" hits="3"/>
|
|
2713
|
-
</lines>
|
|
2714
|
-
</method>
|
|
2715
|
-
<method name="(anonymous_9)" hits="4" signature="()V">
|
|
2716
|
-
<lines>
|
|
2717
|
-
<line number="54" hits="4"/>
|
|
2718
|
-
</lines>
|
|
2719
|
-
</method>
|
|
2720
|
-
<method name="(anonymous_10)" hits="5" signature="()V">
|
|
2721
|
-
<lines>
|
|
2722
|
-
<line number="62" hits="5"/>
|
|
2723
|
-
</lines>
|
|
2724
|
-
</method>
|
|
2725
|
-
</methods>
|
|
2726
|
-
<lines>
|
|
2727
|
-
<line number="7" hits="1" branch="false"/>
|
|
2728
|
-
<line number="12" hits="1" branch="false"/>
|
|
2729
|
-
<line number="13" hits="1" branch="false"/>
|
|
2730
|
-
<line number="15" hits="1" branch="false"/>
|
|
2731
|
-
<line number="16" hits="1" branch="false"/>
|
|
2732
|
-
<line number="17" hits="0" branch="true" condition-coverage="0% (0/1)"/>
|
|
2733
|
-
<line number="19" hits="0" branch="false"/>
|
|
2734
|
-
<line number="22" hits="1" branch="false"/>
|
|
2735
|
-
<line number="23" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
2736
|
-
<line number="24" hits="0" branch="true" condition-coverage="0% (0/2)"/>
|
|
2737
|
-
<line number="27" hits="0" branch="false"/>
|
|
2738
|
-
<line number="37" hits="0" branch="false"/>
|
|
2739
|
-
<line number="40" hits="0" branch="false"/>
|
|
2740
|
-
<line number="47" hits="1" branch="false"/>
|
|
2741
|
-
<line number="48" hits="7" branch="false"/>
|
|
2742
|
-
<line number="50" hits="1" branch="false"/>
|
|
2743
|
-
<line number="51" hits="3" branch="true" condition-coverage="100% (1/1)"/>
|
|
2744
|
-
<line number="52" hits="3" branch="false"/>
|
|
2745
|
-
<line number="54" hits="4" branch="false"/>
|
|
2746
|
-
<line number="62" hits="2" branch="false"/>
|
|
2747
|
-
<line number="66" hits="5" branch="true" condition-coverage="100% (4/4)"/>
|
|
2748
|
-
</lines>
|
|
2749
|
-
</class>
|
|
2750
2675
|
<class name="deviceLister.ts" filename="src/Device/deviceLister.ts" line-rate="0.3333" branch-rate="0.0925">
|
|
2751
2676
|
<methods>
|
|
2752
2677
|
<method name="(anonymous_8)" hits="0" signature="()V">
|
package/ipc/MetaFiles.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type AppVersions = {
|
|
|
20
20
|
export type AppVersion = {
|
|
21
21
|
shasum?: string;
|
|
22
22
|
tarballUrl: UrlString;
|
|
23
|
-
nrfutilModules?:
|
|
23
|
+
nrfutilModules?: NrfutilModules;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export interface AppInfo {
|
|
@@ -42,18 +42,26 @@ interface ObjectContainingOptionalStrings {
|
|
|
42
42
|
[index: string]: string | undefined;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
interface
|
|
46
|
-
nrfutil?:
|
|
45
|
+
interface NrfConnectForDesktop {
|
|
46
|
+
nrfutil?: NrfutilModules;
|
|
47
47
|
html?: string;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
type SemverString = string;
|
|
51
|
+
|
|
52
|
+
export type NrfutilModuleName = string;
|
|
53
|
+
export type NrfutilModuleVersion = SemverString;
|
|
54
|
+
|
|
55
|
+
export interface NrfutilModules {
|
|
56
|
+
[name: NrfutilModuleName]: [
|
|
57
|
+
NrfutilModuleVersion,
|
|
58
|
+
...NrfutilModuleVersion[]
|
|
59
|
+
];
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
export interface PackageJson {
|
|
55
63
|
name: string;
|
|
56
|
-
version:
|
|
64
|
+
version: SemverString;
|
|
57
65
|
|
|
58
66
|
// Several optional properties
|
|
59
67
|
author?: string;
|
|
@@ -64,7 +72,7 @@ export interface PackageJson {
|
|
|
64
72
|
devDependencies?: ObjectContainingOptionalStrings;
|
|
65
73
|
displayName?: string;
|
|
66
74
|
engines?: ObjectContainingOptionalStrings;
|
|
67
|
-
nrfConnectForDesktop?:
|
|
75
|
+
nrfConnectForDesktop?: NrfConnectForDesktop;
|
|
68
76
|
files?: readonly string[];
|
|
69
77
|
license?: string;
|
|
70
78
|
main?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordicsemiconductor/pc-nrfconnect-shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "91.0.0",
|
|
4
4
|
"description": "Shared commodities for developing pc-nrfconnect-* packages",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,9 +28,6 @@
|
|
|
28
28
|
"clean": "rimraf dist typings/generated dist scripts/nordic-publish.js",
|
|
29
29
|
"postinstall": "ts-node scripts/postinstall.ts"
|
|
30
30
|
},
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"@nordicsemiconductor/nrf-device-lib-js": ">=0.7.1"
|
|
33
|
-
},
|
|
34
31
|
"dependencies": {
|
|
35
32
|
"@electron/remote": "^2.0.4",
|
|
36
33
|
"@mdi/font": "7.2.96",
|
|
@@ -80,6 +80,51 @@ const checkMandatoryProperties = (packageJson: PackageJson) => {
|
|
|
80
80
|
);
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
const checkNrfutilProperties = (packageJson: PackageJson) => {
|
|
84
|
+
const nrfutilModules = packageJson.nrfConnectForDesktop?.nrfutil;
|
|
85
|
+
if (nrfutilModules != null) {
|
|
86
|
+
Object.entries(nrfutilModules).forEach(
|
|
87
|
+
([moduleName, moduleVersions]) => {
|
|
88
|
+
if (
|
|
89
|
+
!Array.isArray(moduleVersions) ||
|
|
90
|
+
moduleVersions.length === 0
|
|
91
|
+
) {
|
|
92
|
+
fail(
|
|
93
|
+
`For each module in \`nrfConnectForDesktop.nrfutil\` in package.json at least one version must be specified, but for \`${moduleName}\` none was specified.`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const checkRepoUrl = (packageJson: PackageJson) => {
|
|
102
|
+
if (!existsSync('./.git')) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const realGitUrl = execSync('git remote get-url origin', {
|
|
107
|
+
encoding: 'utf-8',
|
|
108
|
+
}).trimEnd();
|
|
109
|
+
const declaredGitUrl = packageJson.repository?.url;
|
|
110
|
+
|
|
111
|
+
const withoutPostfix = (gitUrl?: string) => gitUrl?.replace(/\.git$/, '');
|
|
112
|
+
|
|
113
|
+
const withoutProtocol = (gitUrl?: string) =>
|
|
114
|
+
gitUrl
|
|
115
|
+
?.replace(/^git@github\.com:/, 'github.com/')
|
|
116
|
+
.replace(/^https:\/\//, '');
|
|
117
|
+
|
|
118
|
+
const stripped = (gitUrl?: string) =>
|
|
119
|
+
withoutProtocol(withoutPostfix(gitUrl));
|
|
120
|
+
|
|
121
|
+
if (stripped(realGitUrl) !== stripped(declaredGitUrl)) {
|
|
122
|
+
fail(
|
|
123
|
+
`package.json says the repository is located at \`${declaredGitUrl}\` but \`git remote get-url origin\` says it is at \`${realGitUrl}\`.`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
83
128
|
const checkOptionalProperties = (packageJson: PackageJson) => {
|
|
84
129
|
if (propertyIsMissing(packageJson)('homepage')) {
|
|
85
130
|
warn('Please provide a property `homepage` in package.json.');
|
|
@@ -89,32 +134,14 @@ const checkOptionalProperties = (packageJson: PackageJson) => {
|
|
|
89
134
|
warn(
|
|
90
135
|
'Please provide a property `nrfConnectForDesktop.html` in package.json'
|
|
91
136
|
);
|
|
137
|
+
} else {
|
|
138
|
+
checkNrfutilProperties(packageJson);
|
|
92
139
|
}
|
|
93
140
|
|
|
94
141
|
if (propertyIsMissing(packageJson)('repository.url')) {
|
|
95
142
|
warn('Please provide a property `repository.url` in package.json.');
|
|
96
|
-
} else
|
|
97
|
-
|
|
98
|
-
encoding: 'utf-8',
|
|
99
|
-
}).trimEnd();
|
|
100
|
-
const declaredGitUrl = packageJson.repository?.url;
|
|
101
|
-
|
|
102
|
-
const withoutPostfix = (gitUrl?: string) =>
|
|
103
|
-
gitUrl?.replace(/\.git$/, '');
|
|
104
|
-
|
|
105
|
-
const withoutProtocol = (gitUrl?: string) =>
|
|
106
|
-
gitUrl
|
|
107
|
-
?.replace(/^git@github\.com:/, 'github.com/')
|
|
108
|
-
.replace(/^https:\/\//, '');
|
|
109
|
-
|
|
110
|
-
const stripped = (gitUrl?: string) =>
|
|
111
|
-
withoutProtocol(withoutPostfix(gitUrl));
|
|
112
|
-
|
|
113
|
-
if (stripped(realGitUrl) !== stripped(declaredGitUrl)) {
|
|
114
|
-
fail(
|
|
115
|
-
`package.json says the repository is located at \`${declaredGitUrl}\` but \`git remote get-url origin\` says it is at \`${realGitUrl}\`.`
|
|
116
|
-
);
|
|
117
|
-
}
|
|
143
|
+
} else {
|
|
144
|
+
checkRepoUrl(packageJson);
|
|
118
145
|
}
|
|
119
146
|
};
|
|
120
147
|
|