Skip to content

Commit

Permalink
[cascading] from release/11.1.0-rc to main (#2041)
Browse files Browse the repository at this point in the history
<!--
{"currentBranch":"release/11.1.0-rc","targetBranch":"main","bypassReviewers":true,"isConflicting":false}
-->

## Cascading from release/11.1.0-rc to main

The configuration requests the cascading to bypass reviewer in case of
CI success.
To not bypass the reviewing process, please check the following
checkbox:

- [ ] <!-- !cancel bypass! --> 🚫 stop reviewing process
bypass for this Pull Request

---

<small>This Pull Request has been generated with ❤️ by the
[Otter](https://github.com/AmadeusITGroup/otter) cascading tool.</small>
  • Loading branch information
kpanot authored Aug 8, 2024
2 parents 9080c30 + 4d0544a commit 82e6cc4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 24 deletions.
28 changes: 7 additions & 21 deletions packages/@o3r/design/schemas/design-token.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
}
},
"extensions": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/otterExtension"
Expand Down Expand Up @@ -190,16 +189,12 @@
}
},
"tokenTypeFontFamily": {
"type": "object",
"required": [
"$type",
"primary"
],
"allOf": [
{
"oneOf": [
{
"type": "object",
"required": ["$value"],
"properties": {
"$value": {
"type": "string"
Expand Down Expand Up @@ -238,6 +233,9 @@
},
{
"type": "object",
"required": [
"$type"
],
"properties": {
"$type": {
"const": "fontFamily",
Expand All @@ -257,9 +255,7 @@
"type": "string",
"pattern": "^.*\\{.*\\}.*$"
},
"$type": {
"not": {}
}
"$type": false
}
},
"tokenTypeDuration": {
Expand Down Expand Up @@ -303,14 +299,7 @@
}
},
"tokenTypeFontWeightValue": {
"oneOf": [
{
"type": "number"
},
{
"type": "string"
}
]
"type": ["string", "number"]
},
"tokenTypeFontWeight": {
"type": "object",
Expand Down Expand Up @@ -599,10 +588,7 @@
"$ref": "#/definitions/tokenTypeFontWeightValue"
},
"lineHeight": {
"oneOf": [
{ "type": "string" },
{ "type": "number" }
]
"type": ["string", "number"]
}
},
"required": [
Expand Down
2 changes: 1 addition & 1 deletion packages/@o3r/design/schematics/index.it.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('new otter application with Design', () => {
const diff = getGitDiff(workspacePath);
expect(diff.modified).toContain('package.json');
expect(diff.modified).toContain('angular.json');
expect(diff.added).toContain(path.posix.join('apps', appName, 'src/style/design-token.custom.json'));
expect(diff.added).toContain(path.posix.join('apps', appName, 'src/style/design-token.custom.theme.json'));
expect(diff.added).toContain(path.posix.join('apps', appName, 'src/style/theme.scss'));
expect(diff.added).toContain(path.posix.join('apps', appName, 'design-token.template.json'));

Expand Down
2 changes: 1 addition & 1 deletion packages/@o3r/design/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('ng-add', () => {
projectName: 'test-project'
}, initialTree);

expect(tree.exists('src/style/design-token.custom.json')).toBe(true);
expect(tree.exists('src/style/design-token.custom.theme.json')).toBe(true);
expect(tree.exists('design-token.template.json')).toBe(true);
expect(tree.exists('src/style/theme.scss')).toBe(true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ describe('Design Token Parser', () => {

describe('parseDesignToken', () => {

test('should support single root key', () => {
const result = parser.parseDesignToken({
document: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'my.variable': {
$value: '{external}'
}
}
});
const var1 = result.get('my.variable');
const var2 = result.get('.my.variable');

expect(result.size).toBe(1);
expect(var2).not.toBeDefined();
expect(var1).toBeDefined();
expect(var1.getKey()).toBe('my-variable');
});

test('should generate a simple type variable', () => {
const result = parser.parseDesignToken(exampleVariable);
const var1 = result.get('example.var1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { dirname } from 'node:path';

const tokenReferenceRegExp = /\{([^}]+)\}/g;

const getTokenReferenceName = (tokenName: string, parents: string[]) => (`${parents.join('.')}.${tokenName}`);
const getTokenReferenceName = (tokenName: string, parents: string[]) => parents.join('.') + (parents.length ? '.' : '') + tokenName;
const getExtensions = (nodes: NodeReference[], context: DesignTokenContext | undefined) => {
return nodes.reduce((acc, {tokenNode}, i) => {
const nodeNames = nodes.slice(0, i + 1).map(({ name }) => name);
Expand Down

0 comments on commit 82e6cc4

Please sign in to comment.