-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude isNonVirtualRoot group from name path
- Loading branch information
1 parent
c5b9f7c
commit d568134
Showing
2 changed files
with
51 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
{ | ||
"id": "io.supernova.flutter-styles", | ||
"name": "Flutter", | ||
"description": "Flutter token and style exporter", | ||
"source_dir": "src", | ||
"version": "1.2.6", | ||
"tags": [ | ||
"Flutter", | ||
"Dart", | ||
"Tokens", | ||
"Styles" | ||
], | ||
"author": "Artem Ufimtcev", | ||
"organization": "Supernova", | ||
"homepage": "https://supernova.io", | ||
"usesBrands": true, | ||
"config": { | ||
"output": "output.json", | ||
"sources": "sources.json", | ||
"js": "src/functions.js" | ||
}, | ||
"engines": { | ||
"pulsar": "1.0.0", | ||
"supernova": "1.0.0" | ||
} | ||
} | ||
"id": "io.supernova.flutter-styles", | ||
"name": "Flutter", | ||
"description": "Flutter token and style exporter", | ||
"source_dir": "src", | ||
"version": "1.2.7", | ||
"tags": ["Flutter", "Dart", "Tokens", "Styles"], | ||
"author": "Artem Ufimtcev", | ||
"organization": "Supernova", | ||
"homepage": "https://supernova.io", | ||
"usesBrands": true, | ||
"config": { | ||
"output": "output.json", | ||
"sources": "sources.json", | ||
"js": "src/functions.js" | ||
}, | ||
"engines": { | ||
"pulsar": "1.0.0", | ||
"supernova": "1.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,56 @@ | ||
/** | ||
* | ||
* @param {string} text | ||
* @param {string} indentationString | ||
* | ||
* | ||
* @param {string} text | ||
* @param {string} indentationString | ||
* | ||
* @returns {string} | ||
*/ | ||
function createDocumentationComment(text, indentationString) { | ||
return text.trim().split("\n").map((line) => `${indentationString}/// ${line}`).join("\n") | ||
return text | ||
.trim() | ||
.split("\n") | ||
.map((line) => `${indentationString}/// ${line}`) | ||
.join("\n"); | ||
} | ||
|
||
/** | ||
* | ||
* @param {{name: string, isRoot: boolean, path: Array<string>}} tokenGroup | ||
* | ||
* | ||
* @param {{name: string, isRoot: boolean, path: Array<string>}} tokenGroup | ||
* | ||
* @returns {Array<string>} | ||
*/ | ||
function createFullTokenGroupPath(tokenGroup) { | ||
if (tokenGroup.isRoot) { | ||
return [] | ||
} else { | ||
return tokenGroup.path.concat(tokenGroup.name) | ||
} | ||
if (tokenGroup.isRoot || tokenGroup.isNonVirtualRoot) { | ||
return []; | ||
} else { | ||
return tokenGroup.path.concat(tokenGroup.name); | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* | ||
* @param {Array<any>} lhs | ||
* @param {Array<any>} rhs | ||
* | ||
* | ||
* @returns {Array<any>} | ||
*/ | ||
function arrayConcat(lhs, rhs) { | ||
return lhs.concat(rhs) | ||
return lhs.concat(rhs); | ||
} | ||
|
||
/** | ||
* | ||
* @param {Array<string>} array | ||
* @param {string} separator | ||
* | ||
* @param {Array<string>} array | ||
* @param {string} separator | ||
*/ | ||
function arrayJoin(array, separator) { | ||
return array.join(separator) | ||
return array.join(separator); | ||
} | ||
|
||
Pulsar.registerFunction("createDocumentationComment", createDocumentationComment) | ||
Pulsar.registerFunction("createFullTokenGroupPath", createFullTokenGroupPath) | ||
Pulsar.registerFunction("arrayConcat", arrayConcat) | ||
Pulsar.registerFunction("arrayJoin", arrayJoin) | ||
Pulsar.registerFunction( | ||
"createDocumentationComment", | ||
createDocumentationComment | ||
); | ||
Pulsar.registerFunction("createFullTokenGroupPath", createFullTokenGroupPath); | ||
Pulsar.registerFunction("arrayConcat", arrayConcat); | ||
Pulsar.registerFunction("arrayJoin", arrayJoin); |