@nordicsemiconductor/pc-nrfconnect-shared 60.0.0-pre1 → 60.0.0-pre2

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 (232) hide show
  1. package/dist/bootstrap.css +8951 -0
  2. package/dist/index.css +1451 -0
  3. package/dist/index.js +122119 -0
  4. package/{src/Logo/nordic-logo-blue-icon-only.png → dist/nordic-logo-blue-icon-only-H7BABN6D.png} +0 -0
  5. package/{src/Logo/nordic-logo-gray-icon-only.png → dist/nordic-logo-gray-icon-only-GATOTR3L.png} +0 -0
  6. package/package.json +12 -3
  7. package/typings/generated/src/Device/deviceInfo/deviceInfo.d.ts +1 -2
  8. package/.github/ISSUE_TEMPLATE/custom.md +0 -10
  9. package/.husky/pre-push +0 -3
  10. package/.renovaterc.json +0 -10
  11. package/Changelog.md +0 -2973
  12. package/azure-pipelines.yml +0 -34
  13. package/config/eslintrc.js +0 -190
  14. package/config/jest.config.js +0 -41
  15. package/config/prettier.config.js +0 -13
  16. package/config/tsconfig.json +0 -15
  17. package/fw/bootloader/graviton_bootloader_v1.0.1-[nRF5_SDK_15.0.1-1.alpha_f76d012].zip +0 -0
  18. package/jest.config.js +0 -7
  19. package/main/index.ts +0 -32
  20. package/mocks/deviceLibMock.ts +0 -21
  21. package/mocks/electronMock.ts +0 -15
  22. package/mocks/electronStoreMock.ts +0 -19
  23. package/mocks/emptyMock.ts +0 -7
  24. package/mocks/fileMock.ts +0 -13
  25. package/mocks/gaMock.ts +0 -9
  26. package/mocks/mockTests.test.ts +0 -15
  27. package/mocks/packageJsonMock.ts +0 -10
  28. package/mocks/remoteMock.ts +0 -17
  29. package/scripts/esbuild-bootstrap.js +0 -15
  30. package/scripts/esbuild-renderer.js +0 -131
  31. package/scripts/installHusky.ts +0 -17
  32. package/scripts/prepare-shared-release.ts +0 -122
  33. package/scripts/release-shared.test.ts +0 -132
  34. package/scripts/release-shared.ts +0 -207
  35. package/src/About/About.tsx +0 -25
  36. package/src/About/AboutButton.tsx +0 -28
  37. package/src/About/ApplicationCard.tsx +0 -83
  38. package/src/About/DeviceCard.tsx +0 -74
  39. package/src/About/DocumentationCard.tsx +0 -18
  40. package/src/About/DocumentationSection.tsx +0 -24
  41. package/src/About/Section.tsx +0 -21
  42. package/src/About/ShortcutButton.tsx +0 -41
  43. package/src/About/SupportCard.tsx +0 -97
  44. package/src/About/about.scss +0 -40
  45. package/src/About/documentationSlice.ts +0 -41
  46. package/src/About/section.scss +0 -15
  47. package/src/About/shortcutSlice.ts +0 -52
  48. package/src/Alert/Alert.module.scss +0 -29
  49. package/src/Alert/Alert.tsx +0 -37
  50. package/src/App/App.test.tsx +0 -47
  51. package/src/App/App.tsx +0 -227
  52. package/src/App/ConnectedToStore.tsx +0 -19
  53. package/src/App/VisibilityBar.tsx +0 -103
  54. package/src/App/app.scss +0 -83
  55. package/src/App/appLayout.ts +0 -95
  56. package/src/App/shared.scss +0 -49
  57. package/src/App/visibility-bar.scss +0 -55
  58. package/src/Button/Button.tsx +0 -66
  59. package/src/Button/button.module.scss +0 -154
  60. package/src/Card/Card.tsx +0 -26
  61. package/src/Card/card.module.scss +0 -28
  62. package/src/Device/BrokenDeviceDialog/BrokenDeviceDialog.tsx +0 -58
  63. package/src/Device/BrokenDeviceDialog/broken-device-dialog.scss +0 -18
  64. package/src/Device/BrokenDeviceDialog/brokenDeviceDialogSlice.tsx +0 -48
  65. package/src/Device/DeviceSelector/BasicDeviceInfo.tsx +0 -115
  66. package/src/Device/DeviceSelector/DeviceIcon.tsx +0 -27
  67. package/src/Device/DeviceSelector/DeviceList/AnimatedList.tsx +0 -62
  68. package/src/Device/DeviceSelector/DeviceList/BrokenDevice.tsx +0 -34
  69. package/src/Device/DeviceSelector/DeviceList/Device.tsx +0 -84
  70. package/src/Device/DeviceSelector/DeviceList/DeviceList.tsx +0 -113
  71. package/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.tsx +0 -28
  72. package/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.tsx +0 -65
  73. package/src/Device/DeviceSelector/DeviceList/RenameDevice.tsx +0 -22
  74. package/src/Device/DeviceSelector/DeviceList/broken-device.scss +0 -32
  75. package/src/Device/DeviceSelector/DeviceList/device-list.scss +0 -64
  76. package/src/Device/DeviceSelector/DeviceList/device.scss +0 -28
  77. package/src/Device/DeviceSelector/DeviceList/edit-device-buttons.scss +0 -31
  78. package/src/Device/DeviceSelector/DeviceList/more-device-info.scss +0 -33
  79. package/src/Device/DeviceSelector/DeviceList/rename-device.scss +0 -13
  80. package/src/Device/DeviceSelector/DeviceSelector.test.tsx +0 -342
  81. package/src/Device/DeviceSelector/DeviceSelector.tsx +0 -173
  82. package/src/Device/DeviceSelector/Favorite.tsx +0 -49
  83. package/src/Device/DeviceSelector/SelectDevice.tsx +0 -36
  84. package/src/Device/DeviceSelector/SelectedDevice.tsx +0 -65
  85. package/src/Device/DeviceSelector/arrow-down.svg +0 -1
  86. package/src/Device/DeviceSelector/basic-device-info.scss +0 -62
  87. package/src/Device/DeviceSelector/device-icon.scss +0 -27
  88. package/src/Device/DeviceSelector/favorite.scss +0 -17
  89. package/src/Device/DeviceSelector/select-device.scss +0 -38
  90. package/src/Device/DeviceSelector/selected-device.scss +0 -57
  91. package/src/Device/DeviceSetup/DeviceSetupView.tsx +0 -102
  92. package/src/Device/deviceAutoSelectSlice.ts +0 -144
  93. package/src/Device/deviceInfo/deviceInfo.ts +0 -254
  94. package/src/Device/deviceInfo/nRF51-Series-logo.svg +0 -1
  95. package/src/Device/deviceInfo/nRF52-Series-logo.svg +0 -1
  96. package/src/Device/deviceInfo/nRF53-Series-logo.svg +0 -1
  97. package/src/Device/deviceInfo/nRF70-Series_no-background_RGB.svg +0 -36
  98. package/src/Device/deviceInfo/nRF91-Series-logo.svg +0 -1
  99. package/src/Device/deviceInfo/ppk-logo.svg +0 -1
  100. package/src/Device/deviceInfo/unknown-logo.svg +0 -30
  101. package/src/Device/deviceInfo/unknown-nordic-logo.svg +0 -25
  102. package/src/Device/deviceLibWrapper.test.ts +0 -97
  103. package/src/Device/deviceLibWrapper.ts +0 -133
  104. package/src/Device/deviceLister.test.ts +0 -89
  105. package/src/Device/deviceLister.ts +0 -396
  106. package/src/Device/deviceSetup.ts +0 -264
  107. package/src/Device/deviceSetupSlice.ts +0 -94
  108. package/src/Device/deviceSlice.ts +0 -248
  109. package/src/Device/dfu-cc.ts +0 -162
  110. package/src/Device/initPacket.ts +0 -402
  111. package/src/Device/jprogOperations.ts +0 -206
  112. package/src/Device/sdfuOperations.ts +0 -601
  113. package/src/Dialog/Dialog.test.tsx +0 -134
  114. package/src/Dialog/Dialog.tsx +0 -236
  115. package/src/Dialog/dialog.scss +0 -60
  116. package/src/Dropdown/Dropdown.module.scss +0 -83
  117. package/src/Dropdown/Dropdown.test.tsx +0 -62
  118. package/src/Dropdown/Dropdown.tsx +0 -106
  119. package/src/ErrorBoundary/ErrorBoundary.test.tsx +0 -105
  120. package/src/ErrorBoundary/ErrorBoundary.tsx +0 -186
  121. package/src/ErrorBoundary/bug.svg +0 -1
  122. package/src/ErrorBoundary/error-boundary.scss +0 -102
  123. package/src/ErrorDialog/ErrorDialog.test.tsx +0 -70
  124. package/src/ErrorDialog/ErrorDialog.tsx +0 -94
  125. package/src/ErrorDialog/error.scss +0 -14
  126. package/src/ErrorDialog/errorDialogSlice.test.ts +0 -64
  127. package/src/ErrorDialog/errorDialogSlice.ts +0 -80
  128. package/src/FactoryReset/FactoryResetButton.test.tsx +0 -46
  129. package/src/FactoryReset/FactoryResetButton.tsx +0 -81
  130. package/src/InlineInput/InlineInput.tsx +0 -170
  131. package/src/InlineInput/NumberInlineInput.tsx +0 -107
  132. package/src/InlineInput/inline-input.scss +0 -38
  133. package/src/InlineInput/number-inline-input.scss +0 -15
  134. package/src/Log/LogEntry.tsx +0 -62
  135. package/src/Log/LogViewer.tsx +0 -54
  136. package/src/Log/log-entry.scss +0 -30
  137. package/src/Log/log-viewer.scss +0 -24
  138. package/src/Log/logSlice.ts +0 -73
  139. package/src/Log/syncLogToStore.ts +0 -36
  140. package/src/Logo/Logo.tsx +0 -48
  141. package/src/Logo/logo.scss +0 -11
  142. package/src/Main/Main.tsx +0 -13
  143. package/src/Main/main.scss +0 -13
  144. package/src/MasonryLayout/MasonryLayout.tsx +0 -234
  145. package/src/MasonryLayout/masonryLayout.module.scss +0 -46
  146. package/src/NavBar/NavBar.tsx +0 -22
  147. package/src/NavBar/NavMenu.test.tsx +0 -41
  148. package/src/NavBar/NavMenu.tsx +0 -53
  149. package/src/NavBar/NavMenuItem.tsx +0 -41
  150. package/src/NavBar/nav-bar.scss +0 -26
  151. package/src/NavBar/nav-menu-item.scss +0 -34
  152. package/src/OpenApp/openApp.ts +0 -18
  153. package/src/Panes/FeedbackPane.tsx +0 -149
  154. package/src/PseudoButton/PseudoButton.tsx +0 -56
  155. package/src/PseudoButton/pseudo-button.scss +0 -11
  156. package/src/SerialPort/ConflictingSettingsDialog.tsx +0 -242
  157. package/src/SerialPort/SerialPort.test.ts +0 -54
  158. package/src/SerialPort/SerialPort.ts +0 -202
  159. package/src/Shortcuts/Shortcut-item.scss +0 -33
  160. package/src/Shortcuts/Shortcut-modal.scss +0 -20
  161. package/src/Shortcuts/ShortcutItem.tsx +0 -48
  162. package/src/Shortcuts/ShortcutModal.tsx +0 -67
  163. package/src/SidePanel/Group.tsx +0 -106
  164. package/src/SidePanel/SidePanel.tsx +0 -19
  165. package/src/SidePanel/group.scss +0 -42
  166. package/src/SidePanel/sidepanel.scss +0 -20
  167. package/src/Slider/Bar.tsx +0 -24
  168. package/src/Slider/Factor.test.ts +0 -48
  169. package/src/Slider/Handle.tsx +0 -121
  170. package/src/Slider/Slider.test.tsx +0 -25
  171. package/src/Slider/Slider.tsx +0 -91
  172. package/src/Slider/Ticks.tsx +0 -54
  173. package/src/Slider/__snapshots__/Slider.test.tsx.snap +0 -50
  174. package/src/Slider/bar.scss +0 -24
  175. package/src/Slider/factor.ts +0 -24
  176. package/src/Slider/handle.scss +0 -32
  177. package/src/Slider/percentage.ts +0 -67
  178. package/src/Slider/range.ts +0 -92
  179. package/src/Slider/slider.scss +0 -14
  180. package/src/Slider/ticks.scss +0 -28
  181. package/src/Slider/variables.scss +0 -16
  182. package/src/StartStopButton/StartStopButton.tsx +0 -60
  183. package/src/StartStopButton/play-circle.svg +0 -1
  184. package/src/StartStopButton/start-stop-button.scss +0 -47
  185. package/src/StartStopButton/stop-circle.svg +0 -1
  186. package/src/StateSelector/StateSelector.tsx +0 -64
  187. package/src/StateSelector/state-selector.scss +0 -38
  188. package/src/Stepper/Stepper.tsx +0 -139
  189. package/src/Stepper/stepper.scss +0 -127
  190. package/src/Toggle/Toggle.tsx +0 -120
  191. package/src/Toggle/toggle.scss +0 -109
  192. package/src/bootstrap.scss +0 -14
  193. package/src/index.ts +0 -146
  194. package/src/logging/appTransport.test.ts +0 -78
  195. package/src/logging/appTransport.ts +0 -41
  196. package/src/logging/describeError.test.ts +0 -38
  197. package/src/logging/describeError.ts +0 -56
  198. package/src/logging/index.ts +0 -103
  199. package/src/logging/logBuffer.test.ts +0 -41
  200. package/src/logging/logBuffer.ts +0 -24
  201. package/src/logging/sendInitialLogMessages.ts +0 -64
  202. package/src/store.ts +0 -60
  203. package/src/svg.d.ts +0 -15
  204. package/src/utils/AppTypes.ts +0 -60
  205. package/src/utils/appDirs.ts +0 -78
  206. package/src/utils/bleChannels.ts +0 -16
  207. package/src/utils/classNames.test.ts +0 -29
  208. package/src/utils/classNames.ts +0 -25
  209. package/src/utils/colors.scss +0 -46
  210. package/src/utils/colors.ts +0 -38
  211. package/src/utils/describeVersion.ts +0 -21
  212. package/src/utils/environment.ts +0 -6
  213. package/src/utils/logLibVersions.ts +0 -103
  214. package/src/utils/open.ts +0 -46
  215. package/src/utils/packageJson.ts +0 -60
  216. package/src/utils/persistentStore.ts +0 -144
  217. package/src/utils/systemReport.ts +0 -160
  218. package/src/utils/truncateMiddle.test.ts +0 -21
  219. package/src/utils/truncateMiddle.ts +0 -20
  220. package/src/utils/usageData.ts +0 -189
  221. package/src/utils/useHotKey.ts +0 -62
  222. package/src/utils/useStopwatch.test.tsx +0 -311
  223. package/src/utils/useStopwatch.ts +0 -140
  224. package/src/variables.scss +0 -820
  225. package/styles.scss +0 -88
  226. package/test/dispatchTo.ts +0 -23
  227. package/test/index.ts +0 -7
  228. package/test/jestResolver.js +0 -28
  229. package/test/setupTests.ts +0 -27
  230. package/test/testUtil.ts +0 -20
  231. package/test/testrenderer.tsx +0 -39
  232. /package/{src/Logo/nordic-logo-white-icon-only.png → dist/nordic-logo-white-icon-only-XIZBW537.png} +0 -0
