@nordicsemiconductor/pc-nrfconnect-shared 198.0.0 → 200.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 +12 -0
- package/ipc/MetaFiles.ts +1 -0
- package/package.json +4 -1
- package/scripts/create-source.ts +78 -0
- package/scripts/nordic-publish.js +7 -8
- package/scripts/nordic-publish.ts +16 -65
- package/typings/generated/ipc/MetaFiles.d.ts +3 -0
- package/typings/generated/ipc/MetaFiles.d.ts.map +1 -1
- package/typings/generated/ipc/schema/packageJson.d.ts +6 -6
- package/typings/generated/scripts/create-source.d.ts +3 -0
- package/typings/generated/scripts/create-source.d.ts.map +1 -0
- package/typings/generated/src/utils/packageJson.d.ts +2 -2
package/Changelog.md
CHANGED
|
@@ -7,6 +7,18 @@ 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
|
+
## 200.0.0 - 2025-02-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Wrong URL when publishing to Artifactory.
|
|
15
|
+
|
|
16
|
+
## 199.0.0 - 2025-02-20
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- `nordic-publish.ts` deleted the description of a source.
|
|
21
|
+
|
|
10
22
|
## 198.0.0 - 2025-02-12
|
|
11
23
|
|
|
12
24
|
### Added
|
package/ipc/MetaFiles.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordicsemiconductor/pc-nrfconnect-shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "200.0.0",
|
|
4
4
|
"description": "Shared commodities for developing pc-nrfconnect-* packages",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -125,6 +125,9 @@
|
|
|
125
125
|
"zod": "^3.22.2",
|
|
126
126
|
"zod-validation-error": "^1.5.0"
|
|
127
127
|
},
|
|
128
|
+
"devDependencies": {
|
|
129
|
+
"@commander-js/extra-typings": "^10.0.3"
|
|
130
|
+
},
|
|
128
131
|
"typings": "./typings/generated/src/index.d.ts",
|
|
129
132
|
"eslintConfig": {
|
|
130
133
|
"extends": "./config/eslintrc"
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2025 Nordic Semiconductor ASA
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Command, Option } from '@commander-js/extra-typings';
|
|
10
|
+
|
|
11
|
+
import { SourceJson } from '../ipc/MetaFiles';
|
|
12
|
+
|
|
13
|
+
const fail = (message: string) => {
|
|
14
|
+
console.error(message);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (process.env.ARTIFACTORY_TOKEN == null)
|
|
19
|
+
fail('The environment variable ARTIFACTORY_TOKEN must be set.');
|
|
20
|
+
const headers = { Authorization: `Bearer ${process.env.ARTIFACTORY_TOKEN}` };
|
|
21
|
+
|
|
22
|
+
const validAccessLevels = [
|
|
23
|
+
'external',
|
|
24
|
+
'external-confidential',
|
|
25
|
+
'internal',
|
|
26
|
+
'internal-confidential',
|
|
27
|
+
] as const;
|
|
28
|
+
|
|
29
|
+
const parseOptions = () =>
|
|
30
|
+
new Command()
|
|
31
|
+
.description('Create a new source in Artifactory')
|
|
32
|
+
.requiredOption('-i, --id <id>', 'Source id, e.g. release-test')
|
|
33
|
+
.addOption(
|
|
34
|
+
new Option('-a, --access-level <access level>', 'Access level')
|
|
35
|
+
.choices(validAccessLevels)
|
|
36
|
+
.makeOptionMandatory()
|
|
37
|
+
)
|
|
38
|
+
.requiredOption('-n, --name <name>', 'Name, e.g. "Release Test"')
|
|
39
|
+
.requiredOption(
|
|
40
|
+
'-d, --description <description>',
|
|
41
|
+
'Longer description, e.g. "Versions we intend to release next"'
|
|
42
|
+
)
|
|
43
|
+
.parse()
|
|
44
|
+
.opts();
|
|
45
|
+
|
|
46
|
+
type Options = ReturnType<typeof parseOptions>;
|
|
47
|
+
|
|
48
|
+
const url = (opts: Options) =>
|
|
49
|
+
`https://files.nordicsemi.com/artifactory/swtools/${opts.accessLevel}/ncd/apps/${opts.id}/source.json`;
|
|
50
|
+
|
|
51
|
+
const assertSourceDoesNotExist = async (opts: Options) => {
|
|
52
|
+
const get = await fetch(url(opts), { headers });
|
|
53
|
+
if (get.ok) fail(`Source ${url(opts)} already exists`);
|
|
54
|
+
|
|
55
|
+
// TODO: Check that no other source with the same name exists
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const uploadSourceJson = async (opts: Options) => {
|
|
59
|
+
const source: SourceJson = {
|
|
60
|
+
name: opts.name,
|
|
61
|
+
description: opts.description,
|
|
62
|
+
apps: [],
|
|
63
|
+
};
|
|
64
|
+
const put = await fetch(url(opts), {
|
|
65
|
+
method: 'PUT',
|
|
66
|
+
body: JSON.stringify(source, null, 2),
|
|
67
|
+
headers,
|
|
68
|
+
});
|
|
69
|
+
if (!put.ok) fail(`Failed to upload ${url}: ${put.statusText}`);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const main = async () => {
|
|
73
|
+
const opts = parseOptions();
|
|
74
|
+
|
|
75
|
+
await assertSourceDoesNotExist(opts);
|
|
76
|
+
await uploadSourceJson(opts);
|
|
77
|
+
};
|
|
78
|
+
main();
|