Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index: map each release with compatible nrf-sdk version #43

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion index/circuitdojo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
FilipZajdel marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
]
}
45 changes: 42 additions & 3 deletions index/golioth.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "v2.5.1"
},
{
"date": "2023-11-08T19:48:02Z",
"name": "Release template_v1.2.0",
"tag": "template_v1.2.0",
"sdk": "v2.5.0"
},
{
"date": "2023-08-18T19:37:19Z",
"name": "Release 1.1.0",
"tag": "template_v1.1.0",
"sdk": "v2.4.1"
},
{
"date": "2023-07-14T20:37:49Z",
"name": "template_v1.0.1",
"tag": "template_v1.0.1",
"sdk": "v2.3.0"
}
]
},
{
"name": "reference-design-can-asset-tracker",
Expand All @@ -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": "v2.4.1"
}
]
},
{
"name": "reference-design-air-quality",
Expand All @@ -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": "v2.4.1"
}
]
}
]
}
46 changes: 38 additions & 8 deletions index/nrfconnect.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
]
}
51 changes: 50 additions & 1 deletion index/onomondo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,56 @@
"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": "v2.5.2"
},
{
"date": "2024-02-08T13:27:49Z",
"name": "v3.0.0",
"tag": "v3.0.0",
"sdk": "v2.5.2"
},
{
"date": "2024-01-30T09:06:14Z",
"name": "v2.2.2",
"tag": "v2.2.2",
"sdk": "v2.5.2"
},
{
"date": "2023-12-14T13:39:57Z",
"name": "v2.2.1",
"tag": "v2.2.1",
"sdk": "v2.5.2"
},
{
"date": "2023-11-14T11:09:52Z",
"name": "v2.2.0",
"tag": "v2.2.0",
"sdk": "v2.5.2"
},
{
"date": "2023-11-06T20:33:30Z",
"name": "v2.1.0",
"tag": "v2.1.0",
"sdk": "v2.5.2"
},
{
"date": "2023-10-30T07:42:31Z",
"name": "v2.0.0",
"tag": "v2.0.0",
"sdk": "v2.5.2"
},
{
"date": "2023-09-29T11:04:31Z",
"name": "v1.0.0",
"tag": "v1.0.0",
"sdk": "v2.4.0"
}
]
}
]
}
15 changes: 6 additions & 9 deletions resources/output_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@
"date": {
"type": "string",
"format": "date"
},
"sdk": {
"type": "string"
}
},
"required": [
"tag",
"name",
"date"
"date",
"sdk"
FilipZajdel marked this conversation as resolved.
Show resolved Hide resolved
],
"additionalProperties": false
},
Expand All @@ -182,12 +186,6 @@
},
"apps": {
"type": "string"
},
"compatibleNcs": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
Expand All @@ -204,8 +202,7 @@
"forks",
"defaultBranch",
"lastUpdate",
"repo",
"compatibleNcs"
"repo"
],
"additionalProperties": false
}
Expand Down
37 changes: 28 additions & 9 deletions resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,43 @@
"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."
},
"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."
Expand Down
16 changes: 3 additions & 13 deletions scripts/generate-index-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
}

Expand Down Expand Up @@ -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}`));
Expand All @@ -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}`);
Expand Down
2 changes: 1 addition & 1 deletion site/src/app/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion site/src/sampleData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
};
}

Expand Down
Loading
Loading