@nordicsemiconductor/pc-nrfconnect-shared 263.0.0 → 264.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 +59 -25
- package/config/tsconfig.json +2 -2
- package/config/versions.test.ts +115 -0
- package/config/versions.ts +53 -0
- package/dist/scripts/nordic-publish.js +21 -19
- package/dist/typings/config/versions.d.ts +17 -0
- package/dist/typings/config/versions.d.ts.map +1 -0
- package/dist/typings/ipc/device.d.ts +1 -1
- package/dist/typings/ipc/schema/packageJson.d.ts +9 -9
- package/dist/typings/scripts/check-app-properties.d.ts.map +1 -1
- package/dist/typings/scripts/esbuild-renderer.d.ts +2 -1
- package/dist/typings/scripts/esbuild-renderer.d.ts.map +1 -1
- package/dist/typings/scripts/set-minimal-launcher.d.ts +3 -0
- package/dist/typings/scripts/set-minimal-launcher.d.ts.map +1 -0
- package/dist/typings/src/utils/packageJson.d.ts +2 -2
- package/ipc/device.ts +1 -1
- package/package.json +8 -3
- package/release_notes.md +29 -1
- package/scripts/build-app.ts +16 -3
- package/scripts/build-shared.ts +2 -1
- package/scripts/check-app-properties.ts +38 -4
- package/scripts/check-versions.ts +53 -39
- package/scripts/esbuild-renderer.ts +9 -4
- package/scripts/set-minimal-launcher.ts +153 -0
- package/src/Device/deviceInfo/deviceInfo.ts +2 -2
- package/dist/typings/scripts/versions.d.ts +0 -5
- package/dist/typings/scripts/versions.d.ts.map +0 -1
- package/scripts/versions.ts +0 -12
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2026 Nordic Semiconductor ASA
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { green, red } from 'chalk';
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import { readFileSync } from 'fs';
|
|
12
|
+
import semver from 'semver';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
minimalLauncherVersion,
|
|
16
|
+
versionsForLauncherVersion,
|
|
17
|
+
} from '../config/versions';
|
|
18
|
+
import { type PackageJsonApp } from '../ipc/schema/packageJson';
|
|
19
|
+
|
|
20
|
+
const packageJson: PackageJsonApp = JSON.parse(
|
|
21
|
+
readFileSync('./package.json', 'utf-8'),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const info = (message: string) => console.log(`${green('➜')} ${message}`);
|
|
25
|
+
|
|
26
|
+
function fail(message: string): never {
|
|
27
|
+
console.error(`${red('x')} ${message}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const npm = (args: string, { showOutput = false } = {}) =>
|
|
32
|
+
execSync(`npm ${args}`, {
|
|
33
|
+
encoding: 'utf-8',
|
|
34
|
+
stdio: ['ignore', showOutput ? 'inherit' : 'pipe', 'inherit'],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const assertCurrentLauncherVersionIsValid = () => {
|
|
38
|
+
const currentLauncherVersion = packageJson.engines?.nrfconnect;
|
|
39
|
+
|
|
40
|
+
if (currentLauncherVersion == null) {
|
|
41
|
+
fail(
|
|
42
|
+
'The property `engines.nrfconnect` must already be defined in package.json.',
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (semver.minVersion(currentLauncherVersion)?.version == null) {
|
|
47
|
+
fail(
|
|
48
|
+
`Unable to determine a launcher version from \`engines.nrfconnect\` being '${currentLauncherVersion}'.`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const currentLauncherVersion = () => {
|
|
54
|
+
assertCurrentLauncherVersionIsValid();
|
|
55
|
+
|
|
56
|
+
// Type assertion in the next line is safe because we have already validated it above.
|
|
57
|
+
return semver.minVersion(packageJson.engines.nrfconnect)?.version as string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const newLauncherVersion = () =>
|
|
61
|
+
semver.valid(requestedLauncherVersion) ?? currentLauncherVersion();
|
|
62
|
+
|
|
63
|
+
const maybePrintUsageAndExit = () => {
|
|
64
|
+
if (
|
|
65
|
+
requestedLauncherVersion == null ||
|
|
66
|
+
semver.valid(requestedLauncherVersion)
|
|
67
|
+
) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
console.log(`Usage: set-minimal-launcher [version]
|
|
72
|
+
|
|
73
|
+
Sets the minimal launcher version the app requires and installs the matching
|
|
74
|
+
Electron version as a dev dependency.
|
|
75
|
+
|
|
76
|
+
Arguments:
|
|
77
|
+
version Minimal launcher version, e.g. 5.2.1. Sets \`engines.nrfconnect\`
|
|
78
|
+
in package.json to \`>=<version>\`. If omitted, the version
|
|
79
|
+
already in \`engines.nrfconnect\` is used.
|
|
80
|
+
|
|
81
|
+
Options:
|
|
82
|
+
-h, --help Print this help message.`);
|
|
83
|
+
|
|
84
|
+
const askedForHelp =
|
|
85
|
+
process.argv.includes('-h') || process.argv.includes('--help');
|
|
86
|
+
process.exit(askedForHelp ? 0 : 1);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const setLauncherInPackageJson = () => {
|
|
90
|
+
if (semver.lt(newLauncherVersion(), minimalLauncherVersion)) {
|
|
91
|
+
fail(
|
|
92
|
+
`This version of shared requires at least launcher version ${minimalLauncherVersion} but the launcher version ${newLauncherVersion()} was requested.`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (requestedLauncherVersion == null) {
|
|
97
|
+
info(
|
|
98
|
+
`Using launcher version ${currentLauncherVersion()} from \`engines.nrfconnect\` in package.json.`,
|
|
99
|
+
);
|
|
100
|
+
} else if (currentLauncherVersion() === newLauncherVersion()) {
|
|
101
|
+
info(
|
|
102
|
+
`\`engines.nrfconnect\` in package.json is already '${newLauncherVersion()}'.`,
|
|
103
|
+
);
|
|
104
|
+
} else {
|
|
105
|
+
npm(`pkg set engines.nrfconnect=">=${newLauncherVersion()}"`);
|
|
106
|
+
info(
|
|
107
|
+
`Changed \`engines.nrfconnect\` in package.json from '${currentLauncherVersion()}' to '${newLauncherVersion()}'.`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const currentElectronVersion = () => packageJson.devDependencies?.electron;
|
|
113
|
+
|
|
114
|
+
const newElectronVersion = () => {
|
|
115
|
+
try {
|
|
116
|
+
return versionsForLauncherVersion(newLauncherVersion()).electron;
|
|
117
|
+
} catch {
|
|
118
|
+
fail(
|
|
119
|
+
`Unable to determine Electron version for launcher version '${newLauncherVersion()}'.`,
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const installElectron = () => {
|
|
125
|
+
if (currentElectronVersion() === newElectronVersion()) {
|
|
126
|
+
info(
|
|
127
|
+
`Electron ${newElectronVersion()} is already installed as a dev dependency.`,
|
|
128
|
+
);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
info(
|
|
133
|
+
`Installing Electron ${newElectronVersion()} as a dev dependency (before: ${currentElectronVersion() ?? 'none'}).`,
|
|
134
|
+
);
|
|
135
|
+
npm(`install --save-dev --save-exact electron@${newElectronVersion()}`, {
|
|
136
|
+
showOutput: true,
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const main = () => {
|
|
141
|
+
maybePrintUsageAndExit();
|
|
142
|
+
|
|
143
|
+
assertCurrentLauncherVersionIsValid();
|
|
144
|
+
|
|
145
|
+
setLauncherInPackageJson();
|
|
146
|
+
installElectron();
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const requestedLauncherVersion: string | undefined = process.argv[2];
|
|
150
|
+
const isRanAsAScript = require.main === module; // https://nodejs.org/docs/latest/api/modules.html#accessing-the-main-module
|
|
151
|
+
if (isRanAsAScript) {
|
|
152
|
+
main();
|
|
153
|
+
}
|
|
@@ -229,7 +229,7 @@ const devicesByPca: { [P in KnownDevicePCA]: DeviceInfo } = {
|
|
|
229
229
|
icon: nrf91logo,
|
|
230
230
|
website: {},
|
|
231
231
|
},
|
|
232
|
-
|
|
232
|
+
PCA20065: {
|
|
233
233
|
name: 'Nordic Thingy:91 X',
|
|
234
234
|
cores: 1,
|
|
235
235
|
icon: nrf91logo,
|
|
@@ -403,7 +403,7 @@ const deviceByUsb = (device: Device) => {
|
|
|
403
403
|
return devicesByPca.PCA20053;
|
|
404
404
|
}
|
|
405
405
|
if (device.serialNumber?.startsWith('THINGY91X')) {
|
|
406
|
-
return devicesByPca.
|
|
406
|
+
return devicesByPca.PCA20065;
|
|
407
407
|
}
|
|
408
408
|
if (device.serialNumber?.startsWith('THINGY91')) {
|
|
409
409
|
return devicesByPca.PCA20035;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../scripts/versions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,WAAW,CAAC;AACjC,eAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,eAAO,MAAM,IAAI,YAAY,CAAC;AAG9B,eAAO,MAAM,gBAAgB,eAAe,CAAC"}
|
package/scripts/versions.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const electron = '43.8.6';
|
|
8
|
-
export const chrome = '150.0.7871.250';
|
|
9
|
-
export const node = '24.22.1';
|
|
10
|
-
|
|
11
|
-
// Chrome from Electron 32, used in launcher >=5.1.0, <5.4.0
|
|
12
|
-
export const chromeToBuildFor = '128.0.6613';
|