Skip to content

Commit

Permalink
Do not throw if there is no version key, assume it is an old version …
Browse files Browse the repository at this point in the history
…where that was not required
  • Loading branch information
dionjwa committed Nov 30, 2024
1 parent 342e7f8 commit 62432d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/libs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@metapages/metapage",
"public": true,
"version": "1.4.2",
"version": "1.4.3",
"description": "Connect web pages together",
"repository": "https://github.com/metapages/metapage",
"homepage": "https://metapage.io/",
Expand Down
6 changes: 5 additions & 1 deletion app/libs/src/metapage/conversions-metaframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ const convertMetaframeDefinitionToTargetVersionInternal = (
}

if (!def.version) {
throw 'Missing "version" key in metaframe definition';
// we assume this is an older version of the definition
// that does not have the version key
def = create(def, (draft :MetaframeDefinitionV03) => {
draft.version = "0.3";
}) as MetaframeDefinitionV6;
}

let currentVersion = getMatchingMetaframeVersion(def.version);
Expand Down
4 changes: 3 additions & 1 deletion app/libs/src/metapage/conversions-metapage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export const convertMetapageDefinitionToVersion = async (
}

if (!def.version) {
throw 'Missing "version" key in metapage definition';
def = create(def, (draft :MetapageDefinitionV03) => {
draft.version = "0.3";
}) as MetapageDefinitionV03;
}
if (!targetVersion) {
throw 'Missing "version" argument';
Expand Down

0 comments on commit 62432d7

Please sign in to comment.