-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add versioning to sources.json #1069
Conversation
sources-versioned.json is not used, this will be added in the next commit.
Replacing the old sources.json
const isLegacyUrl = url.endsWith('/apps.json') && sourceJson.apps == null; | ||
if (isLegacyUrl) { | ||
return downloadSource(url.replace(/apps\.json$/, 'source.json')); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I get the intention here, but why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost two years after we switched from using apps.json
to source.json
files, I consider this code to be unneeded and wanted to clean up by removing it.
The only case when it would still be used, would be if someone would add a URL like https://developer.nordicsemi.com/.pc-tools/nrfconnect-apps/test/apps.json (instead of …/source.json) in the dialog to add a source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from a question I posted this looks nice and clean to me!
For NCD-1128:
Effect of this change
Before we had an used a file
sources.json
which looked like this:This change introduces that instead a
sources-versioned.json
is used instead, which will look like this:If an existing
sources.json
is found it is left untouched but the content is migrated to a newsources-versioned.json
. If ansources-versioned.json
is found, no migration is done. If neither asources.json
nor asources-versioned.json
is found, a newsources-versioned.json
is created.After the migration, only the contents of
sources-versioned.json
are used, any existingsources.json
is ignored.Motivation
With the move to Artifactory, I want to extend
sources-versioned.json
so that it can look like this:The idea is, that new versions of the launcher can use the new version
v2
in this file, while old versions of the launcher can continue to use the old information.It already would have been helpful and simplified the code if we had done a change like this when switching to using the new app meta data in #804. But now it is helpful too and if it already was helpful twice it might prove to be helpful again in the future.
Schema validation
Besides the migration to
sources-versioned.json
this change also adds schema validation tosource.json
. So the contents of all JSON files that are read of written there are also validated withzod
.