@nordicsemiconductor/pc-nrfconnect-shared 263.0.0 → 265.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.
Files changed (46) hide show
  1. package/Changelog.md +72 -25
  2. package/config/eslintrc.js +2 -1
  3. package/config/jest.config.js +1 -1
  4. package/config/tsconfig.json +2 -2
  5. package/config/versions.test.ts +115 -0
  6. package/config/versions.ts +53 -0
  7. package/dist/scripts/nordic-publish.js +21 -19
  8. package/dist/typings/config/versions.d.ts +17 -0
  9. package/dist/typings/config/versions.d.ts.map +1 -0
  10. package/dist/typings/ipc/device.d.ts +1 -1
  11. package/dist/typings/ipc/schema/packageJson.d.ts +9 -9
  12. package/dist/typings/nrfutil/fs.d.ts +1 -1
  13. package/dist/typings/nrfutil/fs.d.ts.map +1 -1
  14. package/dist/typings/scripts/check-app-properties.d.ts.map +1 -1
  15. package/dist/typings/scripts/esbuild-renderer.d.ts +2 -1
  16. package/dist/typings/scripts/esbuild-renderer.d.ts.map +1 -1
  17. package/dist/typings/scripts/set-minimal-launcher.d.ts +3 -0
  18. package/dist/typings/scripts/set-minimal-launcher.d.ts.map +1 -0
  19. package/dist/typings/src/utils/packageJson.d.ts +2 -2
  20. package/ipc/device.ts +1 -1
  21. package/nrfutil/fs.ts +3 -3
  22. package/nrfutil/sandbox.ts +4 -4
  23. package/package.json +9 -4
  24. package/release_notes.md +8 -1
  25. package/scripts/build-app.ts +16 -3
  26. package/scripts/build-shared.ts +2 -1
  27. package/scripts/check-app-properties.ts +40 -6
  28. package/scripts/check-for-typescript.ts +2 -2
  29. package/scripts/check-versions.ts +53 -39
  30. package/scripts/esbuild-renderer.ts +10 -4
  31. package/scripts/installHusky.ts +1 -1
  32. package/scripts/nordic-publish.ts +2 -2
  33. package/scripts/nrfconnect-license.ts +1 -1
  34. package/scripts/set-minimal-launcher.ts +153 -0
  35. package/src/Device/deviceInfo/deviceInfo.ts +2 -2
  36. package/src/Device/sdfuOperations.ts +2 -2
  37. package/src/Parsers/shellParser.ts +1 -1
  38. package/src/SerialPort/SerialPort.ts +1 -1
  39. package/src/logging/index.ts +1 -1
  40. package/src/utils/appDirs.ts +1 -1
  41. package/src/utils/systemReport.ts +3 -3
  42. package/src/utils/udevInstalled.ts +1 -1
  43. package/test/setupTests.ts +1 -1
  44. package/dist/typings/scripts/versions.d.ts +0 -5
  45. package/dist/typings/scripts/versions.d.ts.map +0 -1
  46. package/scripts/versions.ts +0 -12
package/Changelog.md CHANGED
@@ -7,6 +7,53 @@ 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
+ ## 265.0.0 - 2026-12-01
11
+
12
+ ### Changed
13
+
14
+ - When importing Node built-in modules, it is now mandatory to use the `node:`
15
+ prefix (e.g. not `fs` but `node:fs`)
16
+
17
+ ### Steps to upgrade when using this package
18
+
19
+ - Run `npm run check:lint -- --fix` to fix cases where the `node:` prefix was
20
+ not used. If you mock Node built-in modules in your unit tests, you have to
21
+ adjust those mocks manually.
22
+
23
+ ## 264.0.0 - 2026-11-30
24
+
25
+ ### Added
26
+
27
+ - Script `set-minimal-launcher`. Run `npx set-minimal-launcher [version]` in an
28
+ app to set `engines.nrfconnect` in `package.json` to that launcher version and
29
+ install the matching Electron version as a dev dependency. Without a version,
30
+ the version already in `engines.nrfconnect` is used, so the script only
31
+ installs the matching Electron version.
32
+
33
+ ### Changed
34
+
35
+ - Updated Nordic Thingy:91 X PCA number.
36
+ - Bumped lib in TypeScript config to `ES2023`.
37
+ - Support multiple launcher and Electron versions:
38
+
39
+ Before, shared only defined a single Electron version, while in reality apps
40
+ may run with a launcher with an older Electron version. This is now
41
+ reflected by shared.
42
+ - Apps must now have a dev dependency on Electron, matching the version of
43
+ launcher they require. This is automatically checked, so when one runs
44
+ `npm run check` and it is not set correctly, the right invocation of
45
+ `npm install` is printed to fix the situation.
46
+ - Shared now defines a minimal launcher version. It is checked, that the app
47
+ has the same or a higher minimal launcher version (in `engines.nrfconnect`
48
+ in `package.json`). Before, this was just a convention.
49
+ - When building apps, they now target the Chrome version that corresponds
50
+ with the Electron version, defined by the minimal launcher version, the
51
+ app requires.
52
+
53
+ ### Steps to upgrade when using this package
54
+
55
+ - Run `npx set-minimal-launcher` to add Electron as a dev dependency.
56
+
10
57
  ## 263.0.0 - 2026-11-03
