From 5795c871ae4a1d0810856b813d6352c4b4c6da0d Mon Sep 17 00:00:00 2001 From: FilipZajdel Date: Tue, 30 Apr 2024 15:26:15 +0200 Subject: [PATCH 1/4] index: map each release with compatible nrf-sdk version From now on each add-on release is accompanied with the nRF Connect SDK revision it is compatible with. This removes the `compatibleNcs` array previously utilized for representing similar relationship. Each release needs to be manually announced in the Add-ons index by modifying particular customer's index file. Signed-off-by: FilipZajdel --- README.md | 2 +- index/circuitdojo.json | 9 ++++- index/golioth.json | 45 ++++++++++++++++++++++-- index/nrfconnect.json | 46 +++++++++++++++++++----- index/onomondo.json | 50 ++++++++++++++++++++++++++- resources/output_schema.json | 15 ++++---- resources/schema.json | 10 +----- scripts/generate-index-json.ts | 16 ++------- site/src/app/ReleasesDropDownList.tsx | 1 + site/src/app/filters.ts | 2 +- site/src/sampleData.ts | 2 +- site/src/schema.ts | 25 +++++++++----- 12 files changed, 167 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index a1e4a29..a80f5ec 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Your custom JSON file must include the following information: * `tags` are the tags that will be used to categorize the add-on. * `license` is the license type name. * `apps` is the global pattern to find directories containing add-ons. - * `compatibleNcs` are the nRF Connect SDK's versions the add-on is compatible with. + * `releases` are the add-on versions. Most of the information provided in these entries will be displayed on the add-on index page. For more information about each entry, see `appMetadataSchema` in the `resources/schema.json` file. diff --git a/index/circuitdojo.json b/index/circuitdojo.json index 16a4829..a5c3338 100644 --- a/index/circuitdojo.json +++ b/index/circuitdojo.json @@ -9,7 +9,14 @@ "kind": "sample", "tags": ["lte"], "apps": "samples/*", - "compatibleNcs": ["v2.4.2"] + "releases": [ + { + "date": "2023-12-20T20:37:28Z", + "name": "2.4.x", + "tag": "v2.4.x", + "sdk": "v2.4.1" + } + ] } ] } diff --git a/index/golioth.json b/index/golioth.json index 75d6ed6..bfa0a06 100644 --- a/index/golioth.json +++ b/index/golioth.json @@ -8,7 +8,32 @@ "description": "This starter project is a standalone application that includes databases (both stateful and time-based), Over-the-air update capabilities, settings service, remote procedure calls (RPCs)", "kind": "template", "tags": ["dfu","lte"], - "compatibleNcs": ["v2.3.0", "v2.4.1", "v2.5.0", "v2.5.1"] + "releases": [ + { + "date": "2024-02-21T21:05:15Z", + "name": "Release template_v2.0.0", + "tag": "template_v2.0.0", + "sdk": "2.5.1" + }, + { + "date": "2023-11-08T19:48:02Z", + "name": "Release template_v1.2.0", + "tag": "template_v1.2.0", + "sdk": "2.5.0" + }, + { + "date": "2023-08-18T19:37:19Z", + "name": "Release 1.1.0", + "tag": "template_v1.1.0", + "sdk": "2.4.1" + }, + { + "date": "2023-07-14T20:37:49Z", + "name": "template_v1.0.1", + "tag": "template_v1.0.1", + "sdk": "2.3.0" + } + ] }, { "name": "reference-design-can-asset-tracker", @@ -17,7 +42,14 @@ "kind": "template", "license": "Apache 2.0", "tags": ["dfu","lte"], - "compatibleNcs": ["v2.4.1"] + "releases": [ + { + "date": "2023-09-12T16:46:38Z", + "name": "CAN Asset Tracker RD v1.7.0", + "tag": "v1.7.0", + "sdk": "2.4.1" + } + ] }, { "name": "reference-design-air-quality", @@ -26,7 +58,14 @@ "kind": "template", "license": "Apache 2.0", "tags": ["dfu","lte"], - "compatibleNcs": ["v2.4.1"] + "releases": [ + { + "date": "2023-09-05T17:23:36Z", + "name": "Air Quality Monitor RD v1.2.0", + "tag": "v1.2.0", + "sdk": "2.4.1" + } + ] } ] } diff --git a/index/nrfconnect.json b/index/nrfconnect.json index 8ceec3e..a758b44 100644 --- a/index/nrfconnect.json +++ b/index/nrfconnect.json @@ -9,14 +9,44 @@ "kind": "template", "tags": [], "apps": "app", - "compatibleNcs": [ - "main", - "v2.6.0", - "v2.5.2", - "v2.5.1", - "v2.5.0", - "v2.3.0" - ] + "releases": [ + { + "date": "2024-03-13T14:30:49Z", + "name": "ncs-example-application v2.6.0", + "tag": "v2.6.0", + "sdk": "v2.6.0" + }, + { + "date": "2024-02-01T09:50:12Z", + "name": "ncs-example-application v2.5.2", + "tag": "v2.5.2", + "sdk": "v2.5.2" + }, + { + "date": "2023-12-18T20:37:28Z", + "name": "ncs-example-application v2.5.1", + "tag": "v2.5.1", + "sdk": "v2.5.1" + }, + { + "date": "2023-10-26T13:55:02Z", + "name": "ncs-example-application v2.5.0", + "tag": "v2.5.0", + "sdk": "v2.5.0" + }, + { + "date": "2023-06-01T13:25:38Z", + "name": "ncs-example-application v2.4.0", + "tag": "v2.4.0", + "sdk": "v2.4.0" + }, + { + "date": "2023-03-02T10:45:20Z", + "name": "ncs-example-application v2.3.0", + "tag": "v2.3.0", + "sdk": "v2.3.0" + } + ] } ] } diff --git a/index/onomondo.json b/index/onomondo.json index 8daf8a0..2a0ac1a 100644 --- a/index/onomondo.json +++ b/index/onomondo.json @@ -8,7 +8,55 @@ "kind": "sample", "tags": ["lte"], "apps": "samples/*", - "compatibleNcs": ["v2.5.2"] + "releases": [ + { + "date": "2024-02-20T12:00:50Z", + "name": "v3.0.1", + "tag": "v3.0.1", + "sdk": "2.5.2" + }, + { + "date": "2024-02-08T13:27:49Z", + "name": "v3.0.0", + "tag": "v3.0.0", + "sdk": "2.5.2" + }, + { + "date": "2024-01-30T09:06:14Z", + "name": "v2.2.2", + "tag": "v2.2.2", + "sdk": "2.5.2" + }, + { + "date": "2023-12-14T13:39:57Z", + "name": "v2.2.1", + "tag": "v2.2.1", + "sdk": "2.5.2" + }, + { + "date": "2023-11-14T11:09:52Z", + "name": "v2.2.0", + "tag": "v2.2.0", + "sdk": "2.5.2" + }, + { + "date": "2023-11-06T20:33:30Z", + "name": "v2.1.0", + "tag": "v2.1.0", + "sdk": "2.5.2" + }, + { + "date": "2023-10-30T07:42:31Z", + "name": "v2.0.0", + "tag": "v2.0.0", + "sdk": "2.5.2" + }, + { + "date": "2023-09-29T11:04:31Z", + "name": "v1.0.0", + "tag": "v1.0.0" + } + ] } ] } diff --git a/resources/output_schema.json b/resources/output_schema.json index b38c364..fd7d58e 100644 --- a/resources/output_schema.json +++ b/resources/output_schema.json @@ -153,12 +153,16 @@ "date": { "type": "string", "format": "date" + }, + "sdk": { + "type": "string" } }, "required": [ "tag", "name", - "date" + "date", + "sdk" ], "additionalProperties": false }, @@ -182,12 +186,6 @@ }, "apps": { "type": "string" - }, - "compatibleNcs": { - "type": "array", - "items": { - "type": "string" - } } }, "required": [ @@ -204,8 +202,7 @@ "forks", "defaultBranch", "lastUpdate", - "repo", - "compatibleNcs" + "repo" ], "additionalProperties": false } diff --git a/resources/schema.json b/resources/schema.json index bd5c5f1..2b665f0 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -71,21 +71,13 @@ "apps": { "type": "string", "description": "Glob pattern to find directories containing applications.\n\nApplications need a *.conf file and a CMakeLists.txt file at their root. The glob expressions are used to match directories, so no file pattern is necessary.\n\nBy default, the VS Code extension will assume that there's just a single application sitting at the root of the repo." - }, - "compatibleNcs": { - "type": "array", - "description": "An array of compatible nRF Connect SDK releases.", - "items": { - "type": "string" - } } }, "additionalProperties": false, "required": [ "name", "kind", - "tags", - "compatibleNcs" + "tags" ] }, "description": "A list of applications contributed by the organization." diff --git a/scripts/generate-index-json.ts b/scripts/generate-index-json.ts index 8edde8e..d43e07d 100644 --- a/scripts/generate-index-json.ts +++ b/scripts/generate-index-json.ts @@ -36,7 +36,7 @@ function initialiseGitHubApi() { if (!authToken) { throw new Error( 'No auth token was provided, so you may encounter rate limit issues when calling the GitHub API.\n' + - 'Provide a token by setting the "GITHUB_TOKEN" environment variable.\n', + 'Provide a token by setting the "GITHUB_TOKEN" environment variable.\n', ); } @@ -117,11 +117,6 @@ async function fetchRepoData( repo: app.name, }); - const releases = await octokit.repos.listReleases({ - owner: orgId, - repo: app.name, - }); - const repoUrl = `https://github.com/${orgId}/${app.name}`; console.log(colours.green(`Fetched data for ${orgId}/${app.name}`)); @@ -142,13 +137,8 @@ async function fetchRepoData( stars: repoData.stargazers_count, forks: repoData.forks_count, apps: app.apps, - releases: releases.data.map((release) => ({ - date: release.created_at, - name: release.name ?? release.tag_name, - tag: release.tag_name - })), - tags: app.tags, - compatibleNcs: app.compatibleNcs + releases: app.releases, + tags: app.tags }; } catch { throw new Error(`Failed to fetch data for ${orgId}/${app.name}`); diff --git a/site/src/app/ReleasesDropDownList.tsx b/site/src/app/ReleasesDropDownList.tsx index 3f2f1b4..ebce43a 100644 --- a/site/src/app/ReleasesDropDownList.tsx +++ b/site/src/app/ReleasesDropDownList.tsx @@ -12,6 +12,7 @@ interface Props { }; function ReleasesDropDownList({ app, onReleaseChosen }: Props): JSX.Element { + console.log(app.releases ?? `${app.name} doesn't have releases`) const releases = [{ label: app.defaultBranch, value: app.defaultBranch }, ...app.releases.map((release) => ({ label: release.tag, value: release.tag ?? '' })),]; return ( diff --git a/site/src/app/filters.ts b/site/src/app/filters.ts index 7f522f8..1403b90 100644 --- a/site/src/app/filters.ts +++ b/site/src/app/filters.ts @@ -15,7 +15,7 @@ function filterAppName(apps: NormalisedApp[], search: string): NormalisedApp[] { } function filterNcsVersion(apps: NormalisedApp[], search: string): NormalisedApp[] { - return apps.filter((app) => app.compatibleNcs.some((ncs) => ncs.includes(search))); + return apps.filter((app) => app.releases.some((release) => release?.sdk?.includes(search) )); } export interface Filters { diff --git a/site/src/sampleData.ts b/site/src/sampleData.ts index b1326d9..ee51d3e 100644 --- a/site/src/sampleData.ts +++ b/site/src/sampleData.ts @@ -51,10 +51,10 @@ function createFakeApp(): AppIndex['apps'][number] { name: faker.system.semver(), date: faker.date.recent().toString(), tag: faker.git.branch(), + sdk: faker.system.semver() }), { count: { min: 1, max: 5 } }, ), - compatibleNcs: [faker.git.commitSha()] }; } diff --git a/site/src/schema.ts b/site/src/schema.ts index aa2098d..6bbed05 100644 --- a/site/src/schema.ts +++ b/site/src/schema.ts @@ -93,16 +93,24 @@ export const appMetadataSchema = { "By default, the VS Code extension will assume that there's just a single application sitting at the root of the repo.", ].join('\n\n'), }, - compatibleNcs: { + releases: { type: 'array', items: { - type: 'string' + type: 'object', + properties: { + tag: { type: 'string' }, + name: { type: 'string' }, + date: { type: 'string', format: 'date' }, + sdk: { type: 'string' }, + }, + required: ['tag', 'name', 'date', 'sdk'], + additionalProperties: false, }, - description: 'An array of compatible nRF Connect SDK releases.', + minItems: 1, } }, additionalProperties: false, - required: ['name', 'kind', 'tags', 'compatibleNcs'], + required: ['name', 'kind', 'tags'], } as const satisfies JSONSchema; export const orgIndexSchema = { @@ -177,8 +185,9 @@ export const appSchema = { tag: { type: 'string' }, name: { type: 'string' }, date: { type: 'string', format: 'date' }, + sdk: { type: 'string' }, }, - required: ['tag', 'name', 'date'], + required: ['tag', 'name', 'date', 'sdk'], additionalProperties: false, }, minItems: 1, @@ -188,8 +197,7 @@ export const appSchema = { forks: { type: 'integer' }, defaultBranch: { type: 'string' }, lastUpdate: { type: 'string', format: 'date-time' }, - apps: { type: 'string' }, - compatibleNcs: { type: 'array', items: { type: 'string' } } + apps: { type: 'string' } }, required: [ 'id', @@ -205,8 +213,7 @@ export const appSchema = { 'forks', 'defaultBranch', 'lastUpdate', - 'repo', - 'compatibleNcs' + 'repo' ], additionalProperties: false, } as const satisfies JSONSchema; From 56e39e2cf7aa7abdc2f6b4f99905cf3f05a2c008 Mon Sep 17 00:00:00 2001 From: FilipZajdel Date: Tue, 30 Apr 2024 15:36:14 +0200 Subject: [PATCH 2/4] site: require in the schema Signed-off-by: FilipZajdel --- site/src/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/schema.ts b/site/src/schema.ts index 6bbed05..240cd5f 100644 --- a/site/src/schema.ts +++ b/site/src/schema.ts @@ -110,7 +110,7 @@ export const appMetadataSchema = { } }, additionalProperties: false, - required: ['name', 'kind', 'tags'], + required: ['name', 'kind', 'tags', 'releases'], } as const satisfies JSONSchema; export const orgIndexSchema = { From e04cc5fd8f194bb8f476972ace1895546af24ecb Mon Sep 17 00:00:00 2001 From: FilipZajdel Date: Tue, 30 Apr 2024 15:42:53 +0200 Subject: [PATCH 3/4] schema: add releases to schema Signed-off-by: FilipZajdel --- resources/schema.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/resources/schema.json b/resources/schema.json index 2b665f0..712f11b 100644 --- a/resources/schema.json +++ b/resources/schema.json @@ -68,6 +68,33 @@ "type": "string", "description": "The name of the application license, e.g. \"Apache 2.0\". Inferred from the repo if missing." }, + "releases": { + "type": "array", + "items": { + "type": "object", + "properties": { + "tag": { + "type": "string" + }, + "name": { + "type": "string" + }, + "date": { + "type": "string" + }, + "sdk": { + "type": "string" + } + }, + "required": [ + "tag", + "name", + "date" + ], + "additionalProperties": false + }, + "minItems": 1 + }, "apps": { "type": "string", "description": "Glob pattern to find directories containing applications.\n\nApplications need a *.conf file and a CMakeLists.txt file at their root. The glob expressions are used to match directories, so no file pattern is necessary.\n\nBy default, the VS Code extension will assume that there's just a single application sitting at the root of the repo." From 405cdb7dcfca1fd2dd5eae5681ceeea6e258f5eb Mon Sep 17 00:00:00 2001 From: FilipZajdel Date: Wed, 5 Jun 2024 11:17:35 +0200 Subject: [PATCH 4/4] index: Align all sdk versions to begin with `v` Signed-off-by: FilipZajdel --- index/golioth.json | 12 ++++++------ index/onomondo.json | 17 +++++++++-------- site/src/app/ReleasesDropDownList.tsx | 1 - site/src/schema.ts | 9 +++++---- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/index/golioth.json b/index/golioth.json index bfa0a06..a323ddc 100644 --- a/index/golioth.json +++ b/index/golioth.json @@ -13,25 +13,25 @@ "date": "2024-02-21T21:05:15Z", "name": "Release template_v2.0.0", "tag": "template_v2.0.0", - "sdk": "2.5.1" + "sdk": "v2.5.1" }, { "date": "2023-11-08T19:48:02Z", "name": "Release template_v1.2.0", "tag": "template_v1.2.0", - "sdk": "2.5.0" + "sdk": "v2.5.0" }, { "date": "2023-08-18T19:37:19Z", "name": "Release 1.1.0", "tag": "template_v1.1.0", - "sdk": "2.4.1" + "sdk": "v2.4.1" }, { "date": "2023-07-14T20:37:49Z", "name": "template_v1.0.1", "tag": "template_v1.0.1", - "sdk": "2.3.0" + "sdk": "v2.3.0" } ] }, @@ -47,7 +47,7 @@ "date": "2023-09-12T16:46:38Z", "name": "CAN Asset Tracker RD v1.7.0", "tag": "v1.7.0", - "sdk": "2.4.1" + "sdk": "v2.4.1" } ] }, @@ -63,7 +63,7 @@ "date": "2023-09-05T17:23:36Z", "name": "Air Quality Monitor RD v1.2.0", "tag": "v1.2.0", - "sdk": "2.4.1" + "sdk": "v2.4.1" } ] } diff --git a/index/onomondo.json b/index/onomondo.json index 2a0ac1a..76cec0c 100644 --- a/index/onomondo.json +++ b/index/onomondo.json @@ -13,48 +13,49 @@ "date": "2024-02-20T12:00:50Z", "name": "v3.0.1", "tag": "v3.0.1", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2024-02-08T13:27:49Z", "name": "v3.0.0", "tag": "v3.0.0", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2024-01-30T09:06:14Z", "name": "v2.2.2", "tag": "v2.2.2", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2023-12-14T13:39:57Z", "name": "v2.2.1", "tag": "v2.2.1", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2023-11-14T11:09:52Z", "name": "v2.2.0", "tag": "v2.2.0", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2023-11-06T20:33:30Z", "name": "v2.1.0", "tag": "v2.1.0", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2023-10-30T07:42:31Z", "name": "v2.0.0", "tag": "v2.0.0", - "sdk": "2.5.2" + "sdk": "v2.5.2" }, { "date": "2023-09-29T11:04:31Z", "name": "v1.0.0", - "tag": "v1.0.0" + "tag": "v1.0.0", + "sdk": "v2.4.0" } ] } diff --git a/site/src/app/ReleasesDropDownList.tsx b/site/src/app/ReleasesDropDownList.tsx index ebce43a..3f2f1b4 100644 --- a/site/src/app/ReleasesDropDownList.tsx +++ b/site/src/app/ReleasesDropDownList.tsx @@ -12,7 +12,6 @@ interface Props { }; function ReleasesDropDownList({ app, onReleaseChosen }: Props): JSX.Element { - console.log(app.releases ?? `${app.name} doesn't have releases`) const releases = [{ label: app.defaultBranch, value: app.defaultBranch }, ...app.releases.map((release) => ({ label: release.tag, value: release.tag ?? '' })),]; return ( diff --git a/site/src/schema.ts b/site/src/schema.ts index 240cd5f..e593d4e 100644 --- a/site/src/schema.ts +++ b/site/src/schema.ts @@ -95,13 +95,14 @@ export const appMetadataSchema = { }, releases: { type: 'array', + description: 'The collection of project`s releases.', items: { type: 'object', properties: { - tag: { type: 'string' }, - name: { type: 'string' }, - date: { type: 'string', format: 'date' }, - sdk: { type: 'string' }, + tag: { type: 'string', description: 'Git tag of the released version.' }, + name: { type: 'string', description: 'The title of the release.' }, + date: { type: 'string', format: 'date', description: 'The date of publishing the release.' }, + sdk: { type: 'string', description: 'The nRF Connect SDK version the release is compatible with.' }, }, required: ['tag', 'name', 'date', 'sdk'], additionalProperties: false,