@nordicsemiconductor/pc-nrfconnect-shared 90.0.0 → 92.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 CHANGED
@@ -7,6 +7,38 @@ 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
+ ## 92 - 2023-08-24
11
+
12
+ ### Added
13
+
14
+ - Add functionality to send metrics and traces to telemetry.
15
+
16
+ ## 91 - 2023-08-23
17
+
18
+ ### Changed
19
+
20
+ - Assert that the properties of objects in `nrfConnectForDesktop.nrfutil` in
21
+ `package.json` are really arrays with at least one entry. So e.g. all of
22
+ these entries would be rejected:
23
+
24
+ ```json
25
+ {
26
+ "nrfConnectForDesktop": {
27
+ "nrfutil": {
28
+ "device": [], // Wrong: Empty array
29
+ "legacy": null, // Wrong: null
30
+ "toolchain-manager": "1.0.0" // Wrong: Not an array
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ ### Removed
37
+
38
+ - Exported, obsolete function `getDeviceLibContext()`.
39
+ - Peer dependency and any remaining support for
40
+ `@nordicsemiconductor/nrf-device-lib-js`.
41
+
10
42
  ## 90 - 2023-08-21
11
43
 
12
44
  ### 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="2992" lines-covered="1665" line-rate="0.5564" branches-valid="1465" branches-covered="394" branch-rate="0.26890000000000003" timestamp="1692610533087" complexity="0" version="0.1">
3
+ <coverage lines-valid="2967" lines-covered="1646" line-rate="0.5547" branches-valid="1454" branches-covered="381" branch-rate="0.262" timestamp="1692883342455" 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.9129999999999999" branch-rate="1">
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="13" branch="false"/>
393
- <line number="10" hits="13" branch="false"/>
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="13" branch="false"/>
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.3824" branch-rate="0.1961">
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">
@@ -7015,7 +6940,7 @@
7015
6940
  </class>
7016
6941
  </classes>
7017
6942
  </package>
7018
- <package name="src.utils" line-rate="0.6564" branch-rate="0.1764">
6943
+ <package name="src.utils" line-rate="0.6566" branch-rate="0.1653">
7019
6944
  <classes>
7020
6945
  <class name="appDirs.ts" filename="src/utils/appDirs.ts" line-rate="0.6666" branch-rate="0">
7021
6946
  <methods>
@@ -7358,66 +7283,76 @@
7358
7283
  <line number="20" hits="5" branch="false"/>
7359
7284
  </lines>
7360
7285
  </class>
7361
- <class name="usageData.ts" filename="src/utils/usageData.ts" line-rate="0.4" branch-rate="0.0909">
7286
+ <class name="usageData.ts" filename="src/utils/usageData.ts" line-rate="0.41369999999999996" branch-rate="0.0793">
7362
7287
  <methods>
7363
- <method name="(anonymous_11)" hits="3" signature="()V">
7288
+ <method name="(anonymous_13)" hits="3" signature="()V">
7364
7289
  <lines>
7365
7290
  <line number="36" hits="3"/>
7366
7291
  </lines>
7367
7292
  </method>
7368
- <method name="(anonymous_12)" hits="0" signature="()V">
7293
+ <method name="(anonymous_14)" hits="0" signature="()V">
7369
7294
  <lines>
7370
7295
  <line number="57" hits="0"/>
7371
7296
  </lines>
7372
7297
  </method>
7373
- <method name="(anonymous_13)" hits="0" signature="()V">
7298
+ <method name="(anonymous_15)" hits="0" signature="()V">
7374
7299
  <lines>
7375
7300
  <line number="75" hits="0"/>
7376
7301
  </lines>
7377
7302
  </method>
7378
- <method name="(anonymous_14)" hits="3" signature="()V">
7303
+ <method name="(anonymous_16)" hits="3" signature="()V">
7379
7304
  <lines>
7380
7305
  <line number="87" hits="3"/>
7381
7306
  </lines>
7382
7307
  </method>
7383
- <method name="(anonymous_15)" hits="0" signature="()V">
7308
+ <method name="(anonymous_17)" hits="0" signature="()V">
7384
7309
  <lines>
7385
7310
  <line number="101" hits="0"/>
7386
7311
  </lines>
7387
7312
  </method>
7388
- <method name="(anonymous_16)" hits="0" signature="()V">
7313
+ <method name="(anonymous_18)" hits="0" signature="()V">
7389
7314
  <lines>
7390
7315
  <line number="112" hits="0"/>
7391
7316
  </lines>
7392
7317
  </method>
7393
- <method name="(anonymous_17)" hits="0" signature="()V">
7318
+ <method name="(anonymous_19)" hits="0" signature="()V">
7394
7319
  <lines>
7395
7320
  <line number="122" hits="0"/>
7396
7321
  </lines>
7397
7322
  </method>
7398
- <method name="(anonymous_18)" hits="0" signature="()V">
7323
+ <method name="(anonymous_20)" hits="0" signature="()V">
7399
7324
  <lines>
7400
7325
  <line number="133" hits="0"/>
7401
7326
  </lines>
7402
7327
  </method>
7403
- <method name="(anonymous_19)" hits="0" signature="()V">
7328
+ <method name="(anonymous_21)" hits="0" signature="()V">
7404
7329
  <lines>
7405
7330
  <line number="144" hits="0"/>
7406
7331
  </lines>
7407
7332
  </method>
7408
- <method name="(anonymous_20)" hits="0" signature="()V">
7333
+ <method name="(anonymous_22)" hits="0" signature="()V">
7409
7334
  <lines>
7410
7335
  <line number="162" hits="0"/>
7411
7336
  </lines>
7412
7337
  </method>
7413
- <method name="(anonymous_21)" hits="0" signature="()V">
7338
+ <method name="(anonymous_23)" hits="0" signature="()V">
7414
7339
  <lines>
7415
- <line number="176" hits="0"/>
7340
+ <line number="171" hits="0"/>
7416
7341
  </lines>
7417
7342
  </method>
7418
- <method name="(anonymous_22)" hits="1" signature="()V">
7343
+ <method name="(anonymous_24)" hits="0" signature="()V">
7419
7344
  <lines>
7420
- <line number="188" hits="1"/>
7345
+ <line number="178" hits="0"/>
7346
+ </lines>
7347
+ </method>
7348
+ <method name="(anonymous_25)" hits="0" signature="()V">
7349
+ <lines>
7350
+ <line number="189" hits="0"/>
7351
+ </lines>
7352
+ </method>
7353
+ <method name="(anonymous_26)" hits="1" signature="()V">
7354
+ <lines>
7355
+ <line number="197" hits="1"/>
7421
7356
  </lines>
7422
7357
  </method>
7423
7358
  </methods>
@@ -7470,13 +7405,16 @@
7470
7405
  <line number="165" hits="0" branch="false"/>
7471
7406
  <line number="167" hits="0" branch="false"/>
7472
7407
  <line number="168" hits="0" branch="false"/>
7473
- <line number="176" hits="4" branch="false"/>
7474
- <line number="177" hits="0" branch="true" condition-coverage="0% (0/4)"/>
7475
- <line number="178" hits="0" branch="true" condition-coverage="0% (0/4)"/>
7476
- <line number="181" hits="0" branch="false"/>
7477
- <line number="188" hits="4" branch="false"/>
7478
- <line number="189" hits="1" branch="false"/>
7479
- <line number="192" hits="4" branch="false"/>
7408
+ <line number="171" hits="4" branch="false"/>
7409
+ <line number="172" hits="0" branch="true" condition-coverage="0% (0/4)"/>
7410
+ <line number="178" hits="4" branch="false"/>
7411
+ <line number="179" hits="0" branch="true" condition-coverage="0% (0/4)"/>
7412
+ <line number="189" hits="4" branch="false"/>
7413
+ <line number="190" hits="0" branch="true" condition-coverage="0% (0/4)"/>
7414
+ <line number="191" hits="0" branch="true" condition-coverage="0% (0/4)"/>
7415
+ <line number="197" hits="4" branch="false"/>
7416
+ <line number="198" hits="1" branch="false"/>
7417
+ <line number="201" hits="4" branch="false"/>
7480
7418
  </lines>
7481
7419
  </class>
7482
7420
  <class name="useHotKey.ts" filename="src/utils/useHotKey.ts" line-rate="0.7916" branch-rate="0.6">
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?: 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 nrfConnectForDesktop {
46
- nrfutil?: nrfutilModules;
45
+ interface NrfConnectForDesktop {
46
+ nrfutil?: NrfutilModules;
47
47
  html?: string;
48
48
  }
49
49
 
50
- interface nrfutilModules {
51
- [index: string]: string[] | undefined;
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: string;
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?: 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": "90.0.0",
3
+ "version": "92.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 if (existsSync('./.git')) {
97
- const realGitUrl = execSync('git remote get-url origin', {
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
 
@@ -56,7 +56,6 @@ function options(additionalOptions) {
56
56
  'electron',
57
57
  'serialport',
58
58
  '@electron/remote',
59
- '@nordicsemiconductor/nrf-device-lib-js',
60
59
  ...(appHasOwnHtml ? [] : ['react']),
61
60
 
62
61
  // App dependencies