11
58
 
12
59
  ### Changed
@@ -406,7 +453,7 @@ import { Card } from '@nordicsemiconductor/pc-nrfconnect-shared';
406
453
 
407
454
  ### Changed
408
455
 
409
- - The required lincense file was slightly changed.
456
+ - The required license file was slightly changed.
410
457
 
411
458
  ### Steps to upgrade when using this package
412
459
 
@@ -634,15 +681,15 @@ import { Card } from '@nordicsemiconductor/pc-nrfconnect-shared';
634
681
 
635
682
  ### Added
636
683
 
637
- - `nrf-probe` verison check for `nrfutil device`.
684
+ - `nrf-probe` version check for `nrfutil device`.
638
685
 
639
686
  ### Removed
640
687
 
641
- - `nrfjprog` verison check for `nrfutil device`.
688
+ - `nrfjprog` version check for `nrfutil device`.
642
689
 
643
690
  ### Changed
644
691
 
645
- - Text in the Application card of the About tab can now be highlightede and
692
+ - Text in the Application card of the About tab can now be highlighted and
646
693
  copied.
647
694
  - J-Link download URL for `JLink_MacOSX_V794i_universal.pkg` to
648
695
  `JLink_MacOSX_V818_universal.pkg`
@@ -805,11 +852,11 @@ Overrides v202 as it was released a prerelease.
805
852
 
806
853
  ### Changed
807
854
 
808
- - DeviceSelector Abort controler now aborts on the onDisconnected event
855
+ - DeviceSelector Abort controller now aborts on the onDisconnected event
809
856
 
810
857
  ### Fixed
811
858
 
812
- - Auto connecting from CLI when multple devices are connected now works as
859
+ - Auto connecting from CLI when multiple devices are connected now works as
813
860
  expected.
814
861
 
815
862
  ## 185.0.0 - 2024-09-20
@@ -823,7 +870,7 @@ Overrides v202 as it was released a prerelease.
823
870
  ### Fixed
824
871
 
825
872
  - Stop nRF Util sandbox from starting to run an aborted command.
826
- - Device setup event call order when autoreconnecting at the same time as
873
+ - Device setup event call order when auto reconnecting at the same time as
827
874
  selecting.
828
875
 
829
876
  ### Steps to upgrade when using this package
@@ -1082,7 +1129,7 @@ Overrides v202 as it was released a prerelease.
1082
1129
  - `transparentButtonBg` parameter to `Dropdown` component.
1083
1130
  - `NumberInput` component (provides text, input, optional unit, and slider).
1084
1131
  - Common way to queue ongoing pending tasks. If an app is closed, a dialog is
1085
- prompted to alert users before clo sing app. Redux states for this are:
1132
+ prompted to alert users before closing app. Redux states for this are:
1086
1133
  - `addConfirmBeforeClose`
1087
1134
  - `clearConfirmBeforeClose`
1088
1135
  - `preventAppCloseUntilComplete` can be used to wrap some promise and secure
@@ -1344,7 +1391,7 @@ Overrides v202 as it was released a prerelease.
1344
1391
 
1345
1392
  ### Added
1346
1393
 
1347
- - `jprogDeviceSetup` take in aan optional boolean to skip the device setup if
1394
+ - `jprogDeviceSetup` take in an optional boolean to skip the device setup if
1348
1395
  device is protected. Default remain to show dialog. Apps will need to opt-in
1349
1396
 
1350
1397
  ## 136.0.0 - 2023-12-01
@@ -1353,7 +1400,7 @@ Overrides v202 as it was released a prerelease.
1353
1400
 
