@nordicsemiconductor/nrf-jlink-js 0.12.0 → 0.13.1
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/LICENSE +9 -6
- package/README.md +5 -4
- package/dist/jlink.d.ts +4 -1
- package/dist/jlink.js +51 -6
- package/dist/shared/jLinkVersion.js +19 -1
- package/package.json +2 -1
- package/LICENSE.2 +0 -38
package/LICENSE
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
LicenseID:
|
|
1
|
+
LicenseID: LicenseRef-Nordic-4-Clause
|
|
2
2
|
|
|
3
3
|
ExtractedText: <text>
|
|
4
4
|
|
|
5
|
-
Copyright (c) 2025 Nordic Semiconductor ASA
|
|
5
|
+
Copyright (c) 2025 Nordic Semiconductor ASA
|
|
6
|
+
All rights reserved.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
Use in source and binary forms, redistribution in binary form only, with
|
|
10
|
+
or without modification, are permitted provided that the following conditions
|
|
11
|
+
are met:
|
|
10
12
|
|
|
11
13
|
1. Redistributions in binary form, except as embedded into a Nordic
|
|
12
14
|
Semiconductor ASA integrated circuit in a product or a software update for
|
|
@@ -33,4 +35,5 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
33
35
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
34
36
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
35
37
|
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
36
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
38
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
39
|
+
</text>
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# nrf-jlink-js
|
|
2
2
|
|
|
3
|
-
`nrf-jlink-js` is a Node.js module to check and install the recommended JLink
|
|
3
|
+
`nrf-jlink-js` is a Node.js module to check and install the recommended JLink
|
|
4
|
+
version used by some products of Nordic Semiconductor ASA.
|
|
4
5
|
|
|
5
6
|
## Installation
|
|
6
7
|
|
|
@@ -11,9 +12,9 @@ npm install @nordicsemiconductor/nrf-jlink-js
|
|
|
11
12
|
## Usage
|
|
12
13
|
|
|
13
14
|
```js
|
|
14
|
-
const {
|
|
15
|
+
const { status } = await getJLinkState();
|
|
15
16
|
|
|
16
|
-
if (
|
|
17
|
-
downloadAndInstallJlink(console.log)
|
|
17
|
+
if (status === 'should be updated') {
|
|
18
|
+
downloadAndInstallJlink(console.log);
|
|
18
19
|
}
|
|
19
20
|
```
|
package/dist/jlink.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { OnUpdate } from './shared/update';
|
|
2
|
-
export declare const downloadAndSaveJLink: (destinationDir: string, destinationFileName?: string, onUpdate?: OnUpdate) => Promise<
|
|
2
|
+
export declare const downloadAndSaveJLink: (destinationDir: string, destinationFileName?: string, onUpdate?: OnUpdate) => Promise<{
|
|
3
|
+
version: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
}>;
|
|
3
6
|
export declare const downloadAndInstallJLink: (onUpdate?: OnUpdate) => Promise<void>;
|
package/dist/jlink.js
CHANGED
|
@@ -4,20 +4,65 @@
|
|
|
4
4
|
*
|
|
5
5
|
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
6
6
|
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
17
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
18
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
19
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
20
|
+
function step(op) {
|
|
21
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
22
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
23
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
24
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
25
|
+
switch (op[0]) {
|
|
26
|
+
case 0: case 1: t = op; break;
|
|
27
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
28
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
29
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
30
|
+
default:
|
|
31
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
32
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
33
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
34
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
35
|
+
if (t[2]) _.ops.pop();
|
|
36
|
+
_.trys.pop(); continue;
|
|
37
|
+
}
|
|
38
|
+
op = body.call(thisArg, _);
|
|
39
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
40
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
7
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
44
|
exports.downloadAndInstallJLink = exports.downloadAndSaveJLink = void 0;
|
|
9
45
|
var fetchIndex_1 = require("./operations/fetchIndex");
|
|
10
46
|
var downloadJLink_1 = require("./operations/downloadJLink");
|
|
11
47
|
var installJLink_1 = require("./operations/installJLink");
|
|
12
|
-
var downloadAndSaveJLink = function (destinationDir, destinationFileName, onUpdate) {
|
|
13
|
-
|
|
14
|
-
|
|
48
|
+
var downloadAndSaveJLink = function (destinationDir, destinationFileName, onUpdate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var index, fileName;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0: return [4 /*yield*/, (0, fetchIndex_1.fetchIndex)()];
|
|
53
|
+
case 1:
|
|
54
|
+
index = _a.sent();
|
|
55
|
+
return [4 /*yield*/, (0, downloadJLink_1.downloadJLink)(index, onUpdate, destinationDir, destinationFileName)];
|
|
56
|
+
case 2:
|
|
57
|
+
fileName = _a.sent();
|
|
58
|
+
return [2 /*return*/, { version: index.version, fileName: fileName }];
|
|
59
|
+
}
|
|
15
60
|
});
|
|
16
|
-
};
|
|
61
|
+
}); };
|
|
17
62
|
exports.downloadAndSaveJLink = downloadAndSaveJLink;
|
|
18
63
|
var downloadAndInstallJLink = function (onUpdate) {
|
|
19
64
|
return (0, fetchIndex_1.fetchIndex)()
|
|
20
|
-
.then(function (
|
|
21
|
-
.then(function (
|
|
65
|
+
.then(function (index) { return (0, downloadJLink_1.downloadJLink)(index, onUpdate); })
|
|
66
|
+
.then(function (fileName) { return (0, installJLink_1.installJLink)(fileName, onUpdate); });
|
|
22
67
|
};
|
|
23
68
|
exports.downloadAndInstallJLink = downloadAndInstallJLink;
|
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
*
|
|
5
5
|
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
6
6
|
*/
|
|
7
|
+
var __assign = (this && this.__assign) || function () {
|
|
8
|
+
__assign = Object.assign || function(t) {
|
|
9
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10
|
+
s = arguments[i];
|
|
11
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12
|
+
t[p] = s[p];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
7
18
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
19
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
20
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -147,6 +158,11 @@ var isValidVersion = function (installedVersion, expectedVersion) {
|
|
|
147
158
|
return semver_1.default.gte(convertToSemverVersion(installedVersion), convertToSemverVersion(expectedVersion));
|
|
148
159
|
};
|
|
149
160
|
exports.isValidVersion = isValidVersion;
|
|
161
|
+
var getEnv = function () {
|
|
162
|
+
if (process.platform !== 'darwin')
|
|
163
|
+
return undefined;
|
|
164
|
+
return __assign(__assign({}, process.env), { PATH: "".concat(process.env.PATH, ":/usr/local/bin") });
|
|
165
|
+
};
|
|
150
166
|
var getInstalledJLinkVersion = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
167
|
var env_1, scriptFile, output, versionRegExp, match, e_1;
|
|
152
168
|
var _a;
|
|
@@ -158,7 +174,9 @@ var getInstalledJLinkVersion = function () { return __awaiter(void 0, void 0, vo
|
|
|
158
174
|
case 1:
|
|
159
175
|
_b.trys.push([1, 3, 4, 5]);
|
|
160
176
|
scriptFile = __addDisposableResource(env_1, (0, fs_2.createTemporaryScriptFile)('Exit'), false);
|
|
161
|
-
return [4 /*yield*/, (0, util_1.promisify)(child_process_1.exec)("".concat(getJLinkExePath(), " -CommandFile ").concat(scriptFile.filePath)
|
|
177
|
+
return [4 /*yield*/, (0, util_1.promisify)(child_process_1.exec)("".concat(getJLinkExePath(), " -CommandFile ").concat(scriptFile.filePath), {
|
|
178
|
+
env: getEnv()
|
|
179
|
+
}).catch(function (e) { return e; })];
|
|
162
180
|
case 2:
|
|
163
181
|
output = _b.sent();
|
|
164
182
|
versionRegExp = /^SEGGER J-Link Commander V([0-9a-z.]+) .*$/m;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordicsemiconductor/nrf-jlink-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"main": "dist",
|
|
5
5
|
"types": "dist",
|
|
6
6
|
"files": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"semver": "^7.7.2"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
+
"prepare": "npm run build",
|
|
13
14
|
"build": "tsc",
|
|
14
15
|
"upload-jlink": "ts-node scripts/upload-jlink.ts"
|
|
15
16
|
},
|
package/LICENSE.2
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
LicenseID: LicenseRef-Nordic-4-Clause
|
|
2
|
-
|
|
3
|
-
ExtractedText: <text>
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2025 Nordic Semiconductor ASA
|
|
6
|
-
All rights reserved.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Use in source and binary forms, redistribution in binary form only, with
|
|
10
|
-
or without modification, are permitted provided that the following conditions
|
|
11
|
-
are met:
|
|
12
|
-
|
|
13
|
-
1. Redistributions in binary form, except as embedded into a Nordic
|
|
14
|
-
Semiconductor ASA integrated circuit in a product or a software update for
|
|
15
|
-
such product, must reproduce the above copyright notice, this list of
|
|
16
|
-
conditions and the following disclaimer in the documentation and/or other
|
|
17
|
-
materials provided with the distribution.
|
|
18
|
-
|
|
19
|
-
2. Neither the name of Nordic Semiconductor ASA nor the names of its
|
|
20
|
-
contributors may be used to endorse or promote products derived from this
|
|
21
|
-
software without specific prior written permission.
|
|
22
|
-
|
|
23
|
-
3. This software, with or without modification, must only be used with a Nordic
|
|
24
|
-
Semiconductor ASA integrated circuit.
|
|
25
|
-
|
|
26
|
-
4. Any software provided in binary form under this license must not be reverse
|
|
27
|
-
engineered, decompiled, modified and/or disassembled.
|
|
28
|
-
|
|
29
|
-
THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR
|
|
30
|
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
31
|
-
MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
32
|
-
DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE
|
|
33
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
34
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
35
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
36
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
37
|
-
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
38
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|