🐛 Fix validation issues with dtcg-node schema

This commit is contained in:
Andrey Antukh
2025-11-12 10:20:16 +01:00
parent ef271db879
commit d706bb7c8d
5 changed files with 61 additions and 11 deletions

View File

@@ -1,6 +1,11 @@
# CHANGELOG
## 1.1.0-RC1
## 1.1.0-RC2
- Fix validation issue with several token nodes
## 1.1.0-RC2
- Add experimental addTokensLib method

View File

@@ -1,6 +1,6 @@
{
"name": "@penpot/library",
"version": "1.1.0-RC1",
"version": "1.1.0-RC2",
"license": "MPL-2.0",
"author": "Kaleidos INC",
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f",

View File

@@ -0,0 +1,21 @@
{
"Global": {
"font-1": {
"$value": [
"Abel"
],
"$type": "fontFamilies",
"$description": ""
}
},
"$themes": [],
"$metadata": {
"tokenSetOrder": [
"Global"
],
"activeThemes": [],
"activeSets": [
"Global"
]
}
}

View File

@@ -149,6 +149,27 @@ test("create context with tokens lib as json", () => {
assert.ok(file.data.tokensLib)
});
test("create context with tokens lib as json 2", () => {
const context = penpot.createBuildContext();
const fileId = context.addFile({name: "file 1"});
const pageId = context.addPage({name: "page 1"});
const tokensFilePath = path.join(__dirname, "_tokens-2.json");
const tokens = fs.readFileSync(tokensFilePath, "utf8");
context.addTokensLib(tokens);
const internalState = context.getInternalState();
const file = internalState.files[fileId];
assert.ok(file, "file should exist");
assert.ok(file.data);
assert.ok(file.data.tokensLib)
});
test("create context with tokens lib as obj", () => {
const context = penpot.createBuildContext();