1354
1401
  - `useStopwatch` milliseconds was not correctly calculated
1355
1402
  - External JLink devices would not connect to apps device list properly if
1356
- selected before they are connected to the debug-in heder of the device
1403
+ selected before they are connected to the debug-in header of the device
1357
1404
 
1358
1405
  ### Changed
1359
1406
 
@@ -1547,7 +1594,7 @@ render(<App panes={[]} />);
1547
1594
  information to speed up enumeration and hotplug events.
1548
1595
  - new optional property in device object named `devkit`
1549
1596
  - `.jlink` property can be obtained by calling
1550
- `NrfutilDeviceLib.deviceInfo().jlink` on a Jlink device
1597
+ `NrfutilDeviceLib.deviceInfo().jlink` on a J-Link device
1551
1598
  - `.hwInfo` property can be obtained by calling
1552
1599
  `NrfutilDeviceLib.deviceInfo().hwInfo` on a device
1553
1600
  - `.dfuTriggerVersion` property can be obtained by calling
@@ -1565,7 +1612,7 @@ render(<App panes={[]} />);
1565
1612
 
1566
1613
  ### Fixed
1567
1614
 
1568
- - Check installed JLink version against expected version given by nrfutil
1615
+ - Check installed J-Link version against expected version given by nrfutil
1569
1616
  (previously this was the version bundled by the launcher).
1570
1617
 
1571
1618
  ### Steps to upgrade when using this package