@@ -1,122 +0,0 @@
1
- #!/usr/bin/env ts-node
2
-
3
- /*
4
- * Copyright (c) 2023 Nordic Semiconductor ASA
5
- *
6
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
7
- */
8
-
9
- /*
10
- A script to prepare a new version of shared.
11
-
12
- Requirement for this script: Have [the GitHub CLI tool `gh`](https://cli.github.com)
13
- installed and authenticate in it (run `gh auth login`).
14
-
15
- Run
16
- npm run prepare-shared-release
17
- to update the version in `package.json` and the header of the latest entry
18
- in `Changelog.md`.
19
- */
20
- import { spawnSync } from 'node:child_process';
21
- import { readFileSync, writeFileSync } from 'node:fs';
22
-
23
- import { getNextReleaseNumber } from './release-shared';
24
-
25
- const parseJson = <Result>(jsonString: string) =>
26
- JSON.parse(jsonString) as Result;
27
-
28
- const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
29
- const npm = (...commands) =>
30
- spawnSync(npmCommand, commands, {
31
- stdio: ['inherit', 'pipe', 'inherit'],
32
- encoding: 'utf-8',
33
- }).stdout;
34
-
35
- const updatePackageJson = (nextReleaseNumber: number) => {
36
- const nextVersionString = `${nextReleaseNumber}.0.0`;
37
- const currentVersion = parseJson<string>(npm('pkg', 'get', 'version'));
38
-
39
- if (nextVersionString === currentVersion) {
40
- console.log(
41
- `- The version in \`package.json\` is already \`${currentVersion}\`, no need to change it.`
42
- );
43
- return false;
44
- }
45
-
46
- npm('pkg', 'set', `version=${nextVersionString}`);
47
- console.log(
48
- `- Updated the version in \`package.json\` to \`${nextVersionString}\`.`
49
- );
50
-
51
- return true;
52
- };
53
-
54
- const withoutTime = (date: Date) => date.toISOString().split('T')[0];
55
-
56
- const updateChangelog = (nextReleaseNumber: number) => {
57
- const changelog = readFileSync('Changelog.md', { encoding: 'utf-8' });
58
-
59
- const match = changelog.match(
60
- /(?<beginning>.*?)^## (?<header>.*?)$(?<ending>.*)/ms
61
- );
62
-
63
- if (match?.groups == null) {
64
- console.error(
65
- 'x Unable to correctly parse `Changelog.md`, to play it safe I am not changing it.'
66
- );
67
- return { updated: false, error: true };
68
- }
69
-
70
- const { beginning, header, ending } = match.groups;
71
-
72
- const correctHeader = `${nextReleaseNumber} - ${withoutTime(new Date())}`;
73
- if (header === correctHeader) {
74
- console.log(
75
- `- The latest entry in \`Changelog.md\` already has the header \`${header}\`, no need to change it.`
76
- );
77
- return { updated: false, error: false };
78
- }
79
-
80
- if (
81
- header === 'Unreleased' ||
82
- header === `${nextReleaseNumber} - Unreleased`
83
- ) {
84
- writeFileSync(
85
- 'Changelog.md',
86
- `${beginning}## ${correctHeader}${ending}`,
87
- { encoding: 'utf-8' }
88
- );
89
- console.log(
90
- `- Updated the header of the latest entry in \`Changelog.md\` to \`${correctHeader}\`.`
91
- );
92
-
93
- return { updated: true, error: false };
94
- }
95
-
96
- console.error(
97
- `x The latest entry in \`Changelog.md\` is not named \`Unreleased\` or \`${nextReleaseNumber} - Unreleased\`, to play it safe I am not changing it.`
98
- );
99
-
100
- return { updated: false, error: true };
101
- };
102
-
103
- const main = () => {
104
- const nextReleaseNumber = getNextReleaseNumber();
105
-
106
- const updatedPackageJson = updatePackageJson(nextReleaseNumber);
107
- const { updated: updatedChangelog, error } =
108
- updateChangelog(nextReleaseNumber);
109
-
110
- if (!updatedPackageJson && !updatedChangelog) {
111
- console.log('\nEverything already up-to-date.');
112
- } else if (!error) {
113
- console.log(
114
- '\nUpdated everything needed. You still need to bring these changes into main.'
115
- );
116
- }
117
- };
118
-
119
- const runAsScript = require.main === module;
120
- if (runAsScript) {
121
- main();
122
- }
@@ -1,132 +0,0 @@
1
- /*
2
- * Copyright (c) 2023 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import {
8
- changelogIsCorrect,
9
- getLatestEntry,
10
- getNextReleaseNumber,
11
- latestEntryIsNotEmpty,
12
- latestHeaderIsCorrect,
13
- packageJsonIsCorrect,
14
- } from './release-shared';
15
-
16
- const noop = () => {};
17
-
18
- test('determinding the next release number', () => {
19
- expect(getNextReleaseNumber('v34', { log: noop })).toBe(35);
20
- });
21
-
22
- describe('checking package.json', () => {
23
- test('no errors', () => {
24
- expect(
25
- packageJsonIsCorrect(34, {
26
- fail: noop,
27
- packageJson: '{"version": "34.0.0"}',
28
- })
29
- ).toBe(true);
30
- });
31
- test('version is wrong', () => {
32
- expect(
33
- packageJsonIsCorrect(34, {
34
- fail: noop,
35
- packageJson: '{"version": "33.0.0"}',
36
- })
37
- ).toBe(false);
38
- });
39
- test('format is wrong', () => {
40
- expect(
41
- packageJsonIsCorrect(34, {
42
- fail: noop,
43
- packageJson: '{"version": "34"}',
44
- })
45
- ).toBe(false);
46
- });
47
- });
48
-
49
- describe('checking Changelod.md', () => {
50
- test('no errors', () => {
51
- const correctChangelog = `# Changelog
52
-
53
- All notable changes to this project will be documented in this file.
54
-
55
- ## 34 - 2022-03-10
56
-
57
- ### Changed
58
-
59
- - Something`;
60
-
61
- expect(
62
- changelogIsCorrect(34, {
63
- fail: noop,
64
- now: new Date('2022-03-10T12:38:37.267Z'),
65
- changelog: correctChangelog,
66
- })
67
- ).toBe(true);
68
- });
69
-
70
- test('Unreleased entry', () => {
71
- const outdatedChangelog = `# Changelog
72
-
73
- All notable changes to this project will be documented in this file.
74
-
75
- ## 33 - 2022-02-01
76
-
77
- ### Changed
78
-
79
- - Something`;
80
-
81
- expect(
82
- latestHeaderIsCorrect(34, {
83
- fail: noop,
84
- now: new Date('2022-03-10T12:38:37.267Z'),
85
- changelog: outdatedChangelog,
86
- })
87
- ).toBe(false);
88
- });
89
-
90
- test('Empty entry', () => {
91
- const emptyLatestEntry = `# Changelog
92
-
93
- All notable changes to this project will be documented in this file.
94
-
95
- ## 34 - 2022-03-10
96
-
97
- ## 33 - 2022-02-01`;
98
-
99
- expect(
100
- latestEntryIsNotEmpty({
101
- fail: noop,
102
- changelog: emptyLatestEntry,
103
- })
104
- ).toBe(false);
105
- });
106
- });
107
-
108
- describe('Parsing Changelog.md', () => {
109
- const changelog = `# Changelog
110
-
111
- All notable changes to this project will be documented in this file.
112
-
113
- ## 34 - 2023-04-20
114
-
115
- ### Changed
116
-
117
- - Something
118
-
119
- ## 33 - 2023-04-19
120
-
121
- ### Added
122
-
123
- - Something else
124
- `;
125
-
126
- test('Extracting the latest entry', () => {
127
- expect(getLatestEntry(changelog)).toMatchObject({
128
- header: '34 - 2023-04-20',
129
- content: '### Changed\n\n- Something',
130
- });
131
- });
132
- });
@@ -1,207 +0,0 @@
1
- #!/usr/bin/env ts-node
2
-
3
- /*
4
- * Copyright (c) 2023 Nordic Semiconductor ASA
5
- *
6
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
7
- */
8
-
9
- /*
10
- A script to release a new version of shared.
11
-
12
- Requirement for this script: Have [the GitHub CLI tool `gh`](https://cli.github.com)
13
- installed and authenticate in it (run `gh auth login`).
14
-
15
- Run
16
- npm run release-shared -- --dry-run
17
- to check whether the script thinks you can release a new version of shared.
18
-
19
- Run
20
- npm run release-shared
21
- to actually do the release.
22
-
23
- This script checks the contents in the branch `origin/main`.
24
- So if locally looks everything fine, please check `origin/main`.
25
- */
26
- import { execSync, spawnSync } from 'node:child_process';
27
-
28
- import { PackageJson } from '../src/utils/AppTypes';
29
-
30
- const logError = (message: string) => {
31
- console.error(message);
32
- };
33
-
34
- const parseJson = <Result>(jsonString: string) =>
35
- JSON.parse(jsonString) as Result;
36
-
37
- const git = (...commands) =>
38
- spawnSync('git', commands, {
39
- stdio: ['inherit', 'pipe', 'inherit'],
40
- encoding: 'utf-8',
41
- }).stdout;
42
-
43
- const getLatestReleaseName = () =>
44
- parseJson<{ tagName: string }>(
45
- execSync(`gh release view --json tagName`, { encoding: 'utf-8' })
46
- ).tagName;
47
-
48
- export const getNextReleaseNumber = (
49
- latestReleaseName = getLatestReleaseName(),
50
- { log } = { log: console.log }
51
- ) => {
52
- const latestReleaseNumber = Number(
53
- /^v(?<versionNumber>\d+)$/.exec(latestReleaseName)?.groups
54
- ?.versionNumber
55
- );
56
-
57
- const nextReleaseNumber = latestReleaseNumber + 1;
58
-
59
- log(
60
- `The currently released version is ${latestReleaseNumber}, so the next one will be ${nextReleaseNumber}.\n`
61
- );
62
-
63
- return nextReleaseNumber;
64
- };
65
-
66
- const equality = <T>(
67
- expected: T,
68
- actual: T,
69
- errorMessage: string,
70
- fail: typeof logError
71
- ) => {
72
- if (expected !== actual) {
73
- fail(
74
- `${errorMessage}:\n Expected: ${expected}\n Actual: ${actual}\n`
75
- );
76
- }
77
-
78
- return expected === actual;
79
- };
80
-
81
- const getLatestPackageJson = () => git('show', 'origin/main:package.json');
82
-
83
- export const packageJsonIsCorrect = (
84
- expectedVersionNumber: number,
85
- { fail, packageJson } = {
86
- fail: logError,
87
- packageJson: getLatestPackageJson(),
88
- }
89
- ) => {
90
- const expectedVersionString = `${expectedVersionNumber}.0.0`;
91
- const actualVersionString = parseJson<PackageJson>(packageJson).version;
92
-
93
- return equality(
94
- expectedVersionString,
95
- actualVersionString,
96
- 'Version number in `package.json` is not as expected',
97
- fail
98
- );
99
- };
100
-
101
- const getLatestChangelog = () => git('show', 'origin/main:Changelog.md');
102
-
103
- export const getLatestEntry = (changelog: string) => {
104
- const latestEntry = changelog.split('\n## ')[1];
105
-
106
- const header = latestEntry.split('\n')[0];
107
- const content = latestEntry.replace(/[^\n]*/, '').trim();
108
-
109
- return { header, content };
110
- };
111
-
112
- export const latestEntryIsNotEmpty = ({
113
- fail,
114
- changelog,
115
- }: {
116
- fail: (message: string) => void;
117
- changelog: string;
118
- }) => {
119
- const correct = getLatestEntry(changelog).content.length > 0;
120
-
121
- if (!correct) {
122
- fail('Latest entry in `Changelog.md` does not contain anything.');
123
- }
124
-
125
- return correct;
126
- };
127
-
128
- const withoutTime = (date: Date) => date.toISOString().split('T')[0];
129
-
130
- export const latestHeaderIsCorrect = (
131
- expectedVersionNumber: number,
132
- { fail, now, changelog } = {
133
- fail: logError,
134
- now: new Date(),
135
- changelog: getLatestChangelog(),
136
- }
137
- ) => {
138
- const expectedHeaderline = `${expectedVersionNumber} - ${withoutTime(now)}`;
139
- const actualHeaderline = getLatestEntry(changelog).header;
140
-
141
- return equality(
142
- expectedHeaderline,
143
- actualHeaderline,
144
- 'Latest entry in `Changelog.md` is not as expected',
145
- fail
146
- );
147
- };
148
-
149
- export const changelogIsCorrect = (
150
- expectedVersionNumber: number,
151
- { fail, now, changelog } = {
152
- fail: logError,
153
- now: new Date(),
154
- changelog: getLatestChangelog(),
155
- }
156
- ) =>
157
- latestEntryIsNotEmpty({ fail, changelog }) &&
158
- latestHeaderIsCorrect(expectedVersionNumber, { fail, now, changelog });
159
-
160
- const doRelease = (nextReleaseNumber: number) => {
161
- const nextReleaseName = `v${nextReleaseNumber}`;
162
- const latestChangelogEntry = getLatestEntry(getLatestChangelog()).content;
163
-
164
- const dryRun = process.argv.includes('--dry-run');
165
- if (dryRun) {
166
- console.log(
167
- `Would create a release ${nextReleaseName} now, with this description:\n${latestChangelogEntry}`
168
- );
169
- } else {
170
- console.log(`Creating release ${nextReleaseName} now:`);
171
- const result = spawnSync(
172
- 'gh',
173
- [
174
- 'release',
175
- 'create',
176
- nextReleaseName,
177
- '--title',
178
- nextReleaseName,
179
- '--notes',
180
- latestChangelogEntry,
181
- ],
182
- {
183
- stdio: 'inherit',
184
- encoding: 'utf-8',
185
- }
186
- );
187
- process.exitCode = result.status ?? 1;
188
- }
189
- };
190
-
191
- const main = () => {
192
- console.log(git('fetch'));
193
- const nextReleaseNumber = getNextReleaseNumber();
194
-
195
- const noErrors =
196
- packageJsonIsCorrect(nextReleaseNumber) &&
197
- changelogIsCorrect(nextReleaseNumber);
198
-
199
- if (noErrors) {
200
- doRelease(nextReleaseNumber);
201
- }
202
- };
203
-
204
- const runAsScript = require.main === module;
205
- if (runAsScript) {
206
- main();
207
- }
@@ -1,25 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
-
9
- import ApplicationCard from './ApplicationCard';
10
- import DeviceCard from './DeviceCard';
11
- import DocumentationCard from './DocumentationCard';
12
- import SupportCard from './SupportCard';
13
-
14
- import './about.scss';
15
-
16
- export default () => (
17
- <div className="about">
18
- <div className="about-inner">
19
- <ApplicationCard />
20
- <DeviceCard />
21
- <DocumentationCard />
22
- <SupportCard />
23
- </div>
24
- </div>
25
- );
@@ -1,28 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React, { FC } from 'react';
8
-
9
- import Button from '../Button/Button';
10
- import { openUrl } from '../utils/open';
11
-
12
- interface Props {
13
- onClick?: () => void;
14
- url?: string;
15
- label: string;
16
- }
17
-
18
- const AboutButton: FC<Props> = ({ url, label, onClick }) => (
19
- <Button
20
- disabled={!url && !onClick}
21
- onClick={onClick || (() => openUrl(url as string))}
22
- variant="secondary"
23
- >
24
- {label}
25
- </Button>
26
- );
27
-
28
- export default AboutButton;
@@ -1,83 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React, { useEffect, useState } from 'react';
8
- import { ipcRenderer } from 'electron';
9
-
10
- import Card from '../Card/Card';
11
- import FactoryResetButton from '../FactoryReset/FactoryResetButton';
12
- import AboutButton from './AboutButton';
13
- import Section from './Section';
14
- import ShortcutButton from './ShortcutButton';
15
-
16
- interface AppDetails {
17
- coreVersion: string;
18
- corePath: string;
19
- homeDir: string;
20
- tmpDir: string;
21
- }
22
-
23
- interface LauncerApp {
24
- name?: string;
25
- displayName?: string;
26
- description?: string;
27
- homepage?: string;
28
- currentVersion?: string;
29
- latestVersion?: string;
30
- engineVersion?: string;
31
- path?: string;
32
- iconPath?: string;
33
- shortcutIconPath?: string;
34
- isOfficial?: string;
35
- sharedVersion?: string;
36
- source?: string;
37
- url?: string;
38
- releaseNote?: string;
39
- upgradeAvailable?: string;
40
- repositoryUrl?: string;
41
- }
42
-
43
- type DetailsFromLauncher = AppDetails & LauncerApp;
44
-
45
- export default () => {
46
- const [appInfo, setAppInfo] = useState<DetailsFromLauncher>();
47
-
48
- useEffect(() => {
49
- ipcRenderer.once('app-details', (_, details: DetailsFromLauncher) => {
50
- setAppInfo(details);
51
- });
52
- ipcRenderer.send('get-app-details');
53
- }, [setAppInfo]);
54
-
55
- if (appInfo == null) return null;
56
-
57
- return (
58
- <Card title="Application">
59
- <Section title="Title">{appInfo.displayName}</Section>
60
- <Section title="Purpose">{appInfo.description}</Section>
61
- <Section title="Version">{appInfo.currentVersion}</Section>
62
- <Section title="Source">{appInfo.source || 'local'}</Section>
63
- <Section title="Supported engines">
64
- nRF Connect {appInfo.engineVersion}
65
- </Section>
66
- <Section title="Current engine">
67
- nRF Connect {appInfo.coreVersion}
68
- </Section>
69
- <Section>
70
- <AboutButton
71
- url={appInfo.repositoryUrl}
72
- label="Get source code"
73
- />
74
- </Section>
75
- <Section>
76
- <FactoryResetButton label="Restore defaults..." />
77
- </Section>
78
- <Section>
79
- <ShortcutButton label="Show shortcuts" />
80
- </Section>
81
- </Card>
82
- );
83
- };
@@ -1,74 +0,0 @@
1
- /*
2
- * Copyright (c) 2015 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
- import { useSelector } from 'react-redux';
9
-
10
- import Card from '../Card/Card';
11
- import {
12
- buyOnlineUrl,
13
- deviceInfo,
14
- productPageUrl,
15
- } from '../Device/deviceInfo/deviceInfo';
16
- import { selectedDevice } from '../Device/deviceSlice';
17
- import AboutButton from './AboutButton';
18
- import Section from './Section';
19
-
20
- const memorySize = (memoryInBytes: number) => {
21
- if (memoryInBytes == null) {
22
- return 'Unknown';
23
- }
24
-
25
- return `${memoryInBytes / 1024}KiB`;
26
- };
27
-
28
- export default () => {
29
- const device = useSelector(selectedDevice);
30
-
31
- if (device == null) {
32
- return (
33
- <Card title="Device">
34
- <Section title="No device selected" />
35
- </Card>
36
- );
37
- }
38
-
39
- const pca = device.boardVersion;
40
- const { name, cores } = deviceInfo(device);
41
-
42
- return (
43
- <Card title="Device">
44
- <Section title="Name">{name || 'Unknown'}</Section>
45
- <Section title="ID">{device.serialNumber}</Section>
46
- <Section title="PCA">{pca || 'Unknown'}</Section>
47
- <Section title="Cores">{cores || 'Unknown'}</Section>
48
-
49
- {device.hwInfo && (
50
- <>
51
- <Section title="RAM">
52
- {memorySize(device.hwInfo.ramSize)}
53
- </Section>
54
- <Section title="Flash">
55
- {memorySize(device.hwInfo.romSize)}
56
- </Section>
57
- </>
58
- )}
59
-
60
- <Section>
61
- <AboutButton
62
- url={buyOnlineUrl(device)}
63
- label="Find distributor"
64
- />
65
- </Section>
66
- <Section>
67
- <AboutButton
68
- url={productPageUrl(device)}
69
- label="Go to product page"
70
- />
71
- </Section>
72
- </Card>
73
- );
74
- };
@@ -1,18 +0,0 @@
1
- /*
2
- * Copyright (c) 2021 Nordic Semiconductor ASA
3
- *
4
- * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
- */
6
-
7
- import React from 'react';
8
- import { useSelector } from 'react-redux';
9
-
10
- import Card from '../Card/Card';
11
- import { documentationSections } from './documentationSlice';
12
-
13
- export default () => {
14
- const sections = useSelector(documentationSections);
15
- if (sections.length === 0) return null;
16
-
17
- return <Card title="Documentation">{sections}</Card>;
18
- };