@@ -1997,7 +2044,7 @@ declare module '!!@svgr!*.svg' {
1997
2044
  - Re-added underline (mistakenly removed) on hover for `link` variant of
1998
2045
  `Button` component.
1999
2046
  - Apps now have to load themselves, i.e. there is no `ReactDOM.render` done from
2000
- the launcher anymore. The app chooses which html-page will be the entrypoint.
2047
+ the launcher anymore. The app chooses which html-page will be the entry point.
2001
2048
  - Passing devices of type nrf-device-lib-js `Device` to calls from
2002
2049
  `deviceInfo.ts` is not allowed. Passing the nrf-device-lib-js version of
2003
2050
  `Device` is now allowed.
@@ -2343,7 +2390,7 @@ module.exports = {
2343
2390
 
2344
2391
  ### Added
2345
2392
 
2346
- - Exported `getWaitForDevice` hance allowing apps to resort previous state if
2393
+ - Exported `getWaitForDevice` hence allowing apps to resort previous state if
2347
2394
  needed
2348
2395
 
2349
2396
  ### Added
@@ -2549,7 +2596,7 @@ module.exports = {
2549
2596
 
2550
2597
  ### Fixed
2551
2598
 
2552
- - Feedback pane link to Nordiv DevZone did not open in the browser.
2599
+ - Feedback pane link to Nordic DevZone did not open in the browser.
2553
2600
  - Properly update package version when running the prepare script on windows.
2554
2601
 
2555
2602
  ### Changed
@@ -2691,14 +2738,14 @@ module.exports = {
2691
2738
 
2692
2739
  ### Fixed
2693
2740
 
2694
- - Autoreconnected devices were not passed with persisted data to the
2741
+ - Auto reconnected devices were not passed with persisted data to the
2695
2742
  `onDeviceSelected`/`onDeviceIsReady` callbacks.
2696
2743
 
2697
2744
  ### Removed
2698
2745
 
2699
- - Support for buiding apps with webpack. If you want to continue to use webpack,
2700
- you now have to provide the configuration and install the needed dependencies
2701
- yourself.
2746
+ - Support for building apps with webpack. If you want to continue to use
2747
+ webpack, you now have to provide the configuration and install the needed
2748
+ dependencies yourself.
2702
2749
 
2703
2750
  ### Steps to upgrade when using this package
2704
2751
 
@@ -2783,7 +2830,7 @@ module.exports = {
2783
2830
 
2784
2831
  ### Fixed
2785
2832
 
2786
- - Devices now receive persisted data on first enumation.
2833
+ - Devices now receive persisted data on first enumeration.
2787
2834
  - Safe guard against retaining stale wait for device request if a new device is
2788
2835
  selected
2789
2836
 
@@ -3046,7 +3093,7 @@ module.exports = {
3046
3093
 
3047
3094
  ### Changed
3048
3095
 
3049
- - `PersistedSerialPort` takes app name fom json
3096
+ - `PersistedSerialPort` takes app name from json
3050
3097
  - `TerminalSettings` vCom Index is append with `vCom-` in persist store
3051
3098
 
3052
3099
  ## 6.18.4 - 2023-02-01
@@ -3339,13 +3386,13 @@ this:
3339
3386
 
3340
3387
  - `NumberInlineInput` can opt to have step defined allowing only values that are
3341
3388
  a factor of this step size.
3342
- - `NumberInlineInput` can opt to have explict ranges allowing for split ranges.
3389
+ - `NumberInlineInput` can opt to have explicit ranges allowing for split ranges.
3343
3390
  - `InlineInput` can opt to have support for up/down keyboard events to control
3344
3391
  the value.
3345
3392
  - `NumberInlineInput` support for up/down keyboard events to control the value.
3346
3393
  - `Slider` can opt to have steps defined allowing allowing to increment the
3347
3394
  value with the step size.
3348
- - `Slider` can opt to have explict ranges allowing for split ranges. Ticks are
3395
+ - `Slider` can opt to have explicit ranges allowing for split ranges. Ticks are
3349
3396
  not yet supported on this mode.
3350
3397
  - Warn in console if Min and Max are not factors of the optional step size.
3351
3398
 
@@ -3618,7 +3665,7 @@ this:
3618
3665
  ### Changed
3619
3666
 
3620
3667
  - Move all devDependencies into dependencies and remove peer dependencies. The
3621
- peer ependencies were use by all apps anyways, so moving them all into
3668
+ peer dependencies were use by all apps anyways, so moving them all into
3622
3669
  dependencies will let the apps remove their own version of them.
3623
3670
 
3624
3671
  ## 6.3.2 - 2022-06-21
@@ -5096,7 +5143,7 @@ module.exports = require('pc-nrfconnect-shared/config/jest.config')();
5096
5143
 
5097
5144
  ### Fixed
5098
5145
 
5099
- - The remote property on the electron mock was noch mocked correctly.
5146
+ - The remote property on the electron mock was not mocked correctly.
5100
5147
 
5101
5148
  ### Changed
5102
5149
 
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
5
  */
6
6
 
7
- const fs = require('fs');
7
+ const fs = require('node:fs');
8
8
 
9
9
  const entriesInGitignore = fs
10
10
  .readFileSync('.gitignore', 'utf8')
@@ -46,6 +46,7 @@ module.exports = {
46
46
  { fixStyle: 'inline-type-imports' },
47
47
  ],
48
48
  'import/default': 'error',
49
+ 'import/enforce-node-protocol-usage': ['error', 'always'],
49
50
  'import/extensions': 'off',
50
51
  'import/named': 'error',
51
52
  'import/no-extraneous-dependencies': 'off',
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
5
  */
6
6
 
7
- const path = require('path');
7
+ const path = require('node:path');
8
8
 
9
9
  const mockDir = path.join(__dirname, '..', 'mocks');
10
10
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2021",
4
- "lib": ["es2022", "dom", "dom.iterable", "dom.asynciterable"],
3
+ "target": "es2023",
4
+ "lib": ["es2023", "dom", "dom.iterable", "dom.asynciterable"],
5
5
  "moduleResolution": "node",
6
6
  "esModuleInterop": true,
7
7
  "jsx": "react",
@@ -0,0 +1,115 @@
1
+ /*
2
+ * Copyright (c) 2026 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import semver from 'semver';
8
+
9
+ import packageJson from '../package.json';
10
+ import {
11
+ minimalLauncherVersion,
12
+ versionsByLauncherVersion,
13
+ versionsForLauncherVersion,
14
+ } from './versions';
15
+
16
+ const lowestSemver = (semvers: string[]) => semvers.toSorted(semver.compare)[0];
17
+
18
+ describe('minimalLauncherVersion', () => {
19
+ it('should have versions described for it', () => {
20
+ expect(() =>
21
+ versionsForLauncherVersion(minimalLauncherVersion),
22
+ ).not.toThrow();
23
+ });
24
+
25
+ it('must be the minimal version described in versionsByLauncherVersion', () => {
26
+ const minimalLauncherVersionInMapping = lowestSemver(
27
+ Object.keys(versionsByLauncherVersion).map(
28
+ range => semver.minVersion(range)!.version,
29
+ ),
30
+ );
31
+
32
+ expect(minimalLauncherVersion).toBe(minimalLauncherVersionInMapping);
33
+ });
34
+ });
35
+
36
+ describe('versionsByLauncherVersion', () => {
37
+ const electronVersions = Object.values(versionsByLauncherVersion).map(
38
+ ({ electron }) => electron,
39
+ );
40
+
41
+ it('does not have overlapping semver ranges', () => {
42
+ const launcherRanges = Object.keys(versionsByLauncherVersion);
43
+
44
+ const overlappingRangePairs = launcherRanges.flatMap((range, index) =>
45
+ launcherRanges
46
+ .slice(index + 1)
47
+ .filter(otherRange => semver.intersects(range, otherRange))
48
+ .map(otherRange => [range, otherRange]),
49
+ );
50
+
51
+ expect(overlappingRangePairs).toEqual([]);
52
+ });
53
+
54
+ it('has the same electron versions as in the peer dependencies', () => {
55
+ const electronPeerDependencies = packageJson.peerDependencies?.electron
56
+ ?.split('||')
57
+ .map(version => version.trim());
58
+
59
+ expect(electronVersions).toEqual(
60
+ expect.arrayContaining(electronPeerDependencies),
61
+ );
62
+ expect(electronPeerDependencies).toEqual(
63
+ expect.arrayContaining(electronVersions),
64
+ );
65
+ });
66
+
67
+ it('its lowest electron version matches the dev dependency', () => {
68
+ expect(packageJson.devDependencies.electron).toBe(
69
+ lowestSemver(electronVersions),
70
+ );
71
+ });
72
+ });
73
+
74
+ describe('versionsForLauncherVersion', () => {
75
+ const exampleVersionsByLauncher = {
76
+ '>=5.1.0 <=5.3.99': {
77
+ electron: '32',
78
+ chrome: '',
79
+ node: '',
80
+ },
81
+
82
+ '>5.3.99': {
83
+ electron: '43',
84
+ chrome: '',
85
+ node: '',
86
+ },
87
+ };
88
+
89
+ it('returns the versions for a version within the Range', () => {
90
+ expect(
91
+ versionsForLauncherVersion('5.3.0', exampleVersionsByLauncher)
92
+ .electron,
93
+ ).toEqual('32');
94
+
95
+ expect(
96
+ versionsForLauncherVersion(
97
+ semver.parse('5.3.0')!,
98
+ exampleVersionsByLauncher,
99
+ ).electron,
100
+ ).toEqual('32');
101
+ });
102
+
103
+ it('returns the right versions for pre-releases', () => {
104
+ expect(
105
+ versionsForLauncherVersion('5.4.0-pre1', exampleVersionsByLauncher)
106
+ .electron,
107
+ ).toEqual('43');
108
+ });
109
+
110
+ it('throws when no matching launcher range exists', () => {
111
+ expect(() =>
112
+ versionsForLauncherVersion('5.0.9', exampleVersionsByLauncher),
113
+ ).toThrow();
114
+ });
115
+ });
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright (c) 2025 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import semver, { type SemVer } from 'semver';
8
+
9
+ export const minimalLauncherVersion = '5.2.0';
10
+
11
+ export const versionsByLauncherVersion: Record<
12
+ string,
13
+ {
14
+ electron: string;
15
+ chrome: string;
16
+ node: string;
17
+ }
18
+ > = {
19
+ '>=5.2.0 <5.4.0': {
20
+ electron: '32.1.2',
21
+ chrome: '128.0.6613',
22
+ node: '20.17.0',
23
+ },
24
+
25
+ '>=5.4.0 <5.4.1': {
26
+ electron: '43.4.0',
27
+ chrome: '150.0.7871',
28
+ node: '24.18.1',
29
+ },
30
+
31
+ '>=5.4.1': {
32
+ electron: '43.8.6',
33
+ chrome: '150.0.7871',
34
+ node: '24.22.1',
35
+ },
36
+ };
37
+
38
+ export const versionsForLauncherVersion = (
39
+ launcherVersion: string | SemVer,
40
+ versions = versionsByLauncherVersion,
41
+ ) => {
42
+ const result = Object.entries(versions).find(([range]) =>
43
+ semver.satisfies(launcherVersion, range, { includePrerelease: true }),
44
+ );
45
+
46
+ if (result == null) {
47
+ throw new Error(
48
+ `No versions found for launcher version ${launcherVersion}. Please update config/versions.ts to include this version.`,
49
+ );
50
+ }
51
+
52
+ return result[1];
53
+ };