From 2858968cb1875b8afd67474960e269aeadc3479b Mon Sep 17 00:00:00 2001 From: Firstname Lastname Date: Mon, 28 Sep 2020 07:47:54 +0200 Subject: [PATCH] Update --- babel.config.js | 11 +- dist/bin/contracts/Config.js | 3 + dist/bin/contracts/Config.js.map | 1 + dist/bin/contracts/Css.js | 3 + dist/bin/contracts/Css.js.map | 1 + dist/bin/contracts/Figma.js | 3 + dist/bin/contracts/Figma.js.map | 1 + dist/bin/contracts/FigmaData.js | 3 + dist/bin/contracts/FigmaData.js.map | 1 + dist/bin/contracts/FigmaElement.js | 3 + dist/bin/contracts/FigmaElement.js.map | 1 + dist/bin/contracts/FigmagicElement.js | 3 + dist/bin/contracts/FigmagicElement.js.map | 1 + dist/bin/contracts/FileList.js | 3 + dist/bin/contracts/FileList.js.map | 1 + dist/bin/contracts/ImageResponse.js | 3 + dist/bin/contracts/ImageResponse.js.map | 1 + dist/bin/contracts/Imports.js | 3 + dist/bin/contracts/Imports.js.map | 1 + dist/bin/contracts/Metadata.js | 3 + dist/bin/contracts/Metadata.js.map | 1 + .../ParsedElementMetadataInterface.js | 3 + .../ParsedElementMetadataInterface.js.map | 1 + dist/bin/contracts/PrepFile.js | 3 + dist/bin/contracts/PrepFile.js.map | 1 + dist/bin/contracts/ProcessedToken.js | 3 + dist/bin/contracts/ProcessedToken.js.map | 1 + dist/bin/contracts/Templates.js | 3 + dist/bin/contracts/Templates.js.map | 1 + dist/bin/contracts/TextElement.js | 3 + dist/bin/contracts/TextElement.js.map | 1 + dist/bin/contracts/TokenMatch.js | 3 + dist/bin/contracts/TokenMatch.js.map | 1 + dist/bin/contracts/Tokens.js | 3 + dist/bin/contracts/Tokens.js.map | 1 + dist/bin/contracts/Write.js | 3 + dist/bin/contracts/Write.js.map | 1 + dist/bin/controllers/FigmagicController.js | 27 + .../bin/controllers/FigmagicController.js.map | 1 + dist/bin/entities/Config/baseConfig.js | 45 ++ dist/bin/entities/Config/baseConfig.js.map | 1 + dist/bin/entities/Config/index.js | 40 + dist/bin/entities/Config/index.js.map | 1 + .../Config/logic/createConfiguration.js | 56 ++ .../Config/logic/createConfiguration.js.map | 1 + .../bin/entities/Config/logic/parseCliArgs.js | 146 ++++ .../entities/Config/logic/parseCliArgs.js.map | 1 + .../entities/Config/logic/validateConfig.js | 122 +++ .../Config/logic/validateConfig.js.map | 1 + dist/bin/entities/FigmagicElement/index.js | 188 +++++ .../bin/entities/FigmagicElement/index.js.map | 1 + .../FigmagicElement/logic/getFileContents.js | 20 + .../logic/getFileContents.js.map | 1 + .../logic/parseCssFromElement.js | 127 +++ .../logic/parseCssFromElement.js.map | 1 + .../parseTypographyStylingFromElement.js | 158 ++++ .../parseTypographyStylingFromElement.js.map | 1 + .../entities/FigmagicElement/logic/parsers.js | 235 ++++++ .../FigmagicElement/logic/parsers.js.map | 1 + .../FigmagicElement/logic/processNestedCss.js | 89 +++ .../logic/processNestedCss.js.map | 1 + .../logic/sliceOutObjectFromFile.js | 21 + .../logic/sliceOutObjectFromFile.js.map | 1 + dist/bin/entities/Token/index.js | 127 +++ dist/bin/entities/Token/index.js.map | 1 + .../Token/logic/makeBorderWidthTokens.js | 22 + .../Token/logic/makeBorderWidthTokens.js.map | 1 + .../entities/Token/logic/makeColorTokens.js | 30 + .../Token/logic/makeColorTokens.js.map | 1 + .../entities/Token/logic/makeDelayTokens.js | 22 + .../Token/logic/makeDelayTokens.js.map | 1 + .../Token/logic/makeDurationTokens.js | 22 + .../Token/logic/makeDurationTokens.js.map | 1 + .../entities/Token/logic/makeEasingTokens.js | 22 + .../Token/logic/makeEasingTokens.js.map | 1 + .../Token/logic/makeFontSizeTokens.js | 27 + .../Token/logic/makeFontSizeTokens.js.map | 1 + .../entities/Token/logic/makeFontTokens.js | 24 + .../Token/logic/makeFontTokens.js.map | 1 + .../Token/logic/makeFontWeightTokens.js | 24 + .../Token/logic/makeFontWeightTokens.js.map | 1 + .../Token/logic/makeLetterSpacingTokens.js | 40 + .../logic/makeLetterSpacingTokens.js.map | 1 + .../Token/logic/makeLineHeightTokens.js | 27 + .../Token/logic/makeLineHeightTokens.js.map | 1 + .../Token/logic/makeMediaQueryTokens.js | 22 + .../Token/logic/makeMediaQueryTokens.js.map | 1 + .../entities/Token/logic/makeOpacityTokens.js | 30 + .../Token/logic/makeOpacityTokens.js.map | 1 + .../entities/Token/logic/makeRadiusTokens.js | 26 + .../Token/logic/makeRadiusTokens.js.map | 1 + .../entities/Token/logic/makeShadowTokens.js | 44 ++ .../Token/logic/makeShadowTokens.js.map | 1 + .../entities/Token/logic/makeSpacingTokens.js | 27 + .../Token/logic/makeSpacingTokens.js.map | 1 + .../entities/Token/logic/makeZindexTokens.js | 22 + .../Token/logic/makeZindexTokens.js.map | 1 + .../bin/frameworks/filesystem/createFolder.js | 19 + .../frameworks/filesystem/createFolder.js.map | 1 + .../frameworks/filesystem/getDataHelpers.js | 49 ++ .../filesystem/getDataHelpers.js.map | 1 + .../filesystem/getFileContentAndPath.js | 68 ++ .../filesystem/getFileContentAndPath.js.map | 1 + dist/bin/frameworks/filesystem/loadFile.js | 30 + .../bin/frameworks/filesystem/loadFile.js.map | 1 + dist/bin/frameworks/filesystem/prepFile.js | 94 +++ .../bin/frameworks/filesystem/prepFile.js.map | 1 + .../bin/frameworks/filesystem/prepareWrite.js | 34 + .../frameworks/filesystem/prepareWrite.js.map | 1 + dist/bin/frameworks/filesystem/refresh.js | 20 + dist/bin/frameworks/filesystem/refresh.js.map | 1 + dist/bin/frameworks/filesystem/write.js | 18 + dist/bin/frameworks/filesystem/write.js.map | 1 + .../frameworks/filesystem/writeBaseJson.js | 21 + .../filesystem/writeBaseJson.js.map | 1 + dist/bin/frameworks/filesystem/writeFile.js | 37 + .../frameworks/filesystem/writeFile.js.map | 1 + dist/bin/frameworks/messages/messages.js | 31 + dist/bin/frameworks/messages/messages.js.map | 1 + dist/bin/frameworks/network/downloadFile.js | 29 + .../frameworks/network/downloadFile.js.map | 1 + dist/bin/frameworks/network/getData.js | 29 + dist/bin/frameworks/network/getData.js.map | 1 + dist/bin/frameworks/network/getDataLocal.js | 21 + .../frameworks/network/getDataLocal.js.map | 1 + dist/bin/frameworks/network/getDataRemote.js | 23 + .../frameworks/network/getDataRemote.js.map | 1 + dist/bin/frameworks/network/getFromApi.js | 26 + dist/bin/frameworks/network/getFromApi.js.map | 1 + dist/bin/frameworks/string/camelize.js | 16 + dist/bin/frameworks/string/camelize.js.map | 1 + .../bin/frameworks/string/convertHexToRgba.js | 16 + .../frameworks/string/convertHexToRgba.js.map | 1 + .../bin/frameworks/string/convertRgbaToHex.js | 20 + .../frameworks/string/convertRgbaToHex.js.map | 1 + .../string/createEnumStringOutOfObject.js | 13 + .../string/createEnumStringOutOfObject.js.map | 1 + .../string/createImportStringFromList.js | 17 + .../string/createImportStringFromList.js.map | 1 + dist/bin/frameworks/string/normalizeUnits.js | 33 + .../frameworks/string/normalizeUnits.js.map | 1 + .../frameworks/string/replaceMediaQuery.js | 23 + .../string/replaceMediaQuery.js.map | 1 + dist/bin/frameworks/string/roundColorValue.js | 19 + .../frameworks/string/roundColorValue.js.map | 1 + dist/bin/frameworks/string/toPascalCase.js | 13 + .../bin/frameworks/string/toPascalCase.js.map | 1 + .../frameworks/system/acceptedFileTypes.js | 13 + .../system/acceptedFileTypes.js.map | 1 + .../frameworks/system/acceptedTokenTypes.js | 24 + .../system/acceptedTokenTypes.js.map | 1 + dist/bin/frameworks/system/colors.js | 29 + dist/bin/frameworks/system/colors.js.map | 1 + .../system/ignoreElementsKeywords.js | 5 + .../system/ignoreElementsKeywords.js.map | 1 + dist/bin/frameworks/system/validatorLists.js | 15 + .../frameworks/system/validatorLists.js.map | 1 + dist/bin/usecases/createElements.js | 31 + dist/bin/usecases/createElements.js.map | 1 + dist/bin/usecases/createGraphics.js | 25 + dist/bin/usecases/createGraphics.js.map | 1 + dist/bin/usecases/createTokens.js | 25 + dist/bin/usecases/createTokens.js.map | 1 + .../usecases/interactors/common/createPage.js | 20 + .../interactors/common/createPage.js.map | 1 + .../interactors/elements/processElements.js | 19 + .../elements/processElements.js.map | 1 + .../interactors/elements/writeElements.js | 130 +++ .../interactors/elements/writeElements.js.map | 1 + .../interactors/graphics/getFileList.js | 17 + .../interactors/graphics/getFileList.js.map | 1 + .../interactors/graphics/getIdString.js | 12 + .../interactors/graphics/getIdString.js.map | 1 + .../usecases/interactors/graphics/getIds.js | 16 + .../interactors/graphics/getIds.js.map | 1 + .../interactors/graphics/processGraphics.js | 28 + .../graphics/processGraphics.js.map | 1 + .../interactors/graphics/writeGraphics.js | 20 + .../interactors/graphics/writeGraphics.js.map | 1 + .../interactors/tokens/processTokens.js | 33 + .../interactors/tokens/processTokens.js.map | 1 + .../interactors/tokens/writeTokens.js | 17 + .../interactors/tokens/writeTokens.js.map | 1 + dist/index.js | 53 ++ dist/index.js.map | 1 + index.ts | 3 +- package-lock.json | 748 +++--------------- package.json | 37 +- tsconfig.json | 2 +- 189 files changed, 3334 insertions(+), 696 deletions(-) create mode 100644 dist/bin/contracts/Config.js create mode 100644 dist/bin/contracts/Config.js.map create mode 100644 dist/bin/contracts/Css.js create mode 100644 dist/bin/contracts/Css.js.map create mode 100644 dist/bin/contracts/Figma.js create mode 100644 dist/bin/contracts/Figma.js.map create mode 100644 dist/bin/contracts/FigmaData.js create mode 100644 dist/bin/contracts/FigmaData.js.map create mode 100644 dist/bin/contracts/FigmaElement.js create mode 100644 dist/bin/contracts/FigmaElement.js.map create mode 100644 dist/bin/contracts/FigmagicElement.js create mode 100644 dist/bin/contracts/FigmagicElement.js.map create mode 100644 dist/bin/contracts/FileList.js create mode 100644 dist/bin/contracts/FileList.js.map create mode 100644 dist/bin/contracts/ImageResponse.js create mode 100644 dist/bin/contracts/ImageResponse.js.map create mode 100644 dist/bin/contracts/Imports.js create mode 100644 dist/bin/contracts/Imports.js.map create mode 100644 dist/bin/contracts/Metadata.js create mode 100644 dist/bin/contracts/Metadata.js.map create mode 100644 dist/bin/contracts/ParsedElementMetadataInterface.js create mode 100644 dist/bin/contracts/ParsedElementMetadataInterface.js.map create mode 100644 dist/bin/contracts/PrepFile.js create mode 100644 dist/bin/contracts/PrepFile.js.map create mode 100644 dist/bin/contracts/ProcessedToken.js create mode 100644 dist/bin/contracts/ProcessedToken.js.map create mode 100644 dist/bin/contracts/Templates.js create mode 100644 dist/bin/contracts/Templates.js.map create mode 100644 dist/bin/contracts/TextElement.js create mode 100644 dist/bin/contracts/TextElement.js.map create mode 100644 dist/bin/contracts/TokenMatch.js create mode 100644 dist/bin/contracts/TokenMatch.js.map create mode 100644 dist/bin/contracts/Tokens.js create mode 100644 dist/bin/contracts/Tokens.js.map create mode 100644 dist/bin/contracts/Write.js create mode 100644 dist/bin/contracts/Write.js.map create mode 100644 dist/bin/controllers/FigmagicController.js create mode 100644 dist/bin/controllers/FigmagicController.js.map create mode 100644 dist/bin/entities/Config/baseConfig.js create mode 100644 dist/bin/entities/Config/baseConfig.js.map create mode 100644 dist/bin/entities/Config/index.js create mode 100644 dist/bin/entities/Config/index.js.map create mode 100644 dist/bin/entities/Config/logic/createConfiguration.js create mode 100644 dist/bin/entities/Config/logic/createConfiguration.js.map create mode 100644 dist/bin/entities/Config/logic/parseCliArgs.js create mode 100644 dist/bin/entities/Config/logic/parseCliArgs.js.map create mode 100644 dist/bin/entities/Config/logic/validateConfig.js create mode 100644 dist/bin/entities/Config/logic/validateConfig.js.map create mode 100644 dist/bin/entities/FigmagicElement/index.js create mode 100644 dist/bin/entities/FigmagicElement/index.js.map create mode 100644 dist/bin/entities/FigmagicElement/logic/getFileContents.js create mode 100644 dist/bin/entities/FigmagicElement/logic/getFileContents.js.map create mode 100644 dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js create mode 100644 dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js.map create mode 100644 dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js create mode 100644 dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js.map create mode 100644 dist/bin/entities/FigmagicElement/logic/parsers.js create mode 100644 dist/bin/entities/FigmagicElement/logic/parsers.js.map create mode 100644 dist/bin/entities/FigmagicElement/logic/processNestedCss.js create mode 100644 dist/bin/entities/FigmagicElement/logic/processNestedCss.js.map create mode 100644 dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js create mode 100644 dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js.map create mode 100644 dist/bin/entities/Token/index.js create mode 100644 dist/bin/entities/Token/index.js.map create mode 100644 dist/bin/entities/Token/logic/makeBorderWidthTokens.js create mode 100644 dist/bin/entities/Token/logic/makeBorderWidthTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeColorTokens.js create mode 100644 dist/bin/entities/Token/logic/makeColorTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeDelayTokens.js create mode 100644 dist/bin/entities/Token/logic/makeDelayTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeDurationTokens.js create mode 100644 dist/bin/entities/Token/logic/makeDurationTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeEasingTokens.js create mode 100644 dist/bin/entities/Token/logic/makeEasingTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeFontSizeTokens.js create mode 100644 dist/bin/entities/Token/logic/makeFontSizeTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeFontTokens.js create mode 100644 dist/bin/entities/Token/logic/makeFontTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeFontWeightTokens.js create mode 100644 dist/bin/entities/Token/logic/makeFontWeightTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeLetterSpacingTokens.js create mode 100644 dist/bin/entities/Token/logic/makeLetterSpacingTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeLineHeightTokens.js create mode 100644 dist/bin/entities/Token/logic/makeLineHeightTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeMediaQueryTokens.js create mode 100644 dist/bin/entities/Token/logic/makeMediaQueryTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeOpacityTokens.js create mode 100644 dist/bin/entities/Token/logic/makeOpacityTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeRadiusTokens.js create mode 100644 dist/bin/entities/Token/logic/makeRadiusTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeShadowTokens.js create mode 100644 dist/bin/entities/Token/logic/makeShadowTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeSpacingTokens.js create mode 100644 dist/bin/entities/Token/logic/makeSpacingTokens.js.map create mode 100644 dist/bin/entities/Token/logic/makeZindexTokens.js create mode 100644 dist/bin/entities/Token/logic/makeZindexTokens.js.map create mode 100644 dist/bin/frameworks/filesystem/createFolder.js create mode 100644 dist/bin/frameworks/filesystem/createFolder.js.map create mode 100644 dist/bin/frameworks/filesystem/getDataHelpers.js create mode 100644 dist/bin/frameworks/filesystem/getDataHelpers.js.map create mode 100644 dist/bin/frameworks/filesystem/getFileContentAndPath.js create mode 100644 dist/bin/frameworks/filesystem/getFileContentAndPath.js.map create mode 100644 dist/bin/frameworks/filesystem/loadFile.js create mode 100644 dist/bin/frameworks/filesystem/loadFile.js.map create mode 100644 dist/bin/frameworks/filesystem/prepFile.js create mode 100644 dist/bin/frameworks/filesystem/prepFile.js.map create mode 100644 dist/bin/frameworks/filesystem/prepareWrite.js create mode 100644 dist/bin/frameworks/filesystem/prepareWrite.js.map create mode 100644 dist/bin/frameworks/filesystem/refresh.js create mode 100644 dist/bin/frameworks/filesystem/refresh.js.map create mode 100644 dist/bin/frameworks/filesystem/write.js create mode 100644 dist/bin/frameworks/filesystem/write.js.map create mode 100644 dist/bin/frameworks/filesystem/writeBaseJson.js create mode 100644 dist/bin/frameworks/filesystem/writeBaseJson.js.map create mode 100644 dist/bin/frameworks/filesystem/writeFile.js create mode 100644 dist/bin/frameworks/filesystem/writeFile.js.map create mode 100644 dist/bin/frameworks/messages/messages.js create mode 100644 dist/bin/frameworks/messages/messages.js.map create mode 100644 dist/bin/frameworks/network/downloadFile.js create mode 100644 dist/bin/frameworks/network/downloadFile.js.map create mode 100644 dist/bin/frameworks/network/getData.js create mode 100644 dist/bin/frameworks/network/getData.js.map create mode 100644 dist/bin/frameworks/network/getDataLocal.js create mode 100644 dist/bin/frameworks/network/getDataLocal.js.map create mode 100644 dist/bin/frameworks/network/getDataRemote.js create mode 100644 dist/bin/frameworks/network/getDataRemote.js.map create mode 100644 dist/bin/frameworks/network/getFromApi.js create mode 100644 dist/bin/frameworks/network/getFromApi.js.map create mode 100644 dist/bin/frameworks/string/camelize.js create mode 100644 dist/bin/frameworks/string/camelize.js.map create mode 100644 dist/bin/frameworks/string/convertHexToRgba.js create mode 100644 dist/bin/frameworks/string/convertHexToRgba.js.map create mode 100644 dist/bin/frameworks/string/convertRgbaToHex.js create mode 100644 dist/bin/frameworks/string/convertRgbaToHex.js.map create mode 100644 dist/bin/frameworks/string/createEnumStringOutOfObject.js create mode 100644 dist/bin/frameworks/string/createEnumStringOutOfObject.js.map create mode 100644 dist/bin/frameworks/string/createImportStringFromList.js create mode 100644 dist/bin/frameworks/string/createImportStringFromList.js.map create mode 100644 dist/bin/frameworks/string/normalizeUnits.js create mode 100644 dist/bin/frameworks/string/normalizeUnits.js.map create mode 100644 dist/bin/frameworks/string/replaceMediaQuery.js create mode 100644 dist/bin/frameworks/string/replaceMediaQuery.js.map create mode 100644 dist/bin/frameworks/string/roundColorValue.js create mode 100644 dist/bin/frameworks/string/roundColorValue.js.map create mode 100644 dist/bin/frameworks/string/toPascalCase.js create mode 100644 dist/bin/frameworks/string/toPascalCase.js.map create mode 100644 dist/bin/frameworks/system/acceptedFileTypes.js create mode 100644 dist/bin/frameworks/system/acceptedFileTypes.js.map create mode 100644 dist/bin/frameworks/system/acceptedTokenTypes.js create mode 100644 dist/bin/frameworks/system/acceptedTokenTypes.js.map create mode 100644 dist/bin/frameworks/system/colors.js create mode 100644 dist/bin/frameworks/system/colors.js.map create mode 100644 dist/bin/frameworks/system/ignoreElementsKeywords.js create mode 100644 dist/bin/frameworks/system/ignoreElementsKeywords.js.map create mode 100644 dist/bin/frameworks/system/validatorLists.js create mode 100644 dist/bin/frameworks/system/validatorLists.js.map create mode 100644 dist/bin/usecases/createElements.js create mode 100644 dist/bin/usecases/createElements.js.map create mode 100644 dist/bin/usecases/createGraphics.js create mode 100644 dist/bin/usecases/createGraphics.js.map create mode 100644 dist/bin/usecases/createTokens.js create mode 100644 dist/bin/usecases/createTokens.js.map create mode 100644 dist/bin/usecases/interactors/common/createPage.js create mode 100644 dist/bin/usecases/interactors/common/createPage.js.map create mode 100644 dist/bin/usecases/interactors/elements/processElements.js create mode 100644 dist/bin/usecases/interactors/elements/processElements.js.map create mode 100644 dist/bin/usecases/interactors/elements/writeElements.js create mode 100644 dist/bin/usecases/interactors/elements/writeElements.js.map create mode 100644 dist/bin/usecases/interactors/graphics/getFileList.js create mode 100644 dist/bin/usecases/interactors/graphics/getFileList.js.map create mode 100644 dist/bin/usecases/interactors/graphics/getIdString.js create mode 100644 dist/bin/usecases/interactors/graphics/getIdString.js.map create mode 100644 dist/bin/usecases/interactors/graphics/getIds.js create mode 100644 dist/bin/usecases/interactors/graphics/getIds.js.map create mode 100644 dist/bin/usecases/interactors/graphics/processGraphics.js create mode 100644 dist/bin/usecases/interactors/graphics/processGraphics.js.map create mode 100644 dist/bin/usecases/interactors/graphics/writeGraphics.js create mode 100644 dist/bin/usecases/interactors/graphics/writeGraphics.js.map create mode 100644 dist/bin/usecases/interactors/tokens/processTokens.js create mode 100644 dist/bin/usecases/interactors/tokens/processTokens.js.map create mode 100644 dist/bin/usecases/interactors/tokens/writeTokens.js create mode 100644 dist/bin/usecases/interactors/tokens/writeTokens.js.map create mode 100755 dist/index.js create mode 100644 dist/index.js.map diff --git a/babel.config.js b/babel.config.js index 2c8a79c13..085168fcc 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,12 +1,3 @@ module.exports = { - presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'], - env: { - test: { - plugins: [ - 'dynamic-import-node', - '@babel/plugin-syntax-dynamic-import', - ['@babel/plugin-transform-modules-commonjs', { spec: true }] - ] - } - } + presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'] }; diff --git a/dist/bin/contracts/Config.js b/dist/bin/contracts/Config.js new file mode 100644 index 000000000..bfb742889 --- /dev/null +++ b/dist/bin/contracts/Config.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Config.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Config.js.map b/dist/bin/contracts/Config.js.map new file mode 100644 index 000000000..7d862cc6a --- /dev/null +++ b/dist/bin/contracts/Config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../../bin/contracts/Config.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Css.js b/dist/bin/contracts/Css.js new file mode 100644 index 000000000..c36b1b410 --- /dev/null +++ b/dist/bin/contracts/Css.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Css.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Css.js.map b/dist/bin/contracts/Css.js.map new file mode 100644 index 000000000..acba5a98e --- /dev/null +++ b/dist/bin/contracts/Css.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Css.js","sourceRoot":"","sources":["../../../bin/contracts/Css.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Figma.js b/dist/bin/contracts/Figma.js new file mode 100644 index 000000000..b339299be --- /dev/null +++ b/dist/bin/contracts/Figma.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Figma.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Figma.js.map b/dist/bin/contracts/Figma.js.map new file mode 100644 index 000000000..2c69c7e45 --- /dev/null +++ b/dist/bin/contracts/Figma.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Figma.js","sourceRoot":"","sources":["../../../bin/contracts/Figma.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/FigmaData.js b/dist/bin/contracts/FigmaData.js new file mode 100644 index 000000000..205c304c9 --- /dev/null +++ b/dist/bin/contracts/FigmaData.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=FigmaData.js.map \ No newline at end of file diff --git a/dist/bin/contracts/FigmaData.js.map b/dist/bin/contracts/FigmaData.js.map new file mode 100644 index 000000000..8276e7008 --- /dev/null +++ b/dist/bin/contracts/FigmaData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FigmaData.js","sourceRoot":"","sources":["../../../bin/contracts/FigmaData.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/FigmaElement.js b/dist/bin/contracts/FigmaElement.js new file mode 100644 index 000000000..b1b47719a --- /dev/null +++ b/dist/bin/contracts/FigmaElement.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=FigmaElement.js.map \ No newline at end of file diff --git a/dist/bin/contracts/FigmaElement.js.map b/dist/bin/contracts/FigmaElement.js.map new file mode 100644 index 000000000..cec6a55a5 --- /dev/null +++ b/dist/bin/contracts/FigmaElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FigmaElement.js","sourceRoot":"","sources":["../../../bin/contracts/FigmaElement.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/FigmagicElement.js b/dist/bin/contracts/FigmagicElement.js new file mode 100644 index 000000000..0f8420ca2 --- /dev/null +++ b/dist/bin/contracts/FigmagicElement.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=FigmagicElement.js.map \ No newline at end of file diff --git a/dist/bin/contracts/FigmagicElement.js.map b/dist/bin/contracts/FigmagicElement.js.map new file mode 100644 index 000000000..3a191cf61 --- /dev/null +++ b/dist/bin/contracts/FigmagicElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FigmagicElement.js","sourceRoot":"","sources":["../../../bin/contracts/FigmagicElement.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/FileList.js b/dist/bin/contracts/FileList.js new file mode 100644 index 000000000..0695ac8bd --- /dev/null +++ b/dist/bin/contracts/FileList.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=FileList.js.map \ No newline at end of file diff --git a/dist/bin/contracts/FileList.js.map b/dist/bin/contracts/FileList.js.map new file mode 100644 index 000000000..d1666615b --- /dev/null +++ b/dist/bin/contracts/FileList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FileList.js","sourceRoot":"","sources":["../../../bin/contracts/FileList.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/ImageResponse.js b/dist/bin/contracts/ImageResponse.js new file mode 100644 index 000000000..0cb69031e --- /dev/null +++ b/dist/bin/contracts/ImageResponse.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=ImageResponse.js.map \ No newline at end of file diff --git a/dist/bin/contracts/ImageResponse.js.map b/dist/bin/contracts/ImageResponse.js.map new file mode 100644 index 000000000..cc8c07102 --- /dev/null +++ b/dist/bin/contracts/ImageResponse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ImageResponse.js","sourceRoot":"","sources":["../../../bin/contracts/ImageResponse.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Imports.js b/dist/bin/contracts/Imports.js new file mode 100644 index 000000000..a7649ddbb --- /dev/null +++ b/dist/bin/contracts/Imports.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Imports.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Imports.js.map b/dist/bin/contracts/Imports.js.map new file mode 100644 index 000000000..db7f386be --- /dev/null +++ b/dist/bin/contracts/Imports.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Imports.js","sourceRoot":"","sources":["../../../bin/contracts/Imports.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Metadata.js b/dist/bin/contracts/Metadata.js new file mode 100644 index 000000000..e038327d8 --- /dev/null +++ b/dist/bin/contracts/Metadata.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Metadata.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Metadata.js.map b/dist/bin/contracts/Metadata.js.map new file mode 100644 index 000000000..569fc96ae --- /dev/null +++ b/dist/bin/contracts/Metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../bin/contracts/Metadata.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/ParsedElementMetadataInterface.js b/dist/bin/contracts/ParsedElementMetadataInterface.js new file mode 100644 index 000000000..2c19f1cfb --- /dev/null +++ b/dist/bin/contracts/ParsedElementMetadataInterface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=ParsedElementMetadataInterface.js.map \ No newline at end of file diff --git a/dist/bin/contracts/ParsedElementMetadataInterface.js.map b/dist/bin/contracts/ParsedElementMetadataInterface.js.map new file mode 100644 index 000000000..9f14628f2 --- /dev/null +++ b/dist/bin/contracts/ParsedElementMetadataInterface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ParsedElementMetadataInterface.js","sourceRoot":"","sources":["../../../bin/contracts/ParsedElementMetadataInterface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/PrepFile.js b/dist/bin/contracts/PrepFile.js new file mode 100644 index 000000000..4ef438732 --- /dev/null +++ b/dist/bin/contracts/PrepFile.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=PrepFile.js.map \ No newline at end of file diff --git a/dist/bin/contracts/PrepFile.js.map b/dist/bin/contracts/PrepFile.js.map new file mode 100644 index 000000000..67ff3acac --- /dev/null +++ b/dist/bin/contracts/PrepFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PrepFile.js","sourceRoot":"","sources":["../../../bin/contracts/PrepFile.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/ProcessedToken.js b/dist/bin/contracts/ProcessedToken.js new file mode 100644 index 000000000..eeeab898d --- /dev/null +++ b/dist/bin/contracts/ProcessedToken.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=ProcessedToken.js.map \ No newline at end of file diff --git a/dist/bin/contracts/ProcessedToken.js.map b/dist/bin/contracts/ProcessedToken.js.map new file mode 100644 index 000000000..7b7fe5adc --- /dev/null +++ b/dist/bin/contracts/ProcessedToken.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProcessedToken.js","sourceRoot":"","sources":["../../../bin/contracts/ProcessedToken.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Templates.js b/dist/bin/contracts/Templates.js new file mode 100644 index 000000000..ab14866b0 --- /dev/null +++ b/dist/bin/contracts/Templates.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Templates.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Templates.js.map b/dist/bin/contracts/Templates.js.map new file mode 100644 index 000000000..d80d609f5 --- /dev/null +++ b/dist/bin/contracts/Templates.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Templates.js","sourceRoot":"","sources":["../../../bin/contracts/Templates.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/TextElement.js b/dist/bin/contracts/TextElement.js new file mode 100644 index 000000000..ec1333855 --- /dev/null +++ b/dist/bin/contracts/TextElement.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=TextElement.js.map \ No newline at end of file diff --git a/dist/bin/contracts/TextElement.js.map b/dist/bin/contracts/TextElement.js.map new file mode 100644 index 000000000..a9c873386 --- /dev/null +++ b/dist/bin/contracts/TextElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TextElement.js","sourceRoot":"","sources":["../../../bin/contracts/TextElement.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/TokenMatch.js b/dist/bin/contracts/TokenMatch.js new file mode 100644 index 000000000..7aff06b07 --- /dev/null +++ b/dist/bin/contracts/TokenMatch.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=TokenMatch.js.map \ No newline at end of file diff --git a/dist/bin/contracts/TokenMatch.js.map b/dist/bin/contracts/TokenMatch.js.map new file mode 100644 index 000000000..8220c89a6 --- /dev/null +++ b/dist/bin/contracts/TokenMatch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TokenMatch.js","sourceRoot":"","sources":["../../../bin/contracts/TokenMatch.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Tokens.js b/dist/bin/contracts/Tokens.js new file mode 100644 index 000000000..0ff2b962e --- /dev/null +++ b/dist/bin/contracts/Tokens.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Tokens.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Tokens.js.map b/dist/bin/contracts/Tokens.js.map new file mode 100644 index 000000000..790cee605 --- /dev/null +++ b/dist/bin/contracts/Tokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Tokens.js","sourceRoot":"","sources":["../../../bin/contracts/Tokens.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/contracts/Write.js b/dist/bin/contracts/Write.js new file mode 100644 index 000000000..48c0a6fb8 --- /dev/null +++ b/dist/bin/contracts/Write.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Write.js.map \ No newline at end of file diff --git a/dist/bin/contracts/Write.js.map b/dist/bin/contracts/Write.js.map new file mode 100644 index 000000000..77e733b4a --- /dev/null +++ b/dist/bin/contracts/Write.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Write.js","sourceRoot":"","sources":["../../../bin/contracts/Write.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/bin/controllers/FigmagicController.js b/dist/bin/controllers/FigmagicController.js new file mode 100644 index 000000000..ab7e2594b --- /dev/null +++ b/dist/bin/controllers/FigmagicController.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FigmagicController = void 0; +const createTokens_1 = require("../usecases/createTokens"); +const createElements_1 = require("../usecases/createElements"); +const createGraphics_1 = require("../usecases/createGraphics"); +const messages_1 = require("../frameworks/messages/messages"); +const errors_1 = require("../frameworks/errors/errors"); +async function FigmagicController(config, data) { + try { + if (!config || !data) + throw new Error(errors_1.ErrorFigmagicController); + if (config.syncTokens) + await createTokens_1.createTokens(config, data); + if (config.syncElements) + await createElements_1.createElements(config, data); + if (config.syncGraphics) + await createGraphics_1.createGraphics(config, data); + console.log(messages_1.MsgJobComplete); + return messages_1.MsgJobComplete; + } + catch (error) { + throw new Error(errors_1.ErrorFigmagicController); + } +} +exports.FigmagicController = FigmagicController; +//# sourceMappingURL=FigmagicController.js.map \ No newline at end of file diff --git a/dist/bin/controllers/FigmagicController.js.map b/dist/bin/controllers/FigmagicController.js.map new file mode 100644 index 000000000..e6392bfcf --- /dev/null +++ b/dist/bin/controllers/FigmagicController.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FigmagicController.js","sourceRoot":"","sources":["../../../bin/controllers/FigmagicController.ts"],"names":[],"mappings":";;;AAGA,2DAAwD;AACxD,+DAA4D;AAC5D,+DAA4D;AAE5D,8DAAiE;AACjE,wDAAsE;AAK/D,KAAK,UAAU,kBAAkB,CAAC,MAAc,EAAE,IAAe;IACtE,IAAI;QACF,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAuB,CAAC,CAAC;QAE/D,IAAI,MAAM,CAAC,UAAU;YAAE,MAAM,2BAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxD,IAAI,MAAM,CAAC,YAAY;YAAE,MAAM,+BAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5D,IAAI,MAAM,CAAC,YAAY;YAAE,MAAM,+BAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,yBAAc,CAAC,CAAC;QAE5B,OAAO,yBAAc,CAAC;KACvB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,gCAAuB,CAAC,CAAC;KAC1C;AACH,CAAC;AAbD,gDAaC"} \ No newline at end of file diff --git a/dist/bin/entities/Config/baseConfig.js b/dist/bin/entities/Config/baseConfig.js new file mode 100644 index 000000000..5571026d9 --- /dev/null +++ b/dist/bin/entities/Config/baseConfig.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.baseConfig = void 0; +exports.baseConfig = { + debugMode: false, + fontUnit: 'rem', + letterSpacingUnit: 'em', + opacitiesUnit: 'float', + figmaData: 'figma.json', + figmagicFolder: '.figmagic', + outputFolderElements: 'elements', + outputFolderGraphics: 'graphics', + outputFolderTokens: 'tokens', + outputFormatCss: 'ts', + outputFormatDescription: 'md', + outputFormatElements: 'tsx', + outputFormatGraphics: 'svg', + outputFormatStorybook: 'js', + outputFormatTokens: 'ts', + outputScaleGraphics: 1, + outputDataTypeToken: null, + recompileLocal: false, + remSize: 16, + skipFileGeneration: { + forceUpdate: true, + skipCss: false, + skipDescription: false, + skipReact: false, + skipStorybook: false, + skipStyled: false + }, + spacingUnit: 'rem', + syncElements: false, + syncGraphics: false, + syncTokens: true, + templates: { + templatePathReact: 'templates/react', + templatePathStorybook: 'templates/story', + templatePathStyled: 'templates/styled' + }, + token: '', + url: '', + usePostscriptFontNames: false +}; +//# sourceMappingURL=baseConfig.js.map \ No newline at end of file diff --git a/dist/bin/entities/Config/baseConfig.js.map b/dist/bin/entities/Config/baseConfig.js.map new file mode 100644 index 000000000..6c912e33a --- /dev/null +++ b/dist/bin/entities/Config/baseConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"baseConfig.js","sourceRoot":"","sources":["../../../../bin/entities/Config/baseConfig.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAW;IAChC,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,OAAO;IACtB,SAAS,EAAE,YAAY;IACvB,cAAc,EAAE,WAAW;IAC3B,oBAAoB,EAAE,UAAU;IAChC,oBAAoB,EAAE,UAAU;IAChC,kBAAkB,EAAE,QAAQ;IAC5B,eAAe,EAAE,IAAI;IACrB,uBAAuB,EAAE,IAAI;IAC7B,oBAAoB,EAAE,KAAK;IAC3B,oBAAoB,EAAE,KAAK;IAC3B,qBAAqB,EAAE,IAAI;IAC3B,kBAAkB,EAAE,IAAI;IACxB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,IAAI;IACzB,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,EAAE;IACX,kBAAkB,EAAE;QAClB,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,KAAK;QACd,eAAe,EAAE,KAAK;QACtB,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,KAAK;KAClB;IACD,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE;QACT,iBAAiB,EAAE,iBAAiB;QACpC,qBAAqB,EAAE,iBAAiB;QACxC,kBAAkB,EAAE,kBAAkB;KACvC;IACD,KAAK,EAAE,EAAE;IACT,GAAG,EAAE,EAAE;IACP,sBAAsB,EAAE,KAAK;CAC9B,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/Config/index.js b/dist/bin/entities/Config/index.js new file mode 100644 index 000000000..0a4eb661f --- /dev/null +++ b/dist/bin/entities/Config/index.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeConfiguration = void 0; +const baseConfig_1 = require("./baseConfig"); +const createConfiguration_1 = require("./logic/createConfiguration"); +const validateConfig_1 = require("./logic/validateConfig"); +exports.makeConfiguration = async (userConfigPath, ...cliArgs) => { + const CONFIGURATION = new Configuration(userConfigPath, cliArgs); + await CONFIGURATION.createConfig(); + return CONFIGURATION.getConfig(); +}; +class Configuration { + constructor(userConfigPath, cliArgs) { + this.config = baseConfig_1.baseConfig; + this.baseConfiguration = baseConfig_1.baseConfig; + this.userConfigPath = userConfigPath; + this.cliArgs = cliArgs; + } + async createConfig() { + let config = null; + try { + config = await createConfiguration_1.createConfiguration(this.baseConfiguration, this.userConfigPath, this.cliArgs); + } + catch (error) { + throw new Error(error); + } + try { + validateConfig_1.validateConfig(config); + } + catch (error) { + throw new Error(error); + } + this.config = config; + return this.getConfig(); + } + getConfig() { + return this.config; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/bin/entities/Config/index.js.map b/dist/bin/entities/Config/index.js.map new file mode 100644 index 000000000..6c7183cf8 --- /dev/null +++ b/dist/bin/entities/Config/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../bin/entities/Config/index.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAC1C,qEAAkE;AAClE,2DAAwD;AAE3C,QAAA,iBAAiB,GAAG,KAAK,EACpC,cAAsB,EACtB,GAAG,OAAiB,EACH,EAAE;IACnB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC;IACnC,OAAO,aAAa,CAAC,SAAS,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,aAAa;IAMjB,YAAY,cAAsB,EAAE,OAAiB;QAFrD,WAAM,GAAW,uBAAU,CAAC;QAG1B,IAAI,CAAC,iBAAiB,GAAG,uBAAU,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,MAAM,GAAG,IAAI,CAAC;QAElB,IAAI;YACF,MAAM,GAAG,MAAM,yCAAmB,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAC/F;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI;YACF,+BAAc,CAAC,MAAM,CAAC,CAAC;SACxB;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"} \ No newline at end of file diff --git a/dist/bin/entities/Config/logic/createConfiguration.js b/dist/bin/entities/Config/logic/createConfiguration.js new file mode 100644 index 000000000..d1e44e854 --- /dev/null +++ b/dist/bin/entities/Config/logic/createConfiguration.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = void 0; +const parseCliArgs_1 = require("./parseCliArgs"); +const loadFile_1 = require("../../../frameworks/filesystem/loadFile"); +const messages_1 = require("../../../frameworks/messages/messages"); +const errors_1 = require("../../../frameworks/errors/errors"); +async function createConfiguration(baseConfig, userConfigPath, cliArgs) { + if (!baseConfig) + throw new Error(errors_1.ErrorCreateConfigurationNoDefault); + if (!userConfigPath) + throw new Error(errors_1.ErrorCreateConfiguration); + const DEFAULT_CONFIG = baseConfig; + let RC_CONFIG = {}; + try { + const _RC_CONFIG = loadFile_1.loadFile(userConfigPath); + RC_CONFIG = _RC_CONFIG; + } + catch (e) { } + const ENV_CONFIG = { + token: process.env.FIGMA_TOKEN || '', + url: process.env.FIGMA_URL || '' + }; + const CLI_CONFIG = parseCliArgs_1.parseCliArgs(cliArgs); + const CONFIG = { + ...DEFAULT_CONFIG, + ...RC_CONFIG, + ...ENV_CONFIG, + ...CLI_CONFIG, + templates: { + ...DEFAULT_CONFIG.templates, + ...RC_CONFIG.templates, + ...CLI_CONFIG.templates + }, + skipFileGeneration: { + ...DEFAULT_CONFIG.skipFileGeneration, + ...RC_CONFIG.skipFileGeneration, + ...CLI_CONFIG.skipFileGeneration + } + }; + if (CONFIG.debugMode === true) + printConfigs(ENV_CONFIG, CLI_CONFIG, RC_CONFIG, CONFIG); + return CONFIG; +} +exports.createConfiguration = createConfiguration; +function printConfigs(envConfig, cliConfig, rcConfig, config) { + console.log(messages_1.MsgConfigDebugEnv); + console.log(envConfig); + console.log(messages_1.MsgConfigDebugCli); + console.log(cliConfig); + console.log(messages_1.MsgConfigDebugRc); + console.log(rcConfig); + console.log(messages_1.MsgConfigDebugFinal); + console.log(config); +} +//# sourceMappingURL=createConfiguration.js.map \ No newline at end of file diff --git a/dist/bin/entities/Config/logic/createConfiguration.js.map b/dist/bin/entities/Config/logic/createConfiguration.js.map new file mode 100644 index 000000000..43ad943c5 --- /dev/null +++ b/dist/bin/entities/Config/logic/createConfiguration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createConfiguration.js","sourceRoot":"","sources":["../../../../../bin/entities/Config/logic/createConfiguration.ts"],"names":[],"mappings":";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ACnB,SAAkC,EAClC,SAAkC,EAClC,QAAiC,EACjC,MAA+B;IAE/B,OAAO,CAAC,GAAG,CAAC,4BAAiB,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAC,4BAAiB,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAC,2BAAgB,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEtB,OAAO,CAAC,GAAG,CAAC,8BAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/Config/logic/parseCliArgs.js b/dist/bin/entities/Config/logic/parseCliArgs.js new file mode 100644 index 000000000..17b8913f5 --- /dev/null +++ b/dist/bin/entities/Config/logic/parseCliArgs.js @@ -0,0 +1,146 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseCliArgs = void 0; +const errors_1 = require("../../../frameworks/errors/errors"); +function parseCliArgs(argsArray) { + if (!argsArray) + throw new Error(errors_1.ErrorParseCliArgs); + if (argsArray.length === 0) + return {}; + const cliArguments = { + '--debug': () => (config.debugMode = true), + '-d': () => (config.debugMode = true), + '--fontUnit': (val) => (config.fontUnit = val.toLowerCase()), + '-fu': (val) => (config.fontUnit = val.toLowerCase()), + '--letterSpacingUnit': (val) => (config.letterSpacingUnit = val.toLowerCase()), + '-lsu': (val) => (config.letterSpacingUnit = val.toLowerCase()), + '--opacitiesUnit': (val) => (config.opacitiesUnit = val.toLowerCase()), + '-ou': (val) => (config.opacitiesUnit = val.toLowerCase()), + '--figmaData': (val) => (config.figmaData = val), + '-data': (val) => (config.figmaData = val), + '--figmagicFolder': (val) => (config.figmagicFolder = val), + '-base': (val) => (config.figmagicFolder = val), + '--outputFolderElements': (val) => (config.outputFolderElements = val), + '-elements': (val) => (config.outputFolderElements = val), + '--outputFolderGraphics': (val) => (config.outputFolderGraphics = val), + '-graphics': (val) => (config.outputFolderGraphics = val), + '--outputFolderTokens': (val) => (config.outputFolderTokens = val), + '-tokens': (val) => (config.outputFolderTokens = val), + '--outputFormatCss': (val) => (config.outputFormatCss = val.toLowerCase()), + '-fc': (val) => (config.outputFormatCss = val.toLowerCase()), + '--outputFormatDesc': (val) => (config.outputFormatDescription = val.toLowerCase()), + '-fd': (val) => (config.outputFormatDescription = val.toLowerCase()), + '--outputFormatElements': (val) => (config.outputFormatElements = val.toLowerCase()), + '-fe': (val) => (config.outputFormatElements = val.toLowerCase()), + '--outputFormatGraphics': (val) => (config.outputFormatGraphics = val.toLowerCase()), + '-fg': (val) => (config.outputFormatGraphics = val.toLowerCase()), + '--outputFormatStorybook': (val) => (config.outputFormatStorybook = val.toLowerCase()), + '-fs': (val) => (config.outputFormatStorybook = val.toLowerCase()), + '--outputFormatTokens': (val) => (config.outputFormatTokens = val.toLowerCase()), + '-ft': (val) => (config.outputFormatTokens = val.toLowerCase()), + '--outputScaleGraphics': (val) => (config.outputScaleGraphics = parseInt(val)), + '-scale': (val) => (config.outputScaleGraphics = parseInt(val)), + '--outputDataTypeToken': (val) => (config.outputDataTypeToken = val.toLowerCase()), + '-tokentype': (val) => (config.outputDataTypeToken = val.toLowerCase()), + '--recompileLocal': () => (config.recompileLocal = true), + '-local': () => (config.recompileLocal = true), + '--remSize': (val) => (config.remSize = parseInt(val)), + '-rem': (val) => (config.remSize = parseInt(val)), + '--forceUpdate': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + forceUpdate: true + }), + '-force': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + forceUpdate: true + }), + '--skipCss': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipCss: true + }), + '-nocss': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipCss: true + }), + '--skipDescription': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipDescription: true + }), + '-nodesc': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipDescription: true + }), + '--skipReact': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipReact: true + }), + '-noreact': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipReact: true + }), + '--skipStorybook': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipStorybook: true + }), + '-nostory': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipStorybook: true + }), + '--skipStyled': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipStyled: true + }), + '-nostyled': () => (config.skipFileGeneration = { + ...config.skipFileGeneration, + skipStyled: true + }), + '--spacingUnit': (val) => (config.spacingUnit = val.toLowerCase()), + '-s': (val) => (config.spacingUnit = val.toLowerCase()), + '--syncElements': () => (config.syncElements = true), + '-se': () => (config.syncElements = true), + '--syncGraphics': () => (config.syncGraphics = true), + '-sg': () => (config.syncGraphics = true), + '--syncTokens': () => (config.syncTokens = true), + '-st': () => (config.syncTokens = true), + '--templatePathReact': (val) => (config.templates = { + ...config.templates, + templatePathReact: val + }), + '-tpreact': (val) => (config.templates = { + ...config.templates, + templatePathReact: val + }), + '--templatePathStorybook': (val) => (config.templates = { + ...config.templates, + templatePathStorybook: val + }), + '-tpstory': (val) => (config.templates = { + ...config.templates, + templatePathStorybook: val + }), + '--templatePathStyled': (val) => (config.templates = { + ...config.templates, + templatePathStyled: val + }), + '-tpstyled': (val) => (config.templates = { + ...config.templates, + templatePathStyled: val + }), + '--token': (val) => (config.token = val), + '-t': (val) => (config.token = val), + '--url': (val) => (config.url = val), + '-u': (val) => (config.url = val), + '--usePostscriptFontNames': () => (config.usePostscriptFontNames = true), + '-ps': () => (config.usePostscriptFontNames = true) + }; + const config = {}; + const args = {}; + argsArray.forEach((arg) => (args[arg] = arg)); + Object.keys(args).forEach((arg, index) => { + if (cliArguments.hasOwnProperty(arg)) + cliArguments[arg](argsArray[index + 1]); + }); + return config; +} +exports.parseCliArgs = parseCliArgs; +//# sourceMappingURL=parseCliArgs.js.map \ No newline at end of file diff --git a/dist/bin/entities/Config/logic/parseCliArgs.js.map b/dist/bin/entities/Config/logic/parseCliArgs.js.map new file mode 100644 index 000000000..09a76234c --- /dev/null +++ b/dist/bin/entities/Config/logic/parseCliArgs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseCliArgs.js","sourceRoot":"","sources":["../../../../../bin/entities/Config/logic/parseCliArgs.ts"],"names":[],"mappings":";;;AAEA,8DAAsE;AAKtE,SAAgB,YAAY,CAAC,SAAmB;IAC9C,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;IACnD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAY,CAAC;IAEhD,MAAM,YAAY,GAAG;QACnB,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1C,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;QACrC,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACpE,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAC7D,qBAAqB,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,iBAAiB,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACtF,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,iBAAiB,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACvE,iBAAiB,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,GAAG,GAAG,CAAC,WAAW,EA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G,CAAC,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAgB,CAAC;AAC1B,CAAC;AA/JD,oCA+JC"} \ No newline at end of file diff --git a/dist/bin/entities/Config/logic/validateConfig.js b/dist/bin/entities/Config/logic/validateConfig.js new file mode 100644 index 000000000..0af09bd20 --- /dev/null +++ b/dist/bin/entities/Config/logic/validateConfig.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateConfig = void 0; +const errors_1 = require("../../../frameworks/errors/errors"); +function validateConfig(config) { + if (!config) + throw new Error('validateConfig error'); + try { + validateFontUnit(config.fontUnit); + validateLetterSpacingUnit(config.letterSpacingUnit); + validateOpacitiesUnit(config.opacitiesUnit); + validateFileName(config.figmaData); + validateFolderName(config.figmagicFolder); + validateFolderName(config.outputFolderElements); + validateFolderName(config.outputFolderGraphics); + validateFolderName(config.outputFolderTokens); + validateOutputFormatCss(config.outputFormatCss); + validateOutputFormatDesc(config.outputFormatDescription); + validateOutputFormatElements(config.outputFormatElements); + validateOutputFormatGraphics(config.outputFormatGraphics); + validateOutputFormatStorybook(config.outputFormatStorybook); + validateOutputFormatTokens(config.outputFormatTokens); + validateOutputScaleGraphics(config.outputScaleGraphics); + validateOutputDataTypeToken(config.outputDataTypeToken); + validateSpacingUnit(config.spacingUnit); + validateTemplatePathReact(config.templates.templatePathReact); + validateTemplatePathStorybook(config.templates.templatePathStorybook); + validateTemplatePathStyled(config.templates.templatePathStyled); + return true; + } + catch (error) { + throw new Error(error); + } +} +exports.validateConfig = validateConfig; +const validatorLists_1 = require("../../../frameworks/system/validatorLists"); +const validateFontUnit = (unit) => { + if (validatorLists_1.validFontUnitList.includes(unit)) + return true; + throw new Error(errors_1.ErrorValidateConfigFontUnit); +}; +const validateLetterSpacingUnit = (unit) => { + if (validatorLists_1.validLetterSpacingUnitList.includes(unit)) + return true; + throw new Error(errors_1.ErrorValidateConfigLetterSpacingUnit); +}; +const validateOpacitiesUnit = (unit) => { + if (validatorLists_1.validOpacitiesUnitList.includes(unit)) + return true; + throw new Error(errors_1.ErrorValidateConfigOpacitiesUnit); +}; +const validateFileName = (filename) => { + if (filename) + return true; + throw new Error(errors_1.ErrorValidateConfigFileName); +}; +const validateFolderName = (filename) => { + if (filename) + return true; + throw new Error(errors_1.ErrorValidateConfigFolderName); +}; +const validateOutputFormatCss = (format) => { + if (validatorLists_1.validOutputFormatCssList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputFormatCss); +}; +const validateOutputFormatDesc = (format) => { + if (validatorLists_1.validOutputFormatDescList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputFormatDesc); +}; +const validateOutputFormatElements = (format) => { + if (validatorLists_1.validOutputFormatElementsList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputFormatElements); +}; +const validateOutputFormatGraphics = (format) => { + if (validatorLists_1.validOutputFormatGraphicsList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputFormatGraphics); +}; +const validateOutputFormatStorybook = (format) => { + if (validatorLists_1.validOutputFormatStorybookList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputFormatStorybook); +}; +const validateOutputFormatTokens = (format) => { + if (validatorLists_1.validOutputFormatTokensList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputFormatTokens); +}; +const validateOutputScaleGraphics = (scale) => { + if (scale && typeof scale === 'number' && scale > 0) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputScaleGraphics); +}; +const validateOutputDataTypeToken = (format) => { + if (!format || validatorLists_1.validOutputDataTypeTokenList.includes(format)) + return true; + throw new Error(errors_1.ErrorValidateConfigOutputDataTypeToken); +}; +const validateSpacingUnit = (unit) => { + if (validatorLists_1.validSpacingUnitList.includes(unit)) + return true; + throw new Error(errors_1.ErrorValidateConfigSpacingUnit); +}; +const validateTemplatePathReact = (path) => { + if (path) + return true; + throw new Error(errors_1.ErrorValidateConfigTemplatePathReact); +}; +const validateTemplatePathStorybook = (path) => { + if (path) + return true; + throw new Error(errors_1.ErrorValidateConfigTemplatePathStorybook); +}; +const validateTemplatePathStyled = (path) => { + if (path) + return true; + throw new Error(errors_1.ErrorValidateConfigTemplatePathStyled); +}; +//# sourceMappingURL=validateConfig.js.map \ No newline at end of file diff --git a/dist/bin/entities/Config/logic/validateConfig.js.map b/dist/bin/entities/Config/logic/validateConfig.js.map new file mode 100644 index 000000000..ceff40646 --- /dev/null +++ b/dist/bin/entities/Config/logic/validateConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validateConfig.js","sourceRoot":"","sources":["../../../../../bin/entities/Config/logic/validateConfig.ts"],"names":[],"mappings":";;;AAEA,8DAkB2C;AAE3C,SAAgB,cAAc,CAAC,MAAc;IAC3C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACrD,IAAI;QACF,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,yBAAyB,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACpD,qBAAqB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC5C,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACnC,kBAAkB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC1C,kBAAkB,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChD,kBAAkB,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChD,kBAAkB,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC9C,uBAAuB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAChD,wBAAwB,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACzD,4BAA4B,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAC1D,4BAA4B,CAAC,MAAM,CAAC,oBAAoB,CA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,GAAG,CAAC,IAAY,EAAW,EAAE;IAC3D,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,IAAI,KAAK,CAAC,8CAAqC,CAAC,CAAC;AACzD,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/index.js b/dist/bin/entities/FigmagicElement/index.js new file mode 100644 index 000000000..d513d5fea --- /dev/null +++ b/dist/bin/entities/FigmagicElement/index.js @@ -0,0 +1,188 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeFigmagicElement = void 0; +const parseCssFromElement_1 = require("./logic/parseCssFromElement"); +const parseTypographyStylingFromElement_1 = require("./logic/parseTypographyStylingFromElement"); +const processNestedCss_1 = require("./logic/processNestedCss"); +const messages_1 = require("../../frameworks/messages/messages"); +const errors_1 = require("../../frameworks/errors/errors"); +exports.makeFigmagicElement = (element, config, description = '') => { + return new FigmagicElement(element, config, description); +}; +class FigmagicElement { + constructor(element, config, description = '') { + this.id = element.id; + this.name = element.name; + this.children = element.children; + this.type = element.type; + this.config = config; + this.description = description; + this.element = ``; + this.css = ``; + this.html = ``; + this.extraProps = ``; + this.text = ``; + this.imports = []; + this.init(); + } + init() { + this.setElement(); + this.setDescription(); + const html = ``; + const extraProps = ``; + const text = ``; + const { updatedCss, updatedImports } = this.handleElements(); + this.setCss(updatedCss); + this.addHtml(html); + this.addExtraProps(extraProps); + this.addText(text); + this.imports = [...new Set(updatedImports)]; + } + handleElements() { + try { + if (this.children?.every((a) => a.type === 'GROUP')) + return this.handleNestedElements(); + else + return this.handleFlatElements(); + } + catch (error) { + throw new Error(error); + } + } + setCss(css) { + this.css = css; + } + addHtml(html) { + this.html += html; + } + replaceHtml(match, replacement) { + this.html = this.html.replace(match, replacement); + } + addExtraProps(extraProps) { + this.extraProps += extraProps; + } + addText(text) { + this.text += text; + } + setElement() { + const ELEMENT_TYPE = (() => { + const _ELEMENT = this.description.match(/element=(.*)/); + if (_ELEMENT && _ELEMENT[1]) + return _ELEMENT[1]; + return 'div'; + })(); + const HTML = `<${ELEMENT_TYPE}>{{TEXT}}`; + this.addHtml(HTML); + this.element = ELEMENT_TYPE; + } + setDescription() { + let description = this.description; + if (this.description.match(/description=(.*)/)) { + const INDEX = this.description.indexOf('description='); + const MARKER_LENGTH = 12; + description = description.slice(INDEX + MARKER_LENGTH, description.length); + description.replace(/^\s*\n/gm, ''); + this.description = description; + } + } + setPlaceholderText() { + this.children?.forEach((child) => { + if ((child.type === 'TEXT' && child.name.toLowerCase() === 'placeholder') || + (child.type === 'TEXT' && child.name.toLowerCase() === ':placeholder')) { + this.addExtraProps(`placeholder="${child.characters}"`); + } + }); + } + setElementType() { + if (this.description.match(/type=(.*)/)) { + const TYPE = (() => { + const _TYPE = this.description.match(/type=(.*)/); + if (_TYPE && _TYPE[1]) + return _TYPE[1]; + })(); + if (this.extraProps && !this.extraProps.includes(`type="${TYPE}`)) + this.addExtraProps(`type="${TYPE}" `); + } + } + handleNestedElements() { + try { + let css = ``; + let imports = []; + this.children?.forEach((el) => { + if (!el.name) + return; + if (el.name[0] === '_') + return; + const MAIN_ELEMENT = el.children?.filter((e) => e.type === 'RECTANGLE' && e.name[0] !== '_')[0]; + if (!MAIN_ELEMENT) + throw new Error(errors_1.ErrorProcessElementsNoMainElement); + const TEXT_ELEMENT = el.children?.filter((e) => e.type === 'TEXT' && e.name[0] !== '_')[0]; + this.setPlaceholderText(); + this.setElementType(); + const FIXED_NAME = MAIN_ELEMENT.name.replace(/\s/gi, ''); + console.log(messages_1.MsgProcessElementsCreatingElement(MAIN_ELEMENT.name, FIXED_NAME)); + const { updatedCss, updatedImports } = parseCssFromElement_1.parseCssFromElement(MAIN_ELEMENT, TEXT_ELEMENT, this.config.remSize, this.config.outputFormatTokens, this.config.outputFolderTokens); + css += `\n.${FIXED_NAME} {\n${updatedCss}}`; + imports = imports.concat(updatedImports); + if (TEXT_ELEMENT) { + const { updatedCss, updatedImports } = parseTypographyStylingFromElement_1.parseTypographyStylingFromElement(TEXT_ELEMENT, this.config.remSize, this.config.outputFormatTokens, this.config.letterSpacingUnit, this.config.outputFolderTokens); + css += `\n.${FIXED_NAME} {\n${updatedCss}}`; + imports = imports.concat(updatedImports); + this.text = TEXT_ELEMENT.characters || ''; + } + }); + const PROCESSED_CSS = processNestedCss_1.processNestedCss(css); + return { updatedCss: PROCESSED_CSS, updatedImports: imports }; + } + catch (error) { + throw new Error(error); + } + } + handleFlatElements() { + try { + let css = `\n`; + let imports = []; + const MAIN_ELEMENT = this.children?.filter((element) => element.name === this.name)[0]; + const TEXT_ELEMENT = this.children?.filter((element) => element.type === 'TEXT')[0]; + this.setPlaceholderText(); + this.setElementType(); + if (TEXT_ELEMENT) { + const { updatedCss, updatedImports } = parseTypographyStylingFromElement_1.parseTypographyStylingFromElement(TEXT_ELEMENT, this.config.remSize, this.config.outputFormatTokens, this.config.letterSpacingUnit, this.config.outputFolderTokens); + css += updatedCss; + imports = imports.concat(updatedImports); + this.text = TEXT_ELEMENT.characters || ''; + } + this.replaceHtml('{{TEXT}}', this.text || ''); + if (MAIN_ELEMENT) { + const { updatedCss, updatedImports } = this.processCssSelfnamedLayer(MAIN_ELEMENT, TEXT_ELEMENT); + const COMBINED_CSS = css + updatedCss; + let processedCss = Array.from(new Set(COMBINED_CSS.split(/\n/gi))).toString(); + processedCss = processedCss.replace(/;,/gi, ';\n '); + css = processedCss; + imports = imports.concat(updatedImports); + } + return { updatedCss: css, updatedImports: imports }; + } + catch (error) { + throw new Error(error); + } + } + processCssSelfnamedLayer(layoutElement, textElement = null) { + try { + let css = ``; + let imports = []; + if (layoutElement) { + const FIXED_NAME = this.name.replace(/\s/gi, ''); + console.log(messages_1.MsgProcessElementsCreatingElement(this.name, FIXED_NAME)); + const { updatedCss, updatedImports } = parseCssFromElement_1.parseCssFromElement(layoutElement, textElement, this.config.remSize, this.config.outputFormatTokens, this.config.outputFolderTokens); + css += updatedCss; + imports = imports.concat(updatedImports); + } + return { updatedCss: css, updatedImports: imports }; + } + catch (error) { + throw new Error(error); + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/index.js.map b/dist/bin/entities/FigmagicElement/index.js.map new file mode 100644 index 000000000..1ec49f820 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../bin/entities/FigmagicElement/index.ts"],"names":[],"mappings":";;;AAKA,qEAAkE;AAClE,iGAA8F;AAC9F,+DAA4D;AAE5D,iEAAuF;AACvF,2DAAmF;AAKtE,QAAA,mBAAmB,GAAG,CACjC,OAAqB,EACrB,MAAc,EACd,WAAW,GAAG,EAAE,EACC,EAAE;IACnB,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,eAAe;IAenB,YAAY,OAAqB,EAAE,MAAc,EAAE,WAAW,GAAG,EAAE;QAEjE,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAGzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAElB,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,IAAI;QACF,I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M,CAAC,kBAAkB,EAC9B,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAC/B,CAAC;gBAEF,GAAG,IAAI,UAAU,CAAC;gBAClB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;aAC1C;YAED,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;SACrD;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/getFileContents.js b/dist/bin/entities/FigmagicElement/logic/getFileContents.js new file mode 100644 index 000000000..448fcc03b --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/getFileContents.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getFileContents = void 0; +const tslib_1 = require("tslib"); +const path = tslib_1.__importStar(require("path")); +const sliceOutObjectFromFile_1 = require("./sliceOutObjectFromFile"); +const errors_1 = require("../../../frameworks/errors/errors"); +function getFileContents(filepath, filename, format) { + try { + if (!filepath || !filename || !format) + throw new Error(errors_1.ErrorGetFileContents); + const FILE = path.join(`${process.cwd()}`, filepath, `${filename}.${format}`); + return sliceOutObjectFromFile_1.sliceOutObjectFromFile(FILE); + } + catch (error) { + throw new Error(errors_1.ErrorGetFileContents); + } +} +exports.getFileContents = getFileContents; +//# sourceMappingURL=getFileContents.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/getFileContents.js.map b/dist/bin/entities/FigmagicElement/logic/getFileContents.js.map new file mode 100644 index 000000000..e18b08ef2 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/getFileContents.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFileContents.js","sourceRoot":"","sources":["../../../../../bin/entities/FigmagicElement/logic/getFileContents.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAE7B,qEAAkE;AAElE,8DAAyE;AAKzE,SAAgB,eAAe,CAC7B,QAAgB,EAChB,QAAgB,EAChB,MAAc;IAEd,IAAI;QACF,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;QAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAC;QAC9E,OAAO,+CAAsB,CAAC,IAAI,CAAC,CAAC;KACrC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;KACvC;AACH,CAAC;AAZD,0CAYC"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js b/dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js new file mode 100644 index 000000000..db6766913 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseCssFromElement = void 0; +const tslib_1 = require("tslib"); +const path = tslib_1.__importStar(require("path")); +const getFileContents_1 = require("./getFileContents"); +const parsers_1 = require("./parsers"); +const errors_1 = require("../../../frameworks/errors/errors"); +function parseCssFromElement(layoutElement, textElement, remSize, outputFormatToken, outputFolderTokens) { + try { + if (!layoutElement || !remSize || !outputFormatToken || !outputFolderTokens) + throw new Error(errors_1.ErrorParseCssFromElement); + const PATH = process.env.IS_TEST ? path.join(`testdata`, `tokens`) : outputFolderTokens; + const { borderWidths, colors, radii, shadows, spacing } = getFiles(PATH, outputFormatToken); + let css = `width: 100%;\nbox-sizing: border-box;\nborder: 0;\nborder-style: solid;\n`; + let imports = []; + const PADDING_Y = textElement + ? parsers_1.getPaddingY(textElement, layoutElement) + : null; + const PADDING_X = textElement + ? parsers_1.getPaddingX(textElement, layoutElement) + : null; + if (PADDING_Y && PADDING_X) { + const PADDING = { + ...PADDING_Y, + ...PADDING_X + }; + const PARSED_PADDING = parsers_1.parsePadding(css, imports, { + padding: PADDING, + spacing, + remSize + }); + css += PARSED_PADDING.css; + if (PARSED_PADDING.imports) + imports = imports.concat(PARSED_PADDING.imports); + } + const HEIGHT = layoutElement.absoluteBoundingBox + ? layoutElement.absoluteBoundingBox.height + : null; + if (HEIGHT) { + const parsedValue = parsers_1.parseHeight(css, imports, { spacing, height: HEIGHT, remSize }); + css += parsedValue.css; + if (parsedValue.imports) + imports = imports.concat(parsedValue.imports); + } + const BACKGROUND_COLOR = parsers_1.getBackgroundColor(layoutElement); + if (BACKGROUND_COLOR) { + const parsedValue = parsers_1.parseBackgroundColor(css, imports, { + colors, + backgroundColor: BACKGROUND_COLOR, + remSize + }); + css += parsedValue.css; + if (parsedValue.imports) + imports = imports.concat(parsedValue.imports); + } + const BORDER_WIDTH = layoutElement.strokeWeight ? `${layoutElement.strokeWeight}px` : null; + if (BORDER_WIDTH) { + const parsedValue = parsers_1.parseBorderWidth(css, imports, { + borderWidths, + borderWidth: BORDER_WIDTH, + remSize + }); + css += parsedValue.css; + if (parsedValue.imports) + imports = imports.concat(parsedValue.imports); + } + const BORDER_COLOR = parsers_1.getBorderColor(layoutElement); + if (BORDER_COLOR) { + const parsedValue = parsers_1.parseBorderColor(css, imports, { + colors, + borderColor: BORDER_COLOR, + remSize + }); + css += parsedValue.css; + if (parsedValue.imports) + imports = imports.concat(parsedValue.imports); + } + const BORDER_RADIUS = layoutElement.cornerRadius ? `${layoutElement.cornerRadius}px` : null; + if (BORDER_RADIUS) { + const parsedValue = parsers_1.parseBorderRadius(css, imports, { + radii, + borderRadius: BORDER_RADIUS, + remSize + }); + css += parsedValue.css; + if (parsedValue.imports) + imports = imports.concat(parsedValue.imports); + } + const SHADOW = parsers_1.getShadow(layoutElement); + if (SHADOW) { + const parsedValue = parsers_1.parseShadow(css, imports, { shadows, shadow: SHADOW, remSize }); + css += parsedValue.css; + if (parsedValue.imports) + imports = imports.concat(parsedValue.imports); + } + const NEW_CSS = reduceDuplicates(css); + return { updatedCss: NEW_CSS, updatedImports: imports }; + } + catch (error) { + throw new Error(errors_1.ErrorParseCssFromElement); + } +} +exports.parseCssFromElement = parseCssFromElement; +const reduceDuplicates = (str) => Array.from(new Set(str.split(/;/gi))) + .toString() + .replace(/,/gi, ';'); +const getFiles = (path, outputFormatToken) => { + try { + const borderWidths = getFileContents_1.getFileContents(path, 'borderWidths', outputFormatToken); + const colors = getFileContents_1.getFileContents(path, 'colors', outputFormatToken); + const radii = getFileContents_1.getFileContents(path, 'radii', outputFormatToken); + const shadows = getFileContents_1.getFileContents(path, 'shadows', outputFormatToken); + const spacing = getFileContents_1.getFileContents(path, 'spacing', outputFormatToken); + return { + borderWidths, + colors, + radii, + shadows, + spacing + }; + } + catch (error) { + throw new Error(errors_1.ErrorGetFiles); + } +}; +//# sourceMappingURL=parseCssFromElement.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js.map b/dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js.map new file mode 100644 index 000000000..3bd6b729d --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/parseCssFromElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseCssFromElement.js","sourceRoot":"","sources":["../../../../../bin/entities/FigmagicElement/logic/parseCssFromElement.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAK7B,uDAAoD;AACpD,uCAemB;AAEnB,8DAA4F;AAK5F,SAAgB,mBAAmB,CACjC,aAAoB,EACpB,WAAyB,EACzB,OAAe,EACf,iBAAyB,EACzB,kBAA0B;IAE1B,IAAI;QACF,IAAI,CAAC,aAAa,IAAI,CAAC,OAAO,IAAI,CAAC,iBAAiB,IAAI,CAAC,kBAAkB;YACzE,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;QAE5C,MAAM,I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,CAAC,KAAK,CAAC,CAAC,CAAC;KAClC,QAAQ,EAAE;KACV,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,iBAAyB,EAAO,EAAE;IAChE,IAAI;QAEF,MAAM,YAAY,GAAG,iCAAe,CAAC,IAAI,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,iCAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAClE,MAAM,KAAK,GAAG,iCAAe,CAAC,IAAI,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,iCAAe,CAAC,IAAI,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,iCAAe,CAAC,IAAI,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAEpE,OAAO;YACL,YAAY;YACZ,MAAM;YACN,KAAK;YACL,OAAO;YACP,OAAO;SACR,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,sBAAa,CAAC,CAAC;KAChC;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js b/dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js new file mode 100644 index 000000000..101a08a25 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTypographyStylingFromElement = void 0; +const tslib_1 = require("tslib"); +const path = tslib_1.__importStar(require("path")); +const getTokenMatch_1 = require("./getTokenMatch"); +const getFileContents_1 = require("./getFileContents"); +const roundColorValue_1 = require("../../../frameworks/string/roundColorValue"); +const errors_1 = require("../../../frameworks/errors/errors"); +function parseTypographyStylingFromElement(textElement, remSize, outputFormatTokens, letterSpacingUnit, outputFolderTokens) { + try { + if (!textElement || !remSize) + throw new Error(errors_1.ErrorParseTypographyStylingFromElement); + const PATH = process.env.IS_TEST ? path.join('testdata', 'tokens') : outputFolderTokens; + const { colors, fontFamilies, fontSizes, fontWeights, letterSpacings, lineHeights } = getFiles(PATH, outputFormatTokens); + let css = ``; + const imports = []; + const FONT_COLOR = getFontColor(textElement); + if (FONT_COLOR) { + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(colors, 'colors', 'color', FONT_COLOR, remSize); + css += updatedCss; + updatedImports.forEach((i) => imports.push(i)); + } + const FONT_SIZE = getFontSize(textElement); + if (FONT_SIZE) { + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(fontSizes, 'fontSizes', 'font-size', FONT_SIZE, remSize); + css += updatedCss; + updatedImports.forEach((i) => imports.push(i)); + } + const FONT_FAMILY = getFontFamily(textElement); + if (FONT_FAMILY) { + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(fontFamilies, 'fontFamilies', 'font-family', FONT_FAMILY, remSize); + css += updatedCss; + updatedImports.forEach((i) => imports.push(i)); + } + const FONT_WEIGHT = getFontWeight(textElement); + if (FONT_WEIGHT) { + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(fontWeights, 'fontWeights', 'font-weight', FONT_WEIGHT, remSize); + css += updatedCss; + updatedImports.forEach((i) => imports.push(i)); + } + const FONT_LINE_HEIGHT = getFontLineHeight(textElement); + if (FONT_LINE_HEIGHT) { + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(lineHeights, 'lineHeights', 'line-height', FONT_LINE_HEIGHT, remSize); + css += updatedCss; + updatedImports.forEach((i) => imports.push(i)); + } + const LETTER_SPACING = getFontLetterSpacing(textElement); + if (LETTER_SPACING && FONT_SIZE) { + const SIZE = LETTER_SPACING / FONT_SIZE; + const SIZE_STRING = `${SIZE}${letterSpacingUnit}`; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(letterSpacings, 'letterSpacings', 'letter-spacing', SIZE_STRING, remSize); + css += updatedCss; + updatedImports.forEach((i) => imports.push(i)); + } + const FONT_ALIGNMENT = getFontAlignment(textElement); + if (FONT_ALIGNMENT) { + const ALIGNMENT = FONT_ALIGNMENT.toLowerCase(); + css += `text-align: ${ALIGNMENT};\n`; + } + const FONT_CASE = getFontCase(textElement); + if (FONT_CASE) + css += `text-transform: ${FONT_CASE};\n`; + const NEW_CSS = reduceCssDuplicates(css); + return { updatedCss: NEW_CSS, updatedImports: imports }; + } + catch (error) { + throw new Error(errors_1.ErrorParseTypographyStylingFromElement); + } +} +exports.parseTypographyStylingFromElement = parseTypographyStylingFromElement; +const getFiles = (path, outputFormatTokens) => { + try { + const colors = getFileContents_1.getFileContents(path, 'colors', outputFormatTokens); + const fontFamilies = getFileContents_1.getFileContents(path, 'fontFamilies', outputFormatTokens); + const fontSizes = getFileContents_1.getFileContents(path, 'fontSizes', outputFormatTokens); + const fontWeights = getFileContents_1.getFileContents(path, 'fontWeights', outputFormatTokens); + const letterSpacings = getFileContents_1.getFileContents(path, 'letterSpacings', outputFormatTokens); + const lineHeights = getFileContents_1.getFileContents(path, 'lineHeights', outputFormatTokens); + return { + colors, + fontFamilies, + fontSizes, + fontWeights, + letterSpacings, + lineHeights + }; + } + catch (error) { + throw new Error(error); + } +}; +const reduceCssDuplicates = (css) => Array.from(new Set(css.split(/;/gi))) + .toString() + .replace(/,/gi, ';'); +const getFontColor = (textElement) => { + if (textElement.fills) { + if (textElement.fills[0] && textElement.fills[0].type === 'SOLID') { + if (!textElement.fills[0].color) + throw new Error(errors_1.ErrorGetFontColor); + const R = roundColorValue_1.roundColorValue(textElement.fills[0].color.r); + const G = roundColorValue_1.roundColorValue(textElement.fills[0].color.g); + const B = roundColorValue_1.roundColorValue(textElement.fills[0].color.b); + const A = roundColorValue_1.roundColorValue(textElement.fills[0].color.a, 1); + return `rgba(${R}, ${G}, ${B}, ${A})`; + } + } + return null; +}; +const getFontSize = (textElement) => { + if (textElement.type === 'TEXT' && textElement.style) + return parseFloat(textElement.style.fontSize); + return null; +}; +const getFontFamily = (textElement) => { + if (textElement.type === 'TEXT' && textElement.style) + return textElement.style.fontPostScriptName; + return null; +}; +const getFontWeight = (textElement) => { + if (textElement.type === 'TEXT' && textElement.style) + return textElement.style.fontWeight; + return null; +}; +const getFontLineHeight = (textElement) => { + if (textElement.type === 'TEXT') { + if (textElement.style) { + if (textElement.style.lineHeightPercentFontSize) { + return textElement.style.lineHeightPercentFontSize / 100; + } + else + return 1.0; + } + } + return null; +}; +const getFontAlignment = (textElement) => { + if (textElement.type === 'TEXT' && textElement.style) + return textElement.style.textAlignHorizontal; + return null; +}; +const getFontLetterSpacing = (textElement) => { + if (textElement.type === 'TEXT' && textElement.style && textElement.style.letterSpacing) + return parseFloat(textElement.style.letterSpacing); + return null; +}; +const getFontCase = (textElement) => { + if (textElement.type === 'TEXT' && textElement.style && textElement.style.textCase) { + if (textElement.style.textCase === 'LOWER') + return 'lowercase'; + if (textElement.style.textCase === 'UPPER') + return 'uppercase'; + if (textElement.style.textCase === 'TITLE') + return 'capitalize'; + } + return null; +}; +//# sourceMappingURL=parseTypographyStylingFromElement.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js.map b/dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js.map new file mode 100644 index 000000000..4df5b689e --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseTypographyStylingFromElement.js","sourceRoot":"","sources":["../../../../../bin/entities/FigmagicElement/logic/parseTypographyStylingFromElement.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAK7B,mDAAgD;AAChD,uDAAoD;AAEpD,gFAA6E;AAE7E,8DAG2C;AAK3C,SAAgB,iCAAiC,CAC/C,WAAkB,EAClB,OAAe,EACf,kBAA0B,EAC1B,iBAAyB,EACzB,kBAA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AI,KAAK,MAAM,IAAI,WAAW,CAAC,KAAK;QAClD,OAAO,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,WAAkB,EAAiB,EAAE;IACjE,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,aAAa;QACrF,OAAO,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,WAAkB,EAAiB,EAAE;IACxD,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE;QAClF,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;YAAE,OAAO,WAAW,CAAC;QAC/D,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;YAAE,OAAO,WAAW,CAAC;QAC/D,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;YAAE,OAAO,YAAY,CAAC;KACjE;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/parsers.js b/dist/bin/entities/FigmagicElement/logic/parsers.js new file mode 100644 index 000000000..c6a62cbaf --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/parsers.js @@ -0,0 +1,235 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.updateParsing = exports.parseShadow = exports.getShadow = exports.parseBorderRadius = exports.parseBorderColor = exports.getBorderColor = exports.parseBorderWidth = exports.parseBackgroundColor = exports.getBackgroundColor = exports.parseHeight = exports.parsePadding = exports.getPaddingX = exports.getPaddingY = void 0; +const getTokenMatch_1 = require("./getTokenMatch"); +const roundColorValue_1 = require("../../../frameworks/string/roundColorValue"); +const errors_1 = require("../../../frameworks/errors/errors"); +function getPaddingY(textElement, element) { + try { + if (!textElement) + return null; + if (!element.absoluteBoundingBox || + !element.absoluteBoundingBox.height || + !textElement.absoluteBoundingBox || + !textElement.absoluteBoundingBox.height) + throw new Error(errors_1.ErrorGetPaddingY); + const PARENT_HEIGHT = element.absoluteBoundingBox.height; + const TEXT_HEIGHT = textElement.absoluteBoundingBox.height; + const PADDING_TOP = textElement.absoluteBoundingBox.y - element.absoluteBoundingBox.y; + const PADDING_BOTTOM = PARENT_HEIGHT - (PADDING_TOP + TEXT_HEIGHT); + return { + top: Math.round(PADDING_TOP), + bottom: Math.round(PADDING_BOTTOM) + }; + } + catch (error) { + throw new Error(errors_1.ErrorGetPaddingY); + } +} +exports.getPaddingY = getPaddingY; +function getPaddingX(textElement, element) { + try { + if (!textElement || !element) + return null; + if (!textElement.absoluteBoundingBox || !element.absoluteBoundingBox) + throw new Error(errors_1.ErrorGetPaddingX); + const PARENT_WIDTH = element.absoluteBoundingBox.width; + const TEXT_WIDTH = textElement.absoluteBoundingBox.width; + const PADDING_LEFT = textElement.absoluteBoundingBox.x - element.absoluteBoundingBox.x; + const PADDING_RIGHT = PARENT_WIDTH - (PADDING_LEFT + TEXT_WIDTH); + return { + left: Math.round(PADDING_LEFT), + right: Math.round(PADDING_RIGHT) + }; + } + catch (error) { + throw new Error(errors_1.ErrorGetPaddingX); + } +} +exports.getPaddingX = getPaddingX; +function parsePadding(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParsePadding); + const { padding, spacing, remSize } = params; + if (!(padding && Object.keys(padding).length > 0)) + return { css, imports }; + const PADDINGS = Object.values(padding).map((p) => p); + if (PADDINGS.every((item) => item === 0)) + return updateParsing(css, null, imports, null); + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(spacing, 'spacing', 'padding', padding, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParsePadding); + } +} +exports.parsePadding = parsePadding; +function parseHeight(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParseHeight); + const { spacing, height, remSize } = params; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(spacing, 'spacing', 'height', height, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParseHeight); + } +} +exports.parseHeight = parseHeight; +function getBackgroundColor(element) { + if (!element) + throw new Error(errors_1.ErrorGetBackgroundColor); + if (!element.fills) + return null; + const fills = element.fills.filter((f) => f.type === 'SOLID'); + if (fills.length > 0) { + if (!fills[0].color) + throw new Error(errors_1.ErrorGetBackgroundColor); + const R = roundColorValue_1.roundColorValue(fills[0].color.r); + const G = roundColorValue_1.roundColorValue(fills[0].color.g); + const B = roundColorValue_1.roundColorValue(fills[0].color.b); + const A = roundColorValue_1.roundColorValue(fills[0].color.a, 1); + return `rgba(${R}, ${G}, ${B}, ${A})`; + } + const gradients = element.fills.filter((f) => f.type === 'GRADIENT_LINEAR'); + if (fills.length === 0 && gradients.length > 0) { + let str = `linear-gradient(`; + const GRADIENT_STOPS = gradients[0].gradientStops ? gradients[0].gradientStops : null; + if (!GRADIENT_STOPS) + throw new Error(); + GRADIENT_STOPS.forEach((fill, index) => { + const R = roundColorValue_1.roundColorValue(fill.color.r, 255); + const G = roundColorValue_1.roundColorValue(fill.color.g, 255); + const B = roundColorValue_1.roundColorValue(fill.color.b, 255); + const A = roundColorValue_1.roundColorValue(fill.color.a, 255); + const POS = roundColorValue_1.roundColorValue(fill.position, 100); + if (index > 0) + str += ` `; + str += `rgba(${R}, ${G}, ${B}, ${A}) ${POS}%`; + if (index < GRADIENT_STOPS.length - 1) + str += `,`; + if (index >= GRADIENT_STOPS.length - 1) + str += `)`; + }); + return str; + } + return null; +} +exports.getBackgroundColor = getBackgroundColor; +function parseBackgroundColor(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParseBackgroundColor); + const { colors, backgroundColor, remSize } = params; + const PROPERTY = backgroundColor.includes('gradient') ? 'background' : 'background-color'; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(colors, 'colors', PROPERTY, backgroundColor, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParseBackgroundColor); + } +} +exports.parseBackgroundColor = parseBackgroundColor; +function parseBorderWidth(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParseBorderWidth); + const { borderWidths, borderWidth, remSize } = params; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(borderWidths, 'borderWidths', 'border-width', borderWidth, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParseBorderWidth); + } +} +exports.parseBorderWidth = parseBorderWidth; +function getBorderColor(element) { + if (!element) + throw new Error(errors_1.ErrorGetBorderColor); + if (!(element.strokes && element.strokes.length > 0 && element.strokes[0].type === 'SOLID')) + return null; + if (!element.strokes[0].color) + throw new Error('asdf'); + const R = roundColorValue_1.roundColorValue(element.strokes[0].color.r); + const G = roundColorValue_1.roundColorValue(element.strokes[0].color.g); + const B = roundColorValue_1.roundColorValue(element.strokes[0].color.b); + const A = roundColorValue_1.roundColorValue(element.strokes[0].color.a, 1); + return `rgba(${R}, ${G}, ${B}, ${A})`; +} +exports.getBorderColor = getBorderColor; +function parseBorderColor(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParseBorderColor); + const { colors, borderColor, remSize } = params; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(colors, 'colors', 'border-color', borderColor, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParseBorderColor); + } +} +exports.parseBorderColor = parseBorderColor; +function parseBorderRadius(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParseBorderRadius); + const { radii, borderRadius, remSize } = params; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(radii, 'radii', 'border-radius', borderRadius, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParseBorderRadius); + } +} +exports.parseBorderRadius = parseBorderRadius; +function getShadow(element) { + try { + if (!element) + throw new Error(errors_1.ErrorGetShadow); + if (!(element.effects && element.effects[0] && element.effects[0].type === 'DROP_SHADOW')) + return null; + const DROP_SHADOW = element.effects[0]; + const X = DROP_SHADOW.offset.x; + const Y = DROP_SHADOW.offset.y; + const RADIUS = DROP_SHADOW.radius; + const R = roundColorValue_1.roundColorValue(DROP_SHADOW.color.r); + const G = roundColorValue_1.roundColorValue(DROP_SHADOW.color.g); + const B = roundColorValue_1.roundColorValue(DROP_SHADOW.color.b); + const A = roundColorValue_1.roundColorValue(DROP_SHADOW.color.a, 1); + return `${X}px ${Y}px ${RADIUS}px rgba(${R}, ${G}, ${B}, ${A})`; + } + catch (error) { + throw new Error(errors_1.ErrorGetShadow); + } +} +exports.getShadow = getShadow; +function parseShadow(css, imports, params) { + try { + if (!css || !imports || !params) + throw new Error(errors_1.ErrorParseShadow); + const { shadows, shadow, remSize } = params; + const { updatedCss, updatedImports } = getTokenMatch_1.getTokenMatch(shadows, 'shadows', 'box-shadow', shadow, remSize); + return updateParsing(css, updatedCss, imports, updatedImports); + } + catch (error) { + throw new Error(errors_1.ErrorParseShadow); + } +} +exports.parseShadow = parseShadow; +function updateParsing(css, updatedCss, imports, updatedImports) { + try { + if (!css || !imports) + throw new Error(errors_1.ErrorUpdateParsing); + const CSS = updatedCss ? (css += updatedCss) : css; + const IMPORTS = updatedImports ? updatedImports.forEach((i) => imports.push(i)) : imports; + return { css: CSS, imports: IMPORTS }; + } + catch (error) { + throw new Error(errors_1.ErrorUpdateParsing); + } +} +exports.updateParsing = updateParsing; +//# sourceMappingURL=parsers.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/parsers.js.map b/dist/bin/entities/FigmagicElement/logic/parsers.js.map new file mode 100644 index 000000000..5ab0b2239 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/parsers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../../../bin/entities/FigmagicElement/logic/parsers.ts"],"names":[],"mappings":";;;AAGA,mDAAgD;AAEhD,gFAA6E;AAE7E,8DAc2C;AAO3C,SAAgB,WAAW,CAAC,WAAkB,EAAE,OAAc;IAC5D,IAAI;QACF,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAC9B,IACE,CAAC,OAAO,CAAC,mBAAmB;YAC5B,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM;YACnC,CAAC,WAAW,CAAC,mBAAmB;YAChC,CAAC,WAAW,CAAC,mBAAmB,CAAC,MAAM;YAEvC,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;QAEpC,MAAM,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC;QACzD,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC;QAE3D,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;QACtF,MAAM,cAAc,GAAG,aAAa,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;QAEnE,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;SACnC,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;KACnC;AACH,CAAC;AAxBD,kCAwBC;AAOD,SAAgB,WAAW,CAAC,WAAkB,EAAE,OAAc;IAC5D,IAAI;QACF,IAAI,CAAC,WAAW,I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AAC,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACnD,MAAM,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAE1F,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;KACvC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;KACrC;AACH,CAAC;AAhBD,sCAgBC"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/processNestedCss.js b/dist/bin/entities/FigmagicElement/logic/processNestedCss.js new file mode 100644 index 000000000..7d98621b4 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/processNestedCss.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.processNestedCss = void 0; +const errors_1 = require("../../../frameworks/errors/errors"); +function processNestedCss(css) { + if (!css) + throw new Error(errors_1.ErrorProcessNestedCss); + const CLASS_NAMES = css.match(/\..* {/gi); + const CLASS_CONTENT = css.split(/\..* {/gi); + if (CLASS_CONTENT[0] === ' \n' || CLASS_CONTENT[0] === '\n') + CLASS_CONTENT.shift(); + const ARRAYS = cleanArrays(CLASS_NAMES, CLASS_CONTENT); + const INTERSECTING_VALUES = getIntersectingValues(ARRAYS); + const UNIQUE_VALUES = getUniqueValues(ARRAYS, INTERSECTING_VALUES); + return createCssString(INTERSECTING_VALUES, UNIQUE_VALUES); +} +exports.processNestedCss = processNestedCss; +function cleanArrays(classNames, classContent) { + if (!classNames || !classContent) + throw new Error(errors_1.ErrorCleanArrays); + const CLASSES = []; + classContent.forEach((arrayItem, index) => { + if (index % 2 !== 0) + return; + const LAYOUT = arrayItem + .split(/\n/gi) + .filter((item) => item) + .filter((item) => item !== '}'); + const TYPOGRAPHY = classContent[index + 1] + .split(/\n/gi) + .filter((item) => item) + .filter((item) => item !== '}'); + const css = [...LAYOUT, ...TYPOGRAPHY]; + CLASSES.push({ + className: classNames[index], + css + }); + }); + return CLASSES; +} +function getIntersectingValues(arrays) { + if (!arrays) + throw new Error(errors_1.ErrorGetIntersectingValues); + const CSS_ARRAYS = arrays.map((a) => a.css); + const REDUCED_VALUES = CSS_ARRAYS.reduce((prev, curr) => prev.filter((val) => curr.includes(val))); + const INTERSECTING_VALUES = [...new Set(REDUCED_VALUES)]; + return INTERSECTING_VALUES; +} +function getUniqueValues(arrays, intersections) { + if (!arrays || !intersections) + throw new Error(errors_1.ErrorGetUniqueValues); + const CSS_ARRAYS = arrays.map((arr) => arr.css); + const VALUES = CSS_ARRAYS.map((arr) => arr.filter((val) => !intersections.includes(val))); + const UNIQUE_VALUES = []; + VALUES.map((item, index) => { + UNIQUE_VALUES.push({ + css: item, + className: arrays[index].className + }); + }); + return UNIQUE_VALUES; +} +function createCssString(intersections, uniqueValues) { + if (!intersections || !uniqueValues) + throw new Error(errors_1.ErrorCreateCssString); + let cssString = `\n`; + intersections.forEach((i) => (cssString += ` ${i}\n`)); + cssString += `\n`; + uniqueValues.forEach((arr) => { + if (arr.className.includes('.:') || arr.className.includes('.')) { + const FIXED_CLASS_NAME = (() => { + if (arr.className.includes('.:')) + return arr.className.replace('.:', '&:'); + else if (arr.className.includes('.')) + return `&${arr.className}`; + })(); + cssString += ` ${FIXED_CLASS_NAME}\n`; + } + else + cssString += ` ${arr.className}\n`; + arr.css.forEach((item, index) => { + cssString += ` ${item}\n`; + if (index === arr.css.length - 1) + cssString += ` }\n\n`; + }); + }); + return cssString; +} +//# sourceMappingURL=processNestedCss.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/processNestedCss.js.map b/dist/bin/entities/FigmagicElement/logic/processNestedCss.js.map new file mode 100644 index 000000000..cc13a6132 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/processNestedCss.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processNestedCss.js","sourceRoot":"","sources":["../../../../../bin/entities/FigmagicElement/logic/processNestedCss.ts"],"names":[],"mappings":";;;AAAA,8DAM2C;AAM3C,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,8BAAqB,CAAC,CAAC;IAGjD,MAAM,WAAW,GAAQ,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAE5C,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,aAAa,CAAC,KAAK,EAAE,CAAC;IAEnF,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACvD,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACnE,OAAO,eAAe,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;AAC7D,CAAC;AAbD,4CAaC;AAKD,SAAS,WAAW,CAAC,UAAmC,EAAE,YAAsB;IAC9E,IAAI,CAAC,UAAU,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;IAEpE,MAAM,OAAO,GAAU,EAAE,CAAC;IAE1B,YAAY,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO;QAE5B,MAAM,MAAM,GAAG,SAAS;aACrB,KAAK,CAAC,MAAM,CAAC;aACb,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC;aAC9B,MAAM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I,EAAE,IAAI,CAAC,CAAC;qBAEtE,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;oBAAE,OAAO,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;YACnE,CAAC,CAAC,EAAE,CAAC;YACL,SAAS,IAAI,KAAK,gBAAgB,IAAI,CAAC;SACxC;;YAAM,SAAS,IAAI,KAAK,GAAG,CAAC,SAAS,IAAI,CAAC;QAE3C,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,KAAa,EAAE,EAAE;YAC3C,SAAS,IAAI,OAAO,IAAI,IAAI,CAAC;YAC7B,IAAI,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;gBAAE,SAAS,IAAI,SAAS,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js b/dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js new file mode 100644 index 000000000..dbd71394b --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sliceOutObjectFromFile = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const errors_1 = require("../../../frameworks/errors/errors"); +exports.sliceOutObjectFromFile = (path) => { + try { + if (!path) + throw new Error(errors_1.ErrorSliceOutObjectFromFile); + const DATA = fs.readFileSync(path, 'utf8'); + if (!DATA) + throw new Error(errors_1.ErrorSliceOutObjectFromFile); + const SLICED_DATA = DATA.slice(DATA.indexOf('{'), DATA.indexOf('}') + 1); + return JSON.parse(SLICED_DATA); + } + catch (error) { + throw new Error(errors_1.ErrorSliceOutObjectFromFile); + } +}; +//# sourceMappingURL=sliceOutObjectFromFile.js.map \ No newline at end of file diff --git a/dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js.map b/dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js.map new file mode 100644 index 000000000..c93451414 --- /dev/null +++ b/dist/bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sliceOutObjectFromFile.js","sourceRoot":"","sources":["../../../../../bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEzB,8DAAgF;AAEnE,QAAA,sBAAsB,GAAG,CAAC,IAAY,EAA2B,EAAE;IAC9E,IAAI;QACF,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oCAA2B,CAAC,CAAC;QAExD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oCAA2B,CAAC,CAAC;QAExD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;KAChC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,oCAA2B,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/index.js b/dist/bin/entities/Token/index.js new file mode 100644 index 000000000..36ad23384 --- /dev/null +++ b/dist/bin/entities/Token/index.js @@ -0,0 +1,127 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeToken = void 0; +const makeColorTokens_1 = require("./logic/makeColorTokens"); +const makeSpacingTokens_1 = require("./logic/makeSpacingTokens"); +const makeFontTokens_1 = require("./logic/makeFontTokens"); +const makeFontSizeTokens_1 = require("./logic/makeFontSizeTokens"); +const makeFontWeightTokens_1 = require("./logic/makeFontWeightTokens"); +const makeLineHeightTokens_1 = require("./logic/makeLineHeightTokens"); +const makeShadowTokens_1 = require("./logic/makeShadowTokens"); +const makeBorderWidthTokens_1 = require("./logic/makeBorderWidthTokens"); +const makeRadiusTokens_1 = require("./logic/makeRadiusTokens"); +const makeZindexTokens_1 = require("./logic/makeZindexTokens"); +const makeLetterSpacingTokens_1 = require("./logic/makeLetterSpacingTokens"); +const makeMediaQueryTokens_1 = require("./logic/makeMediaQueryTokens"); +const makeOpacityTokens_1 = require("./logic/makeOpacityTokens"); +const makeDurationTokens_1 = require("./logic/makeDurationTokens"); +const makeDelayTokens_1 = require("./logic/makeDelayTokens"); +const makeEasingTokens_1 = require("./logic/makeEasingTokens"); +const ignoreElementsKeywords_1 = require("../../frameworks/system/ignoreElementsKeywords"); +const errors_1 = require("../../frameworks/errors/errors"); +exports.makeToken = (token, tokenName, config) => new Token(token, tokenName, config); +class Token { + constructor(token, tokenName, config) { + this.getChildren = (frame) => { + if (frame.children && frame.children.length > 0) { + return frame.children.filter((item) => { + let shouldInclude = true; + for (let i = 0; i < ignoreElementsKeywords_1.ignoreElementsKeywords.length; i++) { + const keywordToIgnore = ignoreElementsKeywords_1.ignoreElementsKeywords[i]; + if (item.name.toLowerCase().indexOf(keywordToIgnore) >= 0) { + shouldInclude = false; + break; + } + } + return shouldInclude; + }); + } + }; + this.getTokens = (frame, name, config) => { + switch (name) { + case 'borderwidths': + return makeBorderWidthTokens_1.makeBorderWidthTokens(frame); + case 'color': + case 'colors': { + return makeColorTokens_1.makeColorTokens(frame); + } + case 'fontfamilies': { + if (!config) + throw new Error(errors_1.ErrorExtractTokensNoConfig); + return makeFontTokens_1.makeFontTokens(frame, config.usePostscriptFontNames); + } + case 'fontsizes': { + if (!config) + throw new Error(errors_1.ErrorExtractTokensNoConfig); + return makeFontSizeTokens_1.makeFontSizeTokens(frame, config.fontUnit, config.remSize); + } + case 'fontweights': + return makeFontWeightTokens_1.makeFontWeightTokens(frame); + case 'letterspacings': { + if (!config) + throw new Error(errors_1.ErrorExtractTokensNoConfig); + return makeLetterSpacingTokens_1.makeLetterSpacingTokens(frame, config.letterSpacingUnit); + } + case 'lineheights': + return makeLineHeightTokens_1.makeLineHeightTokens(frame, config.remSize); + case 'mediaqueries': + return makeMediaQueryTokens_1.makeMediaQueryTokens(frame); + case 'opacities': { + if (!config) + throw new Error(errors_1.ErrorExtractTokensNoConfig); + return makeOpacityTokens_1.makeOpacityTokens(frame, config.opacitiesUnit); + } + case 'radii': + return makeRadiusTokens_1.makeRadiusTokens(frame, config.remSize); + case 'shadows': + return makeShadowTokens_1.makeShadowTokens(frame); + case 'spacing': + case 'spacings': { + if (!config) + throw new Error(errors_1.ErrorExtractTokensNoConfig); + return makeSpacingTokens_1.makeSpacingTokens(frame, config.spacingUnit, config.remSize); + } + case 'zindices': + return makeZindexTokens_1.makeZindexTokens(frame); + case 'durations': + return makeDurationTokens_1.makeDurationTokens(frame); + case 'delays': + return makeDelayTokens_1.makeDelayTokens(frame); + case 'easings': + return makeEasingTokens_1.makeEasingTokens(frame); + } + }; + this.setWriteOperation = (processedToken, tokenName) => { + this.writeOperation = { + type: 'token', + file: processedToken, + path: this.config.outputFolderTokens, + name: tokenName, + format: this.config.outputFormatTokens + }; + }; + this.getWriteOperation = () => { + if (this.writeOperation) + return this.writeOperation; + return null; + }; + this.token = token; + this.tokenName = tokenName; + this.config = config; + this.writeOperation = null; + const processedToken = this.extractTokens(this.token, this.tokenName, this.config); + this.setWriteOperation(processedToken, tokenName); + } + extractTokens(frame, tokenName, config) { + try { + if (!frame || !tokenName) + throw new Error(errors_1.ErrorExtractTokens); + frame.children = this.getChildren(frame); + return this.getTokens(frame, tokenName.toLowerCase(), config); + } + catch (error) { + throw new Error(error); + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/index.js.map b/dist/bin/entities/Token/index.js.map new file mode 100644 index 000000000..aec3b2424 --- /dev/null +++ b/dist/bin/entities/Token/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../bin/entities/Token/index.ts"],"names":[],"mappings":";;;AAKA,6DAA0D;AAC1D,iEAA8D;AAC9D,2DAAwD;AACxD,mEAAgE;AAChE,uEAAoE;AACpE,uEAAoE;AACpE,+DAA4D;AAC5D,yEAAsE;AACtE,+DAA4D;AAC5D,+DAA4D;AAC5D,6EAA0E;AAC1E,uEAAoE;AACpE,iEAA8D;AAC9D,mEAAgE;AAChE,6DAA0D;AAC1D,+DAA4D;AAE5D,2FAAwF;AACxF,2DAAgG;AAEnF,QAAA,SAAS,GAAG,CAAC,KAAY,EAAE,SAAiB,EAAE,MAAc,EAAS,EAAE,CAClF,IAAI,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAEtC,MAAM,KAAK;IAMT,YAAY,KAAY,EAAE,SAAiB,EAAE,MAAc;QAqBnD,gBAAW,GAAG,CAAC,KAAY,EAAO,EAAE;YAC1C,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,EAAE;oBAC3C,IAAI,aAAa,GAAG,IAAI,CAAC;oBAGzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,+CAAsB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtD,MAAM,eAAe,GAAG,+CAAsB,CAAC,CAAC,CAAC,CAAC;wBAElD,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;4BACzD,aAAa,GAAG,KAAK,CAAC;4BACtB,MAAM;yBACP;qBACF;oBAED,OAAO,aAAa,CAAC;gBACvB,CAAC,C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AAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACnF,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IAEO,aAAa,CAAC,KAAY,EAAE,SAAiB,EAAE,MAAc;QACnE,IAAI;YACF,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;YAE9D,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC;SAC/D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;CAuFF"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeBorderWidthTokens.js b/dist/bin/entities/Token/logic/makeBorderWidthTokens.js new file mode 100644 index 000000000..497307567 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeBorderWidthTokens.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeBorderWidthTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeBorderWidthTokens(borderWidthFrame) { + if (!borderWidthFrame) + throw new Error(errors_1.ErrorMakeBorderWidthTokensNoFrame); + if (!borderWidthFrame.children) + throw new Error(errors_1.ErrorMakeBorderWidthTokensNoChildren); + const borderWidths = {}; + const TOKENS = borderWidthFrame.children; + TOKENS.forEach((item) => { + if (!item.name || item.strokeWeight === undefined) + throw new Error(errors_1.ErrorMakeBorderWidthTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + borderWidths[NAME] = `${item.strokeWeight}px`; + }); + return borderWidths; +} +exports.makeBorderWidthTokens = makeBorderWidthTokens; +//# sourceMappingURL=makeBorderWidthTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeBorderWidthTokens.js.map b/dist/bin/entities/Token/logic/makeBorderWidthTokens.js.map new file mode 100644 index 000000000..f8a4aaa27 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeBorderWidthTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeBorderWidthTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeBorderWidthTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,qBAAqB,CAAC,gBAAuB;IAC3D,IAAI,CAAC,gBAAgB;QAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;IAC1E,IAAI,CAAC,gBAAgB,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,6CAAoC,CAAC,CAAC;IAEtF,MAAM,YAAY,GAA4B,EAAE,CAAC;IAEjD,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC;IAEzC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;YAC/C,MAAM,IAAI,KAAK,CAAC,+CAAsC,CAAC,CAAC;QAC1D,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,YAAY,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AAhBD,sDAgBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeColorTokens.js b/dist/bin/entities/Token/logic/makeColorTokens.js new file mode 100644 index 000000000..144830ca8 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeColorTokens.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeColorTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const roundColorValue_1 = require("../../../frameworks/string/roundColorValue"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeColorTokens(colorFrame) { + if (!colorFrame) + throw new Error(errors_1.ErrorMakeColorTokensNoFrame); + if (!colorFrame.children) + throw new Error(errors_1.ErrorMakeColorTokensNoChildren); + const colors = {}; + const TOKENS = colorFrame.children; + TOKENS.forEach((item) => makeColorToken(item, colors)); + return colors; +} +exports.makeColorTokens = makeColorTokens; +function makeColorToken(item, colors) { + if (!item.fills) + throw new Error(errors_1.ErrorMakeColorTokensNoFills); + if (!item.fills[0].color) + throw new Error(errors_1.ErrorMakeColorTokensNoFills); + const R = roundColorValue_1.roundColorValue(item.fills[0].color.r, 255); + const G = roundColorValue_1.roundColorValue(item.fills[0].color.g, 255); + const B = roundColorValue_1.roundColorValue(item.fills[0].color.b, 255); + const A = roundColorValue_1.roundColorValue(item.opacity ? item.opacity : item.fills[0].color.a, 1); + const NAME = camelize_1.camelize(item.name); + colors[NAME] = `rgba(${R}, ${G}, ${B}, ${A})`; +} +//# sourceMappingURL=makeColorTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeColorTokens.js.map b/dist/bin/entities/Token/logic/makeColorTokens.js.map new file mode 100644 index 000000000..326f88876 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeColorTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeColorTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeColorTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAC/D,gFAA6E;AAE7E,8DAI2C;AAK3C,SAAgB,eAAe,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ClF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeDelayTokens.js b/dist/bin/entities/Token/logic/makeDelayTokens.js new file mode 100644 index 000000000..331254fea --- /dev/null +++ b/dist/bin/entities/Token/logic/makeDelayTokens.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeDelayTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeDelayTokens(delayFrame) { + if (!delayFrame) + throw new Error(errors_1.ErrorMakeDelayTokensNoFrame); + if (!delayFrame.children) + throw new Error(errors_1.ErrorMakeDelayTokensNoChildren); + const delays = {}; + const TOKENS = delayFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.characters) + throw new Error(errors_1.ErrorMakeDelayTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + delays[NAME] = parseFloat(item.characters); + }); + return delays; +} +exports.makeDelayTokens = makeDelayTokens; +//# sourceMappingURL=makeDelayTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeDelayTokens.js.map b/dist/bin/entities/Token/logic/makeDelayTokens.js.map new file mode 100644 index 000000000..15687b324 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeDelayTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeDelayTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeDelayTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,eAAe,CAAC,UAAiB;IAC/C,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,oCAA2B,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,uCAA8B,CAAC,CAAC;IAE1E,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC;IAEnC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;QACtF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAfD,0CAeC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeDurationTokens.js b/dist/bin/entities/Token/logic/makeDurationTokens.js new file mode 100644 index 000000000..b42c049c6 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeDurationTokens.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeDurationTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeDurationTokens(durationFrame) { + if (!durationFrame) + throw new Error(errors_1.ErrorMakeDurationTokensNoFrame); + if (!durationFrame.children) + throw new Error(errors_1.ErrorMakeDurationTokensNoChildren); + const durations = {}; + const TOKENS = durationFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.characters) + throw new Error(errors_1.ErrorMakeDurationTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + durations[NAME] = parseFloat(item.characters); + }); + return durations; +} +exports.makeDurationTokens = makeDurationTokens; +//# sourceMappingURL=makeDurationTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeDurationTokens.js.map b/dist/bin/entities/Token/logic/makeDurationTokens.js.map new file mode 100644 index 000000000..59158326a --- /dev/null +++ b/dist/bin/entities/Token/logic/makeDurationTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeDurationTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeDurationTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,kBAAkB,CAAC,aAAoB;IACrD,IAAI,CAAC,aAAa;QAAE,MAAM,IAAI,KAAK,CAAC,uCAA8B,CAAC,CAAC;IACpE,IAAI,CAAC,aAAa,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;IAEhF,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC;IAEtC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,4CAAmC,CAAC,CAAC;QACzF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,gDAeC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeEasingTokens.js b/dist/bin/entities/Token/logic/makeEasingTokens.js new file mode 100644 index 000000000..ce19b5b73 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeEasingTokens.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeEasingTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeEasingTokens(easingFrame) { + if (!easingFrame) + throw new Error(errors_1.ErrorMakeEasingTokensNoFrame); + if (!easingFrame.children) + throw new Error(errors_1.ErrorMakeEasingTokensNoChildren); + const easings = {}; + const TOKENS = easingFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.characters) + throw new Error(errors_1.ErrorMakeEasingTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + easings[NAME] = item.characters.trim(); + }); + return easings; +} +exports.makeEasingTokens = makeEasingTokens; +//# sourceMappingURL=makeEasingTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeEasingTokens.js.map b/dist/bin/entities/Token/logic/makeEasingTokens.js.map new file mode 100644 index 000000000..996735dd4 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeEasingTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeEasingTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeEasingTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,gBAAgB,CAAC,WAAkB;IACjD,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;IAChE,IAAI,CAAC,WAAW,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;IAE5E,MAAM,OAAO,GAA4B,EAAE,CAAC;IAE5C,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;QACvF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAfD,4CAeC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeFontSizeTokens.js b/dist/bin/entities/Token/logic/makeFontSizeTokens.js new file mode 100644 index 000000000..1571ba4f3 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeFontSizeTokens.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeFontSizeTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeFontSizeTokens(fontSizeFrame, fontUnit, remSize) { + if (!fontSizeFrame) + throw new Error(errors_1.ErrorMakeFontSizeTokensNoFrame); + if (!fontSizeFrame.children) + throw new Error(errors_1.ErrorMakeFontSizeTokensNoChildren); + if (!fontUnit || !remSize) + throw new Error(errors_1.ErrorMakeFontSizeTokensNoSizing); + const fontSizes = {}; + const TOKENS = fontSizeFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.style) + throw new Error(errors_1.ErrorMakeFontSizeTokensMissingProps); + if (!item.style.fontSize) + throw new Error(errors_1.ErrorMakeFontSizeTokensMissingSize); + const NAME = camelize_1.camelize(item.name); + const FONT_SIZE = item.style.fontSize / remSize + fontUnit; + fontSizes[NAME] = FONT_SIZE; + }); + return fontSizes; +} +exports.makeFontSizeTokens = makeFontSizeTokens; +//# sourceMappingURL=makeFontSizeTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeFontSizeTokens.js.map b/dist/bin/entities/Token/logic/makeFontSizeTokens.js.map new file mode 100644 index 000000000..c444753ee --- /dev/null +++ b/dist/bin/entities/Token/logic/makeFontSizeTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeFontSizeTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeFontSizeTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAM2C;AAK3C,SAAgB,kBAAkB,CAChC,aAAoB,EACpB,QAAgB,EAChB,OAAe;IAEf,IAAI,CAAC,aAAa;QAAE,MAAM,IAAI,KAAK,CAAC,uCAA8B,CAAC,CAAC;IACpE,IAAI,CAAC,aAAa,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;IAChF,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;IAE5E,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC;IAEtC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,4CAAmC,CAAC,CAAC;QACpF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,2CAAkC,CAAC,CAAC;QAE9E,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,SAAS,GAAK,IAAI,CAAC,KAAK,CAAC,QAA+B,GAAG,OAAO,GAAG,QAAQ,CAAC;QACpF,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAvBD,gDAuBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeFontTokens.js b/dist/bin/entities/Token/logic/makeFontTokens.js new file mode 100644 index 000000000..5ee4dae45 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeFontTokens.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeFontTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeFontTokens(fontFrame, usePostscriptFontNames = true) { + if (!fontFrame) + throw new Error(errors_1.ErrorMakeFontTokensNoFrame); + if (!fontFrame.children) + throw new Error(errors_1.ErrorMakeFontTokensNoChildren); + const fonts = {}; + const TOKENS = fontFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.style) + throw new Error(errors_1.ErrorMakeFontTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + fonts[NAME] = usePostscriptFontNames + ? item.style.fontPostScriptName + : item.style.fontFamily.replace(' /g', ''); + }); + return fonts; +} +exports.makeFontTokens = makeFontTokens; +//# sourceMappingURL=makeFontTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeFontTokens.js.map b/dist/bin/entities/Token/logic/makeFontTokens.js.map new file mode 100644 index 000000000..85f571cb1 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeFontTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeFontTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeFontTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,cAAc,CAAC,SAAgB,EAAE,sBAAsB,GAAG,IAAI;IAC5E,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,mCAA0B,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,sCAA6B,CAAC,CAAC;IAExE,MAAM,KAAK,GAA4B,EAAE,CAAC;IAE1C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;IAElC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;QAEhF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjC,KAAK,CAAC,IAAI,CAAC,GAAG,sBAAsB;YAClC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB;YAC/B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAnBD,wCAmBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeFontWeightTokens.js b/dist/bin/entities/Token/logic/makeFontWeightTokens.js new file mode 100644 index 000000000..69d1fb91f --- /dev/null +++ b/dist/bin/entities/Token/logic/makeFontWeightTokens.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeFontWeightTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeFontWeightTokens(fontWeightFrame) { + if (!fontWeightFrame) + throw new Error(errors_1.ErrorMakeFontWeightTokensNoFrame); + if (!fontWeightFrame.children) + throw new Error(errors_1.ErrorMakeFontWeightTokensNoChildren); + const fontWeights = {}; + const TOKENS = fontWeightFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.style) + throw new Error(errors_1.ErrorMakeFontWeightTokensMissingProps); + if (!item.style.fontWeight) + throw new Error(errors_1.ErrorMakeFontWeightTokensMissingWeight); + const NAME = camelize_1.camelize(item.name); + fontWeights[NAME] = item.style.fontWeight; + }); + return fontWeights; +} +exports.makeFontWeightTokens = makeFontWeightTokens; +//# sourceMappingURL=makeFontWeightTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeFontWeightTokens.js.map b/dist/bin/entities/Token/logic/makeFontWeightTokens.js.map new file mode 100644 index 000000000..cf97e56b2 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeFontWeightTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeFontWeightTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeFontWeightTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAK2C;AAK3C,SAAgB,oBAAoB,CAAC,eAAsB;IACzD,IAAI,CAAC,eAAe;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;IACxE,IAAI,CAAC,eAAe,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,4CAAmC,CAAC,CAAC;IAEpF,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC;IAExC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,8CAAqC,CAAC,CAAC;QACtF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,+CAAsC,CAAC,CAAC;QAEpF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAjBD,oDAiBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeLetterSpacingTokens.js b/dist/bin/entities/Token/logic/makeLetterSpacingTokens.js new file mode 100644 index 000000000..3d9e5da6e --- /dev/null +++ b/dist/bin/entities/Token/logic/makeLetterSpacingTokens.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeLetterSpacingTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeLetterSpacingTokens(letterSpacingFrame, letterSpacingUnit) { + if (!letterSpacingFrame) + throw new Error(errors_1.ErrorMakeLetterSpacingTokensNoFrame); + if (!letterSpacingFrame.children) + throw new Error(errors_1.ErrorMakeLetterSpacingTokensNoChildren); + const TOKENS = letterSpacingFrame.children; + const letterSpacings = TOKENS.reduce((tokens, item) => { + if (!item.name || !item.style) + throw new Error(errors_1.ErrorMakeLetterSpacingTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + const FONT_SIZE = item.style.fontSize; + const LETTER_SPACING_VALUE_IN_PX = typeof item.style.letterSpacing !== 'undefined' + ? Math.round(item.style.letterSpacing * 1000) / 1000 + : 0; + let value = '0'; + switch (letterSpacingUnit) { + case 'px': + value = `${LETTER_SPACING_VALUE_IN_PX}px`; + break; + case 'em': + default: + if (!FONT_SIZE) { + throw new Error(errors_1.ErrorMakeLetterSpacingTokensMissingProps); + } + const valueCalc = Math.round((1000 * LETTER_SPACING_VALUE_IN_PX) / FONT_SIZE) / 1000; + value = `${valueCalc}em`; + break; + } + tokens[NAME] = value; + return tokens; + }, {}); + return letterSpacings; +} +exports.makeLetterSpacingTokens = makeLetterSpacingTokens; +//# sourceMappingURL=makeLetterSpacingTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeLetterSpacingTokens.js.map b/dist/bin/entities/Token/logic/makeLetterSpacingTokens.js.map new file mode 100644 index 000000000..129883868 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeLetterSpacingTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeLetterSpacingTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeLetterSpacingTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAY3C,SAAgB,uBAAuB,CACrC,kBAAyB,EACzB,iBAAyB;IAEzB,IAAI,CAAC,kBAAkB;QAAE,MAAM,IAAI,KAAK,CAAC,4CAAmC,CAAC,CAAC;IAC9E,IAAI,CAAC,kBAAkB,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC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a/dist/bin/entities/Token/logic/makeLineHeightTokens.js b/dist/bin/entities/Token/logic/makeLineHeightTokens.js new file mode 100644 index 000000000..4ae8e51d8 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeLineHeightTokens.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeLineHeightTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const normalizeUnits_1 = require("../../../frameworks/string/normalizeUnits"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeLineHeightTokens(lineHeightFrame, remSize) { + if (!lineHeightFrame) + throw new Error(errors_1.ErrorMakeLineHeightTokensNoFrame); + if (!lineHeightFrame.children) + throw new Error(errors_1.ErrorMakeLineHeightTokensNoChildren); + const lineHeights = {}; + const TOKENS = lineHeightFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.style) + throw new Error(errors_1.ErrorMakeLineHeightTokensMissingProps); + if (!item.style.lineHeightPercentFontSize) + throw new Error(errors_1.ErrorMakeLineHeightTokensMissingPercent); + const NAME = camelize_1.camelize(item.name); + const LINE_HEIGHT = normalizeUnits_1.normalizeUnits(item.style.lineHeightPercentFontSize, 'percent', 'unitless', remSize); + const lineHeight = parseFloat(LINE_HEIGHT).toFixed(2); + lineHeights[NAME] = lineHeight; + }); + return lineHeights; +} +exports.makeLineHeightTokens = makeLineHeightTokens; +//# sourceMappingURL=makeLineHeightTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeLineHeightTokens.js.map b/dist/bin/entities/Token/logic/makeLineHeightTokens.js.map new file mode 100644 index 000000000..1d24c30ab --- /dev/null +++ b/dist/bin/entities/Token/logic/makeLineHeightTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeLineHeightTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeLineHeightTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAC/D,8EAA2E;AAE3E,8DAK2C;AAK3C,SAAgB,oBAAoB,CAAC,eAAsB,EAAE,OAAe;IAC1E,IAAI,CAAC,eAAe;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;IACxE,IAAI,CAAC,eAAe,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,4CAAmC,CAAC,CAAC;IAEpF,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC;IAExC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,8CAAqC,CAAC,CAAC;QACtF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,yBAAyB;YACvC,MAAM,IAAI,KAAK,CAAC,gDAAuC,CAAC,CAAC;QAE3D,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,WAAW,GAAW,+BAAc,CACxC,IAAI,CAAC,KAAK,CAAC,yBAAyB,EACpC,SAAS,EACT,UAAU,EACV,OAAO,CACR,CAAC;QAEF,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACtD,WAAW,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AA1BD,oDA0BC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeMediaQueryTokens.js b/dist/bin/entities/Token/logic/makeMediaQueryTokens.js new file mode 100644 index 000000000..50e31f39e --- /dev/null +++ b/dist/bin/entities/Token/logic/makeMediaQueryTokens.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeMediaQueryTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeMediaQueryTokens(mediaQueryFrame) { + if (!mediaQueryFrame) + throw new Error(errors_1.ErrorSetupMediaQueryTokensNoFrame); + if (!mediaQueryFrame.children) + throw new Error(errors_1.ErrorSetupMediaQueryTokensNoChildren); + const mediaQueries = {}; + const TOKENS = mediaQueryFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.absoluteBoundingBox) + throw new Error(errors_1.ErrorSetupMediaQueryTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + mediaQueries[NAME] = `${item.absoluteBoundingBox.width}px`; + }); + return mediaQueries; +} +exports.makeMediaQueryTokens = makeMediaQueryTokens; +//# sourceMappingURL=makeMediaQueryTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeMediaQueryTokens.js.map b/dist/bin/entities/Token/logic/makeMediaQueryTokens.js.map new file mode 100644 index 000000000..5d42e9824 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeMediaQueryTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeMediaQueryTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeMediaQueryTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,oBAAoB,CAAC,eAAsB;IACzD,IAAI,CAAC,eAAe;QAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;IACzE,IAAI,CAAC,eAAe,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,6CAAoC,CAAC,CAAC;IAErF,MAAM,YAAY,GAA4B,EAAE,CAAC;IAEjD,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC;IAExC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,mBAAmB;YACzC,MAAM,IAAI,KAAK,CAAC,+CAAsC,CAAC,CAAC;QAE1D,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjC,YAAY,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AAlBD,oDAkBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeOpacityTokens.js b/dist/bin/entities/Token/logic/makeOpacityTokens.js new file mode 100644 index 000000000..84d64ae8a --- /dev/null +++ b/dist/bin/entities/Token/logic/makeOpacityTokens.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeOpacityTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeOpacityTokens(opacitiesFrame, opacitiesUnit) { + if (!opacitiesFrame) + throw new Error(errors_1.ErrorMakeOpacityTokensNoFrame); + if (!opacitiesFrame.children) + throw new Error(errors_1.ErrorMakeOpacityTokensNoChildren); + const TOKENS = opacitiesFrame.children; + const opacityTokens = TOKENS.reduce((tokens, item) => { + if (!item.name) + throw new Error(errors_1.ErrorMakeOpacityTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + const OPACITY = (() => { + let opacity = 1; + if (typeof item.opacity !== 'undefined') + opacity = Math.round(item.opacity * 100) / 100; + if (opacitiesUnit === 'percent') + opacity = `${opacity * 100}%`; + return opacity; + })(); + tokens[NAME] = OPACITY; + return tokens; + }, {}); + return opacityTokens; +} +exports.makeOpacityTokens = makeOpacityTokens; +//# sourceMappingURL=makeOpacityTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeOpacityTokens.js.map b/dist/bin/entities/Token/logic/makeOpacityTokens.js.map new file mode 100644 index 000000000..e65be4478 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeOpacityTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeOpacityTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeOpacityTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,iBAAiB,CAC/B,cAAqB,EACrB,aAAkC;IAElC,IAAI,CAAC,cAAc;QAAE,MAAM,IAAI,KAAK,CAAC,sCAA6B,CAAC,CAAC;IACpE,IAAI,CAAC,cAAc,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;IAEhF,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC;IAEvC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAgC,EAAE,IAAW,EAAE,EAAE;QACpF,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2CAAkC,CAAC,CAAC;QAGpE,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE;YACpB,IAAI,OAAO,GAAoB,CAAC,CAAC;YAEjC,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW;gBAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YACxF,IAAI,aAAa,KAAK,SAAS;gBAAE,OAAO,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,CAAC;YAE/D,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,EAAE,CAAC;QAEL,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;QAEvB,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,aAAa,CAAC;AACvB,CAAC;AA7BD,8CA6BC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeRadiusTokens.js b/dist/bin/entities/Token/logic/makeRadiusTokens.js new file mode 100644 index 000000000..156d75983 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeRadiusTokens.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeRadiusTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const normalizeUnits_1 = require("../../../frameworks/string/normalizeUnits"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeRadiusTokens(radiusFrame, remSize) { + if (!radiusFrame) + throw new Error(errors_1.ErrorMakeRadiusTokensNoFrame); + if (!radiusFrame.children) + throw new Error(errors_1.ErrorMakeRadiusTokensNoChildren); + const cornerRadii = {}; + const TOKENS = radiusFrame.children; + TOKENS.forEach((item) => { + if (!item.name) + throw new Error(errors_1.ErrorMakeRadiusTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + const CORNER_RADIUS = item.cornerRadius + ? normalizeUnits_1.normalizeUnits(item.cornerRadius, 'cornerRadius', 'adjustedRadius', remSize) + : '0px'; + cornerRadii[NAME] = CORNER_RADIUS; + }); + return cornerRadii; +} +exports.makeRadiusTokens = makeRadiusTokens; +//# sourceMappingURL=makeRadiusTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeRadiusTokens.js.map b/dist/bin/entities/Token/logic/makeRadiusTokens.js.map new file mode 100644 index 000000000..9685923b6 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeRadiusTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeRadiusTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeRadiusTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAC/D,8EAA2E;AAE3E,8DAI2C;AAK3C,SAAgB,gBAAgB,CAAC,WAAkB,EAAE,OAAe;IAClE,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;IAChE,IAAI,CAAC,WAAW,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;IAE5E,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;QACnE,MAAM,IAAI,GAAW,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,aAAa,GAAW,IAAI,CAAC,YAAY;YAC7C,CAAC,CAAC,+BAAc,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,OAAO,CAAC;YAC9E,CAAC,CAAC,KAAK,CAAC;QACV,WAAW,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAlBD,4CAkBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeShadowTokens.js b/dist/bin/entities/Token/logic/makeShadowTokens.js new file mode 100644 index 000000000..fe49794ee --- /dev/null +++ b/dist/bin/entities/Token/logic/makeShadowTokens.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeShadowTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const roundColorValue_1 = require("../../../frameworks/string/roundColorValue"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeShadowTokens(shadowFrame) { + if (!shadowFrame) + throw new Error(errors_1.ErrorMakeShadowTokensNoFrame); + if (!shadowFrame.children) + throw new Error(errors_1.ErrorMakeShadowTokensNoChildren); + const shadows = {}; + const TOKENS = shadowFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.effects) + throw new Error(errors_1.ErrorMakeShadowTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + const EFFECTS = item.effects.map((effect) => { + if (effect.type === 'DROP_SHADOW') + return effect; + return null; + }); + shadows[NAME] = ``; + if (EFFECTS.length > 0) { + EFFECTS.forEach((effect, index) => { + if (effect) { + const X = effect.offset.x; + const Y = effect.offset.y; + const RADIUS = effect.radius; + const R = roundColorValue_1.roundColorValue(effect.color.r); + const G = roundColorValue_1.roundColorValue(effect.color.g); + const B = roundColorValue_1.roundColorValue(effect.color.b); + const A = roundColorValue_1.roundColorValue(effect.color.a, 1); + shadows[NAME] += `${X}px ${Y}px ${RADIUS}px rgba(${R}, ${G}, ${B}, ${A})`; + if (index !== EFFECTS.length - 1) + shadows[NAME] += `, `; + } + }); + } + }); + return shadows; +} +exports.makeShadowTokens = makeShadowTokens; +//# sourceMappingURL=makeShadowTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeShadowTokens.js.map b/dist/bin/entities/Token/logic/makeShadowTokens.js.map new file mode 100644 index 000000000..474fb8f0d --- /dev/null +++ b/dist/bin/entities/Token/logic/makeShadowTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeShadowTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeShadowTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAC/D,gFAA6E;AAE7E,8DAI2C;AAK3C,SAAgB,gBAAgB,CAAC,WAAkB;IACjD,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;IAChE,IAAI,CAAC,WAAW,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;IAE5E,MAAM,OAAO,GAA4B,EAAE,CAAC;IAE5C,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;QAEpF,MAAM,IAAI,GAAG,mBAAQ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,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAvCD,4CAuCC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeSpacingTokens.js b/dist/bin/entities/Token/logic/makeSpacingTokens.js new file mode 100644 index 000000000..9622de3cd --- /dev/null +++ b/dist/bin/entities/Token/logic/makeSpacingTokens.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeSpacingTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const normalizeUnits_1 = require("../../../frameworks/string/normalizeUnits"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeSpacingTokens(spacingFrame, spacingUnit, remSize) { + if (!spacingFrame) + throw new Error(errors_1.ErrorMakeSpacingTokensNoFrame); + if (!spacingFrame.children) + throw new Error(errors_1.ErrorMakeSpacingTokensNoChildren); + if (!spacingUnit || !remSize) + throw new Error(errors_1.ErrorMakeSpacingTokensNoUnits); + const spacings = {}; + const TOKENS = spacingFrame.children; + TOKENS.forEach((item) => { + const NAME = camelize_1.camelize(item.name); + if (!item.absoluteBoundingBox || !item.absoluteBoundingBox.width) + throw new Error(errors_1.ErrorMakeSpacingTokensNoFrame); + const WIDTH = item.absoluteBoundingBox.width; + const NORMALIZED_UNIT = normalizeUnits_1.normalizeUnits(WIDTH, 'px', spacingUnit, remSize); + spacings[NAME] = NORMALIZED_UNIT; + }); + return spacings; +} +exports.makeSpacingTokens = makeSpacingTokens; +//# sourceMappingURL=makeSpacingTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeSpacingTokens.js.map b/dist/bin/entities/Token/logic/makeSpacingTokens.js.map new file mode 100644 index 000000000..ede33f987 --- /dev/null +++ b/dist/bin/entities/Token/logic/makeSpacingTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeSpacingTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeSpacingTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAC/D,8EAA2E;AAE3E,8DAI2C;AAK3C,SAAgB,iBAAiB,CAC/B,YAAmB,EACnB,WAAmB,EACnB,OAAe;IAEf,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,sCAA6B,CAAC,CAAC;IAClE,IAAI,CAAC,YAAY,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;IAC9E,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,sCAA6B,CAAC,CAAC;IAE7E,MAAM,QAAQ,GAA4B,EAAE,CAAC;IAE7C,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC;IAErC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,MAAM,IAAI,GAAW,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK;YAC9D,MAAM,IAAI,KAAK,CAAC,sCAA6B,CAAC,CAAC;QAEjD,MAAM,KAAK,GAAW,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC;QACrD,MAAM,eAAe,GAAG,+BAAc,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAC1E,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAxBD,8CAwBC"} \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeZindexTokens.js b/dist/bin/entities/Token/logic/makeZindexTokens.js new file mode 100644 index 000000000..ce85eafaa --- /dev/null +++ b/dist/bin/entities/Token/logic/makeZindexTokens.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeZindexTokens = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +function makeZindexTokens(zIndexFrame) { + if (!zIndexFrame) + throw new Error(errors_1.ErrorMakeZindexTokensNoFrame); + if (!zIndexFrame.children) + throw new Error(errors_1.ErrorMakeZindexTokensNoChildren); + const zIndex = {}; + const TOKENS = zIndexFrame.children; + TOKENS.forEach((item) => { + if (!item.name || !item.characters) + throw new Error(errors_1.ErrorMakeZindexTokensMissingProps); + const NAME = camelize_1.camelize(item.name); + zIndex[NAME] = parseInt(item.characters); + }); + return zIndex; +} +exports.makeZindexTokens = makeZindexTokens; +//# sourceMappingURL=makeZindexTokens.js.map \ No newline at end of file diff --git a/dist/bin/entities/Token/logic/makeZindexTokens.js.map b/dist/bin/entities/Token/logic/makeZindexTokens.js.map new file mode 100644 index 000000000..76eca55eb --- /dev/null +++ b/dist/bin/entities/Token/logic/makeZindexTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeZindexTokens.js","sourceRoot":"","sources":["../../../../../bin/entities/Token/logic/makeZindexTokens.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAE/D,8DAI2C;AAK3C,SAAgB,gBAAgB,CAAC,WAAkB;IACjD,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;IAChE,IAAI,CAAC,WAAW,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;IAE5E,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAW,EAAE,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,0CAAiC,CAAC,CAAC;QACvF,MAAM,IAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAfD,4CAeC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/createFolder.js b/dist/bin/frameworks/filesystem/createFolder.js new file mode 100644 index 000000000..3fe794fb0 --- /dev/null +++ b/dist/bin/frameworks/filesystem/createFolder.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFolder = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const errors_1 = require("../errors/errors"); +function createFolder(dir) { + try { + if (!dir) + throw new Error(errors_1.ErrorCreateFolder); + if (!fs.existsSync(dir)) + fs.mkdirSync(dir, { recursive: true }); + } + catch (error) { + throw new Error(errors_1.ErrorCreateFolder); + } +} +exports.createFolder = createFolder; +//# sourceMappingURL=createFolder.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/createFolder.js.map b/dist/bin/frameworks/filesystem/createFolder.js.map new file mode 100644 index 000000000..1b49969ec --- /dev/null +++ b/dist/bin/frameworks/filesystem/createFolder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createFolder.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/createFolder.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEzB,6CAAqD;AAKrD,SAAgB,YAAY,CAAC,GAAW;IACtC,IAAI;QACF,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;QAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACjE;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;KACpC;AACH,CAAC;AAPD,oCAOC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/getDataHelpers.js b/dist/bin/frameworks/filesystem/getDataHelpers.js new file mode 100644 index 000000000..2e68355b5 --- /dev/null +++ b/dist/bin/frameworks/filesystem/getDataHelpers.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getImports = exports.getExtraProps = exports.getText = exports.getElement = void 0; +const createImportStringFromList_1 = require("../string/createImportStringFromList"); +exports.getElement = (metadata) => { + if (metadata) { + if (metadata.element) + return metadata.element; + else + return 'div'; + } + else + return 'div'; +}; +exports.getText = (metadata) => { + if (metadata) { + if (metadata.text) + return metadata.text; + else + return ''; + } + else + return ''; +}; +exports.getExtraProps = (metadata) => { + if (metadata) { + if (metadata.extraProps) + return metadata.extraProps; + else + return ''; + } + else + return ''; +}; +exports.getImports = (metadata) => { + if (metadata) { + if (metadata.imports) { + if (metadata.imports.length > 0) + return createImportStringFromList_1.createImportStringFromList(metadata.imports); + else + return ''; + } + else + return ''; + } + else + return ''; +}; +//# sourceMappingURL=getDataHelpers.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/getDataHelpers.js.map b/dist/bin/frameworks/filesystem/getDataHelpers.js.map new file mode 100644 index 000000000..95875fda9 --- /dev/null +++ b/dist/bin/frameworks/filesystem/getDataHelpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getDataHelpers.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/getDataHelpers.ts"],"names":[],"mappings":";;;AAAA,qFAAkF;AAKrE,QAAA,UAAU,GAAG,CAAC,QAAgD,EAAU,EAAE;IACrF,IAAI,QAAQ,EAAE;QACZ,IAAI,QAAQ,CAAC,OAAO;YAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;;YACzC,OAAO,KAAK,CAAC;KACnB;;QAAM,OAAO,KAAK,CAAC;AACtB,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,CAAC,QAAgD,EAAU,EAAE;IAClF,IAAI,QAAQ,EAAE;QACZ,IAAI,QAAQ,CAAC,IAAI;YAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;;YACnC,OAAO,EAAE,CAAC;KAChB;;QAAM,OAAO,EAAE,CAAC;AACnB,CAAC,CAAC;AAEW,QAAA,aAAa,GAAG,CAAC,QAAgD,EAAU,EAAE;IACxF,IAAI,QAAQ,EAAE;QACZ,IAAI,QAAQ,CAAC,UAAU;YAAE,OAAO,QAAQ,CAAC,UAAU,CAAC;;YAC/C,OAAO,EAAE,CAAC;KAChB;;QAAM,OAAO,EAAE,CAAC;AACnB,CAAC,CAAC;AAEW,QAAA,UAAU,GAAG,CAAC,QAAgD,EAAU,EAAE;IACrF,IAAI,QAAQ,EAAE;QACZ,IAAI,QAAQ,CAAC,OAAO,EAAE;YACpB,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,uDAA0B,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;;gBAChF,OAAO,EAAE,CAAC;SAChB;;YAAM,OAAO,EAAE,CAAC;KAClB;;QAAM,OAAO,EAAE,CAAC;AACnB,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/getFileContentAndPath.js b/dist/bin/frameworks/filesystem/getFileContentAndPath.js new file mode 100644 index 000000000..70eff4c2c --- /dev/null +++ b/dist/bin/frameworks/filesystem/getFileContentAndPath.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getFileContentAndPath = void 0; +const prepFile_1 = require("./prepFile"); +const createEnumStringOutOfObject_1 = require("../../frameworks/string/createEnumStringOutOfObject"); +const messages_1 = require("../messages/messages"); +const errors_1 = require("../errors/errors"); +function getFileContentAndPath(getFileContentAndPathOperation) { + try { + if (!getFileContentAndPathOperation) + throw new Error(errors_1.ErrorGetFileContentAndPath); + if (!getFileContentAndPathOperation.type || + !getFileContentAndPathOperation.file || + !getFileContentAndPathOperation.path || + !getFileContentAndPathOperation.name || + !getFileContentAndPathOperation.format || + !getFileContentAndPathOperation.element) + throw new Error(errors_1.ErrorGetFileContentAndPathMissingFields); + const { type, file, path, name, format, text, element, imports, extraProps, metadata, templates } = getFileContentAndPathOperation; + let filePath = `${path}/${name}`; + if (type === 'raw') + return { fileContent: `${JSON.stringify(file, null, ' ')}`, filePath }; + else if (type === 'token') { + if (metadata && metadata.dataType === 'enum') + return { fileContent: getTokenEnumString(file, name, format), filePath }; + filePath += `.${format}`; + return { fileContent: getTokenString(file, name, format), filePath }; + } + else if (type === 'component' && templates) + return prepFile_1.prepComponent({ + name, + filePath, + format, + templates, + text, + extraProps + }); + else if (type === 'style' && templates) + return prepFile_1.prepStyledComponents({ + name, + filePath, + format, + templates, + element + }); + else if (type === 'css') + return prepFile_1.prepCss({ name, filePath, format, imports, file }); + else if (type === 'story' && templates) + return prepFile_1.prepStorybook({ name, filePath, format, templates, text }); + else if (type === 'description') + return prepFile_1.prepDescription({ filePath, file, format }); + else + throw new Error(errors_1.ErrorGetFileContentAndPathNoReturn); + } + catch (error) { + throw new Error(errors_1.ErrorGetFileContentAndPath); + } +} +exports.getFileContentAndPath = getFileContentAndPath; +const getTokenEnumString = (file, name, format) => { + const EXPORT = format !== 'js' ? `export default ${name}` : `module.exports = ${name}`; + return `// ${messages_1.MsgGeneratedFileWarning}\n\nenum ${name} {${createEnumStringOutOfObject_1.createEnumStringOutOfObject(file)}\n}\n\n${EXPORT};`; +}; +const getTokenString = (file, name, format) => { + const EXPORT = format !== 'js' ? `export default ${name}` : `module.exports = ${name}`; + return `// ${messages_1.MsgGeneratedFileWarning}\n\nconst ${name} = ${JSON.stringify(file, null, ' ')}\n\n${EXPORT};`; +}; +//# sourceMappingURL=getFileContentAndPath.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/getFileContentAndPath.js.map b/dist/bin/frameworks/filesystem/getFileContentAndPath.js.map new file mode 100644 index 000000000..b1392a08b --- /dev/null +++ b/dist/bin/frameworks/filesystem/getFileContentAndPath.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFileContentAndPath.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/getFileContentAndPath.ts"],"names":[],"mappings":";;;AAUA,yCAMoB;AAEpB,qGAAkG;AAElG,mDAA+D;AAC/D,6CAI0B;AAM1B,SAAgB,qBAAqB,CACnC,8BAAoD;IASpD,IAAI;QACF,IAAI,CAAC,8BAA8B;YAAE,MAAM,IAAI,KAAK,CAAC,mCAA0B,CAAC,CAAC;QACjF,IACE,CAAC,8BAA8B,CAAC,IAAI;YACpC,CAAC,8BAA8B,CAAC,IAAI;YACpC,CAAC,8BAA8B,CAAC,IAAI;YACpC,CAAC,8BAA8B,CAAC,IAAI;YACpC,CAAC,8BAA8B,CAAC,MAAM;YACtC,CAAC,8BAA8B,CAAC,OAAO;YAEvC,MAAM,IAAI,KAAK,CAAC,gDAAuC,CAAC,CAAC;QAC3D,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,SAAS,EACV,GAAG,8BAA8B,CAAC;QACnC,IAAI,QAAQ,GAAG,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;QAEjC,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC;aAEtF,IAAI,IAAI,KAAK,OAAO,EAAE;YACzB,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,MAAM;gBAC1C,OAAO,EAAE,WAAW,EAAE,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;YAE3E,QAAQ,IAAI,IAAI,MAAM,EAAE,CAAC;YACzB,OAAO,EAAE,WAAW,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,UAAU,MAAM,GAAG,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAA6B,EAAE,IAAY,EAAE,MAAc,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC,oBAAoB,IAAI,EAAE,CAAC;IACvF,OAAO,MAAM,kCAAuB,aAAa,IAAI,MAAM,IAAI,CAAC,SAAS,CACvE,IAAI,EACJ,IAAI,EACJ,GAAG,CACJ,OAAO,MAAM,GAAG,CAAC;AACpB,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/loadFile.js b/dist/bin/frameworks/filesystem/loadFile.js new file mode 100644 index 000000000..381a69ecb --- /dev/null +++ b/dist/bin/frameworks/filesystem/loadFile.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.loadFile = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const errors_1 = require("../errors/errors"); +function loadFile(path) { + try { + if (!path) + throw new Error(errors_1.ErrorLoadFile(path)); + if (!fs.existsSync(path)) + throw new Error(errors_1.ErrorLoadFile(path)); + const DATA = fs.readFileSync(path, 'utf8'); + return isJsonString(DATA) ? JSON.parse(DATA) : DATA; + } + catch (error) { + throw new Error(errors_1.ErrorLoadFile(path)); + } +} +exports.loadFile = loadFile; +const isJsonString = (str) => { + try { + JSON.parse(str); + } + catch (e) { + return false; + } + return true; +}; +//# sourceMappingURL=loadFile.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/loadFile.js.map b/dist/bin/frameworks/filesystem/loadFile.js.map new file mode 100644 index 000000000..07879cd64 --- /dev/null +++ b/dist/bin/frameworks/filesystem/loadFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loadFile.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/loadFile.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEzB,6CAAiD;AAKjD,SAAgB,QAAQ,CAAC,IAAY;IACnC,IAAI;QACF,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/D,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KACrD;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,sBAAa,CAAC,IAAI,CAAC,CAAC,CAAC;KACtC;AACH,CAAC;AAVD,4BAUC;AAMD,MAAM,YAAY,GAAG,CAAC,GAAW,EAAqC,EAAE;IACtE,IAAI;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACjB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/prepFile.js b/dist/bin/frameworks/filesystem/prepFile.js new file mode 100644 index 000000000..6104ba412 --- /dev/null +++ b/dist/bin/frameworks/filesystem/prepFile.js @@ -0,0 +1,94 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.prepDescription = exports.prepStorybook = exports.prepCss = exports.prepStyledComponents = exports.prepComponent = void 0; +const loadFile_1 = require("./loadFile"); +const messages_1 = require("../messages/messages"); +const errors_1 = require("../errors/errors"); +exports.prepComponent = (data) => { + try { + if (!data) + throw new Error(errors_1.ErrorPrepFileComponent); + if (!data.name || !data.filePath || !data.format || !data.templates) + throw new Error(errors_1.ErrorPrepFileComponent); + const { name, filePath, format, templates, text, extraProps } = data; + const SUFFIX = 'Styled'; + const PATH = `${templates.templatePathReact}.${format}`; + let template = loadFile_1.loadFile(PATH); + template = template.replace(/{{NAME}}/gi, name); + template = template.replace(/{{NAME_STYLED}}/gi, `${name}${SUFFIX}`); + template = template.replace(/{{EXTRA_PROPS}}/gi, ` ${extraProps}`); + template = template.replace(/\s>/gi, '>'); + template = template.replace(/{{TEXT}}/gi, text); + return { fileContent: `${template}`, filePath: `${filePath}.${format}` }; + } + catch (error) { + throw new Error(errors_1.ErrorPrepFileComponent); + } +}; +exports.prepStyledComponents = (data) => { + try { + if (!data) + throw new Error(errors_1.ErrorPrepFileStyledComponents); + if (!data.name || !data.filePath || !data.format || !data.templates || !data.element) + throw new Error(errors_1.ErrorPrepFileStyledComponents); + const { name, filePath, format, templates, element } = data; + const SUFFIX = 'Styled'; + const PATH = `${templates.templatePathStyled}.${format}`; + let template = loadFile_1.loadFile(PATH); + template = template.replace(/{{ELEMENT}}/gi, element); + template = template.replace(/{{NAME_CSS}}/gi, `${name}Css`); + template = template.replace(/{{NAME_STYLED}}/gi, `${name}${SUFFIX}`); + return { fileContent: `${template}`, filePath: `${filePath}${SUFFIX}.${format}` }; + } + catch (error) { + throw new Error(errors_1.ErrorPrepFileStyledComponents); + } +}; +exports.prepCss = (data) => { + try { + if (!data) + throw new Error(errors_1.ErrorPrepFileCss); + if (!data.name || !data.filePath || !data.format || !data.file) + throw new Error(errors_1.ErrorPrepFileCss); + const { name, filePath, format, imports, file } = data; + const SUFFIX = 'Css'; + const FILE_CONTENT = `// ${messages_1.MsgGeneratedFileWarning}\n\n${imports}\nconst ${name}${SUFFIX} = \`${file}\`;\n\nexport default ${name}${SUFFIX};`; + return { fileContent: FILE_CONTENT, filePath: `${filePath}${SUFFIX}.${format}` }; + } + catch (error) { + throw new Error(errors_1.ErrorPrepFileCss); + } +}; +exports.prepStorybook = (data) => { + try { + if (!data) + throw new Error(errors_1.ErrorPrepFileStorybook); + if (!data.name || !data.filePath || !data.format || !data.templates || !data.text) + throw new Error(errors_1.ErrorPrepFileStorybook); + const { name, filePath, format, templates, text } = data; + const SUFFIX = '.stories'; + const PATH = `${templates.templatePathStorybook}.${format}`; + let template = loadFile_1.loadFile(PATH); + template = template.replace(/{{NAME}}/gi, name); + template = template.replace(/{{TEXT}}/gi, text); + return { fileContent: `${template}`, filePath: `${filePath}${SUFFIX}.${format}` }; + } + catch (error) { + throw new Error(errors_1.ErrorPrepFileStorybook); + } +}; +exports.prepDescription = (data) => { + try { + if (!data) + throw new Error(errors_1.ErrorPrepFileDescription); + if (!data.filePath || !data.file || !data.format) + throw new Error(errors_1.ErrorPrepFileDescription); + const { filePath, file, format } = data; + const FILE_CONTENT = `\n${file}`; + return { fileContent: FILE_CONTENT, filePath: `${filePath}.description.${format}` }; + } + catch (error) { + throw new Error(errors_1.ErrorPrepFileDescription); + } +}; +//# sourceMappingURL=prepFile.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/prepFile.js.map b/dist/bin/frameworks/filesystem/prepFile.js.map new file mode 100644 index 000000000..5e998d68e --- /dev/null +++ b/dist/bin/frameworks/filesystem/prepFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prepFile.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/prepFile.ts"],"names":[],"mappings":";;;AASA,yCAAsC;AAEtC,mDAA+D;AAC/D,6CAM0B;AAKb,QAAA,aAAa,GAAG,CAAC,IAAmB,EAAuB,EAAE;IACxE,IAAI;QACF,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,+BAAsB,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS;YACjE,MAAM,IAAI,KAAK,CAAC,+BAAsB,CAAC,CAAC;QAC1C,MAAM,EAAE,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C,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,+BAAsB,CAAC,CAAC;KACzC;AACH,CAAC,CAAC;AAKW,QAAA,eAAe,GAAG,CAAC,IAAqB,EAAuB,EAAE;IAC5E,IAAI;QACF,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;QAE5F,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExC,MAAM,YAAY,GAAG,OAAO,kCAAuB,QAAQ,IAAI,EAAE,CAAC;QAElE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,QAAQ,gBAAgB,MAAM,EAAE,EAAE,CAAC;KACrF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;KAC3C;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/prepareWrite.js b/dist/bin/frameworks/filesystem/prepareWrite.js new file mode 100644 index 000000000..60a97ff8a --- /dev/null +++ b/dist/bin/frameworks/filesystem/prepareWrite.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.prepareWrite = void 0; +const getDataHelpers_1 = require("./getDataHelpers"); +const getFileContentAndPath_1 = require("../filesystem/getFileContentAndPath"); +const errors_1 = require("../errors/errors"); +function prepareWrite(writeOperation) { + try { + if (!writeOperation) + throw new Error(errors_1.ErrorWriteFile); + const { type, file, path, name, format, metadata, templates } = writeOperation; + if ((type === 'css' || type === 'story' || type === 'component') && !templates) + throw new Error(errors_1.ErrorPrepareWrite); + const getFileDataOperation = { + type, + file, + path, + name: name.replace('//g', ''), + format, + text: getDataHelpers_1.getText(metadata), + element: getDataHelpers_1.getElement(metadata), + imports: getDataHelpers_1.getImports(metadata), + extraProps: getDataHelpers_1.getExtraProps(metadata), + metadata, + templates + }; + return getFileContentAndPath_1.getFileContentAndPath(getFileDataOperation); + } + catch (error) { + throw new Error(errors_1.ErrorPrepareWrite); + } +} +exports.prepareWrite = prepareWrite; +//# sourceMappingURL=prepareWrite.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/prepareWrite.js.map b/dist/bin/frameworks/filesystem/prepareWrite.js.map new file mode 100644 index 000000000..1857b86f5 --- /dev/null +++ b/dist/bin/frameworks/filesystem/prepareWrite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prepareWrite.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/prepareWrite.ts"],"names":[],"mappings":";;;AAEA,qDAAkF;AAClF,+EAA4E;AAE5E,6CAAqE;AAKrE,SAAgB,YAAY,CAAC,cAA8B;IACzD,IAAI;QACF,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAc,CAAC,CAAC;QAErD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC;QAE/E,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,SAAS;YAC5E,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;QAErC,MAAM,oBAAoB,GAAyB;YACjD,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAC7B,MAAM;YACN,IAAI,EAAE,wBAAO,CAAC,QAAQ,CAAC;YACvB,OAAO,EAAE,2BAAU,CAAC,QAAQ,CAAC;YAC7B,OAAO,EAAE,2BAAU,CAAC,QAAQ,CAAC;YAC7B,UAAU,EAAE,8BAAa,CAAC,QAAQ,CAAC;YACnC,QAAQ;YACR,SAAS;SACV,CAAC;QAEF,OAAO,6CAAqB,CAAC,oBAAoB,CAAC,CAAC;KACpD;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;KACpC;AACH,CAAC;AA3BD,oCA2BC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/refresh.js b/dist/bin/frameworks/filesystem/refresh.js new file mode 100644 index 000000000..05f69a078 --- /dev/null +++ b/dist/bin/frameworks/filesystem/refresh.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.refresh = void 0; +const tslib_1 = require("tslib"); +const trash_1 = tslib_1.__importDefault(require("trash")); +const createFolder_1 = require("./createFolder"); +const errors_1 = require("../errors/errors"); +async function refresh(path) { + try { + if (!path) + throw new Error(errors_1.ErrorRefresh); + await trash_1.default([`./${path}`]); + createFolder_1.createFolder(path); + } + catch (error) { + throw new Error(errors_1.ErrorRefresh); + } +} +exports.refresh = refresh; +//# sourceMappingURL=refresh.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/refresh.js.map b/dist/bin/frameworks/filesystem/refresh.js.map new file mode 100644 index 000000000..feb935061 --- /dev/null +++ b/dist/bin/frameworks/filesystem/refresh.js.map @@ -0,0 +1 @@ +{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/refresh.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,iDAA8C;AAE9C,6CAAgD;AAKzC,KAAK,UAAU,OAAO,CAAC,IAAY;IACxC,IAAI;QACF,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAY,CAAC,CAAC;QAEzC,MAAM,eAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3B,2BAAY,CAAC,IAAI,CAAC,CAAC;KACpB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,qBAAY,CAAC,CAAC;KAC/B;AACH,CAAC;AATD,0BASC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/write.js b/dist/bin/frameworks/filesystem/write.js new file mode 100644 index 000000000..9d656668a --- /dev/null +++ b/dist/bin/frameworks/filesystem/write.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.write = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const errors_1 = require("../errors/errors"); +function write(filePath, fileContent) { + try { + if (!filePath || !fileContent) + throw new Error(errors_1.ErrorWrite); + fs.writeFileSync(filePath, fileContent, 'utf-8'); + } + catch (error) { + throw new Error(errors_1.ErrorWrite); + } +} +exports.write = write; +//# sourceMappingURL=write.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/write.js.map b/dist/bin/frameworks/filesystem/write.js.map new file mode 100644 index 000000000..a11494af2 --- /dev/null +++ b/dist/bin/frameworks/filesystem/write.js.map @@ -0,0 +1 @@ +{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/write.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAEzB,6CAA8C;AAK9C,SAAgB,KAAK,CAAC,QAAgB,EAAE,WAAmB;IACzD,IAAI;QACF,IAAI,CAAC,QAAQ,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAU,CAAC,CAAC;QAC3D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;KAClD;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,mBAAU,CAAC,CAAC;KAC7B;AACH,CAAC;AAPD,sBAOC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/writeBaseJson.js b/dist/bin/frameworks/filesystem/writeBaseJson.js new file mode 100644 index 000000000..a21255cea --- /dev/null +++ b/dist/bin/frameworks/filesystem/writeBaseJson.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeBaseJson = void 0; +const refresh_1 = require("./refresh"); +const write_1 = require("./write"); +const messages_1 = require("../messages/messages"); +const errors_1 = require("../errors/errors"); +async function writeBaseJson(figmagicFolder, figmaData, data) { + if (!figmagicFolder || !figmaData || !data) + throw new Error(errors_1.ErrorWriteBaseJson); + console.log(messages_1.MsgWriteBaseFile); + try { + await refresh_1.refresh(figmagicFolder); + write_1.write(`${figmagicFolder}/${figmaData}`, JSON.stringify(data)); + } + catch (error) { + throw new Error(errors_1.ErrorWriteBaseJson); + } +} +exports.writeBaseJson = writeBaseJson; +//# sourceMappingURL=writeBaseJson.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/writeBaseJson.js.map b/dist/bin/frameworks/filesystem/writeBaseJson.js.map new file mode 100644 index 000000000..8162ce2e4 --- /dev/null +++ b/dist/bin/frameworks/filesystem/writeBaseJson.js.map @@ -0,0 +1 @@ +{"version":3,"file":"writeBaseJson.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/writeBaseJson.ts"],"names":[],"mappings":";;;AAEA,uCAAoC;AACpC,mCAAgC;AAEhC,mDAAwD;AACxD,6CAAsD;AAK/C,KAAK,UAAU,aAAa,CACjC,cAAsB,EACtB,SAAiB,EACjB,IAAyC;IAEzC,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;IAEhF,OAAO,CAAC,GAAG,CAAC,2BAAgB,CAAC,CAAC;IAC9B,IAAI;QACF,MAAM,iBAAO,CAAC,cAAc,CAAC,CAAC;QAC9B,aAAK,CAAC,GAAG,cAAc,IAAI,SAAS,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;KAC/D;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;KACrC;AACH,CAAC;AAdD,sCAcC"} \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/writeFile.js b/dist/bin/frameworks/filesystem/writeFile.js new file mode 100644 index 000000000..70c6698ef --- /dev/null +++ b/dist/bin/frameworks/filesystem/writeFile.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeFile = void 0; +const createFolder_1 = require("./createFolder"); +const prepareWrite_1 = require("./prepareWrite"); +const write_1 = require("./write"); +const acceptedFileTypes_1 = require("../system/acceptedFileTypes"); +const errors_1 = require("../errors/errors"); +function writeFile(writeOperation) { + try { + if (!writeOperation) + throw new Error(errors_1.ErrorWriteFile); + const { type, file, path, name, format, metadata, templates } = writeOperation; + if (!file || !path || !name || !type) + throw new Error(errors_1.ErrorWriteFile); + const TYPE = typeof type === 'string' ? type.toLowerCase() : 'null'; + if (!acceptedFileTypes_1.acceptedFileTypes.includes(TYPE)) + throw new Error(errors_1.ErrorWriteFileWrongType); + createFolder_1.createFolder(path); + const prepareWriteOperation = { + type: TYPE, + file, + path, + name, + format, + metadata, + templates + }; + const { filePath, fileContent } = prepareWrite_1.prepareWrite(prepareWriteOperation); + write_1.write(filePath, fileContent); + } + catch (error) { + throw new Error(errors_1.ErrorWriteFile); + } +} +exports.writeFile = writeFile; +//# sourceMappingURL=writeFile.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/filesystem/writeFile.js.map b/dist/bin/frameworks/filesystem/writeFile.js.map new file mode 100644 index 000000000..e1a7ebfd1 --- /dev/null +++ b/dist/bin/frameworks/filesystem/writeFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"writeFile.js","sourceRoot":"","sources":["../../../../bin/frameworks/filesystem/writeFile.ts"],"names":[],"mappings":";;;AAEA,iDAA8C;AAC9C,iDAA8C;AAC9C,mCAAgC;AAEhC,mEAAgE;AAEhE,6CAA2E;AAK3E,SAAgB,SAAS,CAAC,cAA8B;IACtD,IAAI;QACF,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAc,CAAC,CAAC;QAErD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC;QAC/E,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAc,CAAC,CAAC;QAEtE,MAAM,IAAI,GAAQ,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAEzE,IAAI,CAAC,qCAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAuB,CAAC,CAAC;QAEhF,2BAAY,CAAC,IAAI,CAAC,CAAC;QAEnB,MAAM,qBAAqB,GAAmB;YAC5C,IAAI,EAAE,IAAI;YACV,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,MAAM;YACN,QAAQ;YACR,SAAS;SACV,CAAC;QAEF,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,2BAAY,CAAC,qBAAqB,CAAC,CAAC;QACtE,aAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;KAC9B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,uBAAc,CAAC,CAAC;KACjC;AACH,CAAC;AA5BD,8BA4BC"} \ No newline at end of file diff --git a/dist/bin/frameworks/messages/messages.js b/dist/bin/frameworks/messages/messages.js new file mode 100644 index 000000000..09d428e32 --- /dev/null +++ b/dist/bin/frameworks/messages/messages.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgWriteTokens = exports.MsgWriteBaseFile = exports.MsgSyncGraphics = exports.MsgSyncElements = exports.MsgSetDataFromLocal = exports.MsgSetDataFromApi = exports.MsgProcessElementsCreatingElement = exports.MsgJobCompleteInitStopped = exports.MsgJobCompleteInit = exports.MsgJobComplete = exports.MsgGetTokenMatchNoMatch = exports.MsgGeneratedFileWarning = exports.MsgDownloadFileWritingFile = exports.MsgConfigDebugRc = exports.MsgConfigDebugFinal = exports.MsgConfigDebugEnv = exports.MsgConfigDebugCli = void 0; +const colors_1 = require("../system/colors"); +function Message(str, warn) { + if (warn) + return `${colors_1.colors.FgYellow}${str}${colors_1.colors.Reset}`; + else + return str; +} +function SuccessMessage(str) { + return `${colors_1.colors.FgGreen}${str}${colors_1.colors.Reset}`; +} +exports.MsgConfigDebugCli = Message(`USER: Command-Line configuration (Medium priority)\n`, true); +exports.MsgConfigDebugEnv = Message(`USER: Environment configuration (Low priority)\n`, true); +exports.MsgConfigDebugFinal = Message(`SYSTEM: Final user configuration that will be used...\n`, true); +exports.MsgConfigDebugRc = Message(`USER: .figmagicrc configuration (Highest priority)\n`, true); +exports.MsgDownloadFileWritingFile = (path) => `\nWriting Figma graphics to disk: ${path}`; +exports.MsgGeneratedFileWarning = Message('THIS FILE IS AUTO-GENERATED BY FIGMAGIC. DO NOT MAKE EDITS IN THIS FILE! CHANGES WILL GET OVER-WRITTEN BY ANY FURTHER PROCESSING.', false); +exports.MsgGetTokenMatchNoMatch = Message(`No matching token! Hard-coding to expected value:`, true); +exports.MsgJobComplete = SuccessMessage(`\nFigmagic completed operations successfully!\n`); +exports.MsgJobCompleteInit = SuccessMessage(`\nFigmagic created a base configuration (.figmagicrc) for you.\n`); +exports.MsgJobCompleteInitStopped = Message(`\nFigmagic tried to create a base configuration for you, but one already existed at .figmagicrc...\n`, true); +exports.MsgProcessElementsCreatingElement = (elementName, fixedName) => `Processing Figma element "${elementName}" as ---> ${fixedName}`; +exports.MsgSetDataFromApi = Message(`\nAttempting to fetch data from Figma API...`, true); +exports.MsgSetDataFromLocal = Message(`\nAttempting to recompile data from local Figma JSON file...`, true); +exports.MsgSyncElements = Message(`\nAttempting to parse elements...\n`, true); +exports.MsgSyncGraphics = Message(`\nGetting images from Figma API...`, true); +exports.MsgWriteBaseFile = Message(`\nWriting Figma base file...`, true); +exports.MsgWriteTokens = Message(`\nWriting design tokens...`, true); +//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/messages/messages.js.map b/dist/bin/frameworks/messages/messages.js.map new file mode 100644 index 000000000..5d0ed2e67 --- /dev/null +++ b/dist/bin/frameworks/messages/messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../bin/frameworks/messages/messages.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,SAAS,OAAO,CAAC,GAAW,EAAE,IAAa;IACzC,IAAI,IAAI;QAAE,OAAO,GAAG,eAAM,CAAC,QAAQ,GAAG,GAAG,GAAG,eAAM,CAAC,KAAK,EAAE,CAAC;;QACtD,OAAO,GAAG,CAAC;AAClB,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,GAAG,eAAM,CAAC,OAAO,GAAG,GAAG,GAAG,eAAM,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC;AAEY,QAAA,iBAAiB,GAAG,OAAO,CACtC,sDAAsD,EACtD,IAAI,CACL,CAAC;AACW,QAAA,iBAAiB,GAAG,OAAO,CAAC,kDAAkD,EAAE,IAAI,CAAC,CAAC;AACtF,QAAA,mBAAmB,GAAG,OAAO,CACxC,yDAAyD,EACzD,IAAI,CACL,CAAC;AACW,QAAA,gBAAgB,GAAG,OAAO,CACrC,sDAAsD,EACtD,IAAI,CACL,CAAC;AACW,QAAA,0BAA0B,GAAG,CAAC,IAAY,EAAU,EAAE,CACjE,qCAAqC,IAAI,EAAE,CAAC;AAEjC,QAAA,uBAAuB,GAAG,OAAO,CAC5C,mIAAmI,EACnI,KAAK,CACN,CAAC;AACW,QAAA,uBAAuB,GAAG,OAAO,CAC5C,mDAAmD,EACnD,IAAI,CACL,CAAC;AACW,QAAA,cAAc,GAAG,cAAc,CAAC,iDAAiD,CAAC,CAAC;AACnF,QAAA,kBAAkB,GAAG,cAAc,CAC9C,kEAAkE,CACnE,CAAC;AACW,QAAA,yBAAyB,GAAG,OAAO,CAC9C,sGAAsG,EACtG,IAAI,CACL,CAAC;AAEW,QAAA,iCAAiC,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAU,EAAE,CAClG,6BAA6B,WAAW,aAAa,SAAS,EAAE,CAAC;AACtD,QAAA,iBAAiB,GAAG,OAAO,CAAC,8CAA8C,EAAE,IAAI,CAAC,CAAC;AAClF,QAAA,mBAAmB,GAAG,OAAO,CACxC,8DAA8D,EAC9D,IAAI,CACL,CAAC;AACW,QAAA,eAAe,GAAG,OAAO,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;AACvE,QAAA,eAAe,GAAG,OAAO,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;AACtE,QAAA,gBAAgB,GAAG,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;AACjE,QAAA,cAAc,GAAG,OAAO,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/network/downloadFile.js b/dist/bin/frameworks/network/downloadFile.js new file mode 100644 index 000000000..e6c47be0b --- /dev/null +++ b/dist/bin/frameworks/network/downloadFile.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.downloadFile = void 0; +const tslib_1 = require("tslib"); +const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); +const fs = tslib_1.__importStar(require("fs")); +const messages_1 = require("../messages/messages"); +const errors_1 = require("../errors/errors"); +async function downloadFile(url, path) { + try { + if (!url || !path) + throw new Error(errors_1.ErrorDownloadFile); + const RESPONSE = await node_fetch_1.default(url); + if (RESPONSE.status !== 200) + return; + return new Promise((resolve, reject) => { + console.log(messages_1.MsgDownloadFileWritingFile(path)); + const FILE = fs.createWriteStream(path); + RESPONSE.body.pipe(FILE); + FILE.on('error', () => reject('Error when downloading file!')); + FILE.on('finish', () => resolve()); + }); + } + catch (error) { + throw new Error(errors_1.ErrorDownloadFile); + } +} +exports.downloadFile = downloadFile; +//# sourceMappingURL=downloadFile.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/network/downloadFile.js.map b/dist/bin/frameworks/network/downloadFile.js.map new file mode 100644 index 000000000..5c6e6d43d --- /dev/null +++ b/dist/bin/frameworks/network/downloadFile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"downloadFile.js","sourceRoot":"","sources":["../../../../bin/frameworks/network/downloadFile.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAC/B,+CAAyB;AAEzB,mDAAkE;AAClE,6CAAqD;AAK9C,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,IAAY;IAC1D,IAAI;QACF,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG,MAAM,oBAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO;QAEpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,qCAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC/D,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;KACpC;AACH,CAAC;AAjBD,oCAiBC"} \ No newline at end of file diff --git a/dist/bin/frameworks/network/getData.js b/dist/bin/frameworks/network/getData.js new file mode 100644 index 000000000..238acd570 --- /dev/null +++ b/dist/bin/frameworks/network/getData.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getData = void 0; +const getDataLocal_1 = require("./getDataLocal"); +const getDataRemote_1 = require("./getDataRemote"); +const errors_1 = require("../errors/errors"); +async function getData(recompileLocal, figmagicFolder, figmaData, token, url) { + try { + if (!recompileLocal && (!token || !url)) + throw new Error(errors_1.ErrorGetData); + if (recompileLocal && (!figmagicFolder || !figmaData)) + throw new Error(errors_1.ErrorGetDataNoTokenOrUrl); + const DATA = (async () => { + if (recompileLocal) + return getDataLocal_1.getDataLocal(figmagicFolder, figmaData); + else if (token && url) + return await getDataRemote_1.getDataRemote(token, url); + throw new Error(errors_1.ErrorGetDataFailedLocalAndRemote); + })(); + if (!DATA) + throw new Error(errors_1.ErrorGetDataNoData); + return DATA; + } + catch (error) { + throw new Error(errors_1.ErrorGetData); + } +} +exports.getData = getData; +//# sourceMappingURL=getData.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/network/getData.js.map b/dist/bin/frameworks/network/getData.js.map new file mode 100644 index 000000000..ea0787129 --- /dev/null +++ b/dist/bin/frameworks/network/getData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getData.js","sourceRoot":"","sources":["../../../../bin/frameworks/network/getData.ts"],"names":[],"mappings":";;;AAEA,iDAA8C;AAC9C,mDAAgD;AAEhD,6CAK0B;AAKnB,KAAK,UAAU,OAAO,CAC3B,cAAuB,EACvB,cAAsB,EACtB,SAAiB,EACjB,KAAoB,EACpB,GAAkB;IAElB,IAAI;QACF,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAY,CAAC,CAAC;QACvE,IAAI,cAAc,IAAI,CAAC,CAAC,cAAc,IAAI,CAAC,SAAS,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;QAE5C,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,EAAE;YACvB,IAAI,cAAc;gBAAE,OAAO,2BAAY,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;iBAC9D,IAAI,KAAK,IAAI,GAAG;gBAAE,OAAO,MAAM,6BAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAC9D,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;QACpD,CAAC,CAAC,EAAE,CAAC;QAEL,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,qBAAY,CAAC,CAAC;KAC/B;AACH,CAAC;AAvBD,0BAuBC"} \ No newline at end of file diff --git a/dist/bin/frameworks/network/getDataLocal.js b/dist/bin/frameworks/network/getDataLocal.js new file mode 100644 index 000000000..366fb31e7 --- /dev/null +++ b/dist/bin/frameworks/network/getDataLocal.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDataLocal = void 0; +const tslib_1 = require("tslib"); +const path = tslib_1.__importStar(require("path")); +const loadFile_1 = require("../filesystem/loadFile"); +const messages_1 = require("../messages/messages"); +const errors_1 = require("../errors/errors"); +function getDataLocal(figmagicFolder, figmaData) { + try { + if (!figmagicFolder || !figmaData) + throw new Error(errors_1.ErrorGetDataLocal); + console.log(messages_1.MsgSetDataFromLocal); + return loadFile_1.loadFile(path.join(`${figmagicFolder}`, `${figmaData}`)); + } + catch (error) { + throw new Error(errors_1.ErrorGetDataLocal); + } +} +exports.getDataLocal = getDataLocal; +//# sourceMappingURL=getDataLocal.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/network/getDataLocal.js.map b/dist/bin/frameworks/network/getDataLocal.js.map new file mode 100644 index 000000000..08d6ffde8 --- /dev/null +++ b/dist/bin/frameworks/network/getDataLocal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getDataLocal.js","sourceRoot":"","sources":["../../../../bin/frameworks/network/getDataLocal.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAI7B,qDAAkD;AAElD,mDAA2D;AAC3D,6CAAqD;AAKrD,SAAgB,YAAY,CAC1B,cAAsB,EACtB,SAAiB;IAEjB,IAAI;QACF,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,8BAAmB,CAAC,CAAC;QACjC,OAAO,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,cAAc,EAAE,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC;KACjE;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;KACpC;AACH,CAAC;AAXD,oCAWC"} \ No newline at end of file diff --git a/dist/bin/frameworks/network/getDataRemote.js b/dist/bin/frameworks/network/getDataRemote.js new file mode 100644 index 000000000..9ded0e97e --- /dev/null +++ b/dist/bin/frameworks/network/getDataRemote.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDataRemote = void 0; +const getFromApi_1 = require("./getFromApi"); +const errors_1 = require("../errors/errors"); +const messages_1 = require("../messages/messages"); +async function getDataRemote(token, url) { + try { + if (!token || !url) + throw new Error(errors_1.ErrorGetDataNoTokenOrUrl); + console.log(messages_1.MsgSetDataFromApi); + let data = null; + data = await getFromApi_1.getFromApi(token, url); + if (!data || data.status === 403) + throw new Error(errors_1.ErrorGetData); + return data; + } + catch (error) { + throw new Error(errors_1.ErrorGetDataNoTokenOrUrl); + } +} +exports.getDataRemote = getDataRemote; +//# sourceMappingURL=getDataRemote.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/network/getDataRemote.js.map b/dist/bin/frameworks/network/getDataRemote.js.map new file mode 100644 index 000000000..68e9cecfc --- /dev/null +++ b/dist/bin/frameworks/network/getDataRemote.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getDataRemote.js","sourceRoot":"","sources":["../../../../bin/frameworks/network/getDataRemote.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAE1C,6CAA0E;AAC1E,mDAAyD;AAKlD,KAAK,UAAU,aAAa,CAAC,KAAa,EAAE,GAAW;IAC5D,IAAI;QACF,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,4BAAiB,CAAC,CAAC;QAE/B,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,GAAG,MAAM,uBAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEpC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAY,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,iCAAwB,CAAC,CAAC;KAC3C;AACH,CAAC;AAbD,sCAaC"} \ No newline at end of file diff --git a/dist/bin/frameworks/network/getFromApi.js b/dist/bin/frameworks/network/getFromApi.js new file mode 100644 index 000000000..62325574b --- /dev/null +++ b/dist/bin/frameworks/network/getFromApi.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getFromApi = void 0; +const tslib_1 = require("tslib"); +const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); +const errors_1 = require("../errors/errors"); +async function getFromApi(figmaToken, figmaUrl, type = 'files') { + try { + if (!figmaToken || !figmaUrl) + throw new Error(errors_1.ErrorGetFromApi); + return await node_fetch_1.default(`https://api.figma.com/v1/${type}/${figmaUrl}`, { + headers: { + 'X-Figma-Token': figmaToken + } + }) + .then((res) => res.json()) + .catch(() => { + throw new Error(errors_1.ErrorGetFromApi); + }); + } + catch (error) { + throw new Error(errors_1.ErrorGetFromApi); + } +} +exports.getFromApi = getFromApi; +//# sourceMappingURL=getFromApi.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/network/getFromApi.js.map b/dist/bin/frameworks/network/getFromApi.js.map new file mode 100644 index 000000000..c4cd85221 --- /dev/null +++ b/dist/bin/frameworks/network/getFromApi.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFromApi.js","sourceRoot":"","sources":["../../../../bin/frameworks/network/getFromApi.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAI/B,6CAAmD;AAK5C,KAAK,UAAU,UAAU,CAC9B,UAAqC,EACrC,QAAmC,EACnC,IAAI,GAAG,OAAO;IAEd,IAAI;QACF,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAe,CAAC,CAAC;QAE/D,OAAO,MAAM,oBAAK,CAAC,4BAA4B,IAAI,IAAI,QAAQ,EAAE,EAAE;YACjE,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU;aAC5B;SACF,CAAC;aACC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACzB,KAAK,CAAC,GAAG,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,wBAAe,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;KACN;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,wBAAe,CAAC,CAAC;KAClC;AACH,CAAC;AApBD,gCAoBC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/camelize.js b/dist/bin/frameworks/string/camelize.js new file mode 100644 index 000000000..5b51384c7 --- /dev/null +++ b/dist/bin/frameworks/string/camelize.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.camelize = void 0; +const errors_1 = require("../errors/errors"); +function camelize(str) { + if (!str) + throw new Error(errors_1.ErrorCamelize); + return (str + .replace(/[A-Z]+/g, (word) => ' ' + word) + .replace(/[^a-zA-Z0-9]+/g, ' ') + .trim() + .replace(/[a-zA-Z0-9]+/g, (word, index) => index === 0 ? word.toLowerCase() : word[0].toUpperCase() + word.slice(1).toLowerCase()) + .replace(/ /g, '')); +} +exports.camelize = camelize; +//# sourceMappingURL=camelize.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/camelize.js.map b/dist/bin/frameworks/string/camelize.js.map new file mode 100644 index 000000000..1372c4eb9 --- /dev/null +++ b/dist/bin/frameworks/string/camelize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"camelize.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/camelize.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AAKjD,SAAgB,QAAQ,CAAC,GAAW;IAClC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAa,CAAC,CAAC;IAEzC,OAAO,CACL,GAAG;SAEA,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC;SAExC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAE9B,IAAI,EAAE;SAEN,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACxC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CACvF;SAEA,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CACrB,CAAC;AACJ,CAAC;AAlBD,4BAkBC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/convertHexToRgba.js b/dist/bin/frameworks/string/convertHexToRgba.js new file mode 100644 index 000000000..3955717a8 --- /dev/null +++ b/dist/bin/frameworks/string/convertHexToRgba.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertHexToRgba = void 0; +const roundColorValue_1 = require("./roundColorValue"); +const errors_1 = require("../errors/errors"); +function convertHexToRgba(r, g, b, a) { + if (!r || !g || !b || !a) + throw new Error(errors_1.ErrorConvertHexToRgba); + const R = roundColorValue_1.roundColorValue(r, 255); + const G = roundColorValue_1.roundColorValue(g, 255); + const B = roundColorValue_1.roundColorValue(b, 255); + const A = roundColorValue_1.roundColorValue(a, 1); + return `rgba(${R}, ${G}, ${B}, ${A})`; +} +exports.convertHexToRgba = convertHexToRgba; +//# sourceMappingURL=convertHexToRgba.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/convertHexToRgba.js.map b/dist/bin/frameworks/string/convertHexToRgba.js.map new file mode 100644 index 000000000..2566ffc65 --- /dev/null +++ b/dist/bin/frameworks/string/convertHexToRgba.js.map @@ -0,0 +1 @@ +{"version":3,"file":"convertHexToRgba.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/convertHexToRgba.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAEpD,6CAAyD;AAKzD,SAAgB,gBAAgB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IACzE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,8BAAqB,CAAC,CAAC;IAEjE,MAAM,CAAC,GAAG,iCAAe,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,iCAAe,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,iCAAe,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,iCAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhC,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AACxC,CAAC;AATD,4CASC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/convertRgbaToHex.js b/dist/bin/frameworks/string/convertRgbaToHex.js new file mode 100644 index 000000000..7b77b0b32 --- /dev/null +++ b/dist/bin/frameworks/string/convertRgbaToHex.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertRgbaToHex = void 0; +const errors_1 = require("../../frameworks/errors/errors"); +function convertRgbaToHex(color) { + if (!color) + throw new Error(errors_1.ErrorConvertRgbaToHex); + const VALUES = color + .replace(/rgba?\(/, '') + .replace(/\)/, '') + .replace(/[\s+]/g, '') + .split(','); + const A = parseFloat(VALUES[3] || 1), R = Math.floor(A * parseInt(VALUES[0]) + (1 - A) * 255), G = Math.floor(A * parseInt(VALUES[1]) + (1 - A) * 255), B = Math.floor(A * parseInt(VALUES[2]) + (1 - A) * 255); + return ('#' + + ('0' + R.toString(16)).slice(-2) + + ('0' + G.toString(16)).slice(-2) + + ('0' + B.toString(16)).slice(-2)); +} +exports.convertRgbaToHex = convertRgbaToHex; +//# sourceMappingURL=convertRgbaToHex.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/convertRgbaToHex.js.map b/dist/bin/frameworks/string/convertRgbaToHex.js.map new file mode 100644 index 000000000..581a5b9e3 --- /dev/null +++ b/dist/bin/frameworks/string/convertRgbaToHex.js.map @@ -0,0 +1 @@ +{"version":3,"file":"convertRgbaToHex.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/convertRgbaToHex.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AAIvE,SAAgB,gBAAgB,CAAC,K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utOfObject.js b/dist/bin/frameworks/string/createEnumStringOutOfObject.js new file mode 100644 index 000000000..61c48c740 --- /dev/null +++ b/dist/bin/frameworks/string/createEnumStringOutOfObject.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createEnumStringOutOfObject = void 0; +const errors_1 = require("../errors/errors"); +function createEnumStringOutOfObject(obj) { + if (!obj) + throw new Error(errors_1.ErrorCreateEnumStringOutOfObject); + return Object.entries(obj).reduce((acc, [key, value]) => { + return `${acc}\n '${key}' = '${value}',`; + }, ''); +} +exports.createEnumStringOutOfObject = createEnumStringOutOfObject; +//# sourceMappingURL=createEnumStringOutOfObject.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/createEnumStringOutOfObject.js.map b/dist/bin/frameworks/string/createEnumStringOutOfObject.js.map new file mode 100644 index 000000000..35f9ce8af --- /dev/null +++ b/dist/bin/frameworks/string/createEnumStringOutOfObject.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createEnumStringOutOfObject.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/createEnumStringOutOfObject.ts"],"names":[],"mappings":";;;AAAA,6CAAoE;AAKpE,SAAgB,2BAA2B,CAAC,GAAqC;IAC/E,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAgC,CAAC,CAAC;IAE5D,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,OAAO,GAAG,GAAG,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAAC;IAC5C,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAND,kEAMC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/createImportStringFromList.js b/dist/bin/frameworks/string/createImportStringFromList.js new file mode 100644 index 000000000..ece1ff79a --- /dev/null +++ b/dist/bin/frameworks/string/createImportStringFromList.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createImportStringFromList = void 0; +const errors_1 = require("../errors/errors"); +function createImportStringFromList(importArray) { + if (!importArray) + throw new Error(errors_1.ErrorCreateImportStringFromList); + if (!(importArray.length > 0)) + throw new Error(errors_1.ErrorCreateImportStringFromListZeroLength); + let importString = ``; + importArray.forEach((i) => { + importString += `import ${i} from 'tokens/${i}';\n`; + }); + return importString; +} +exports.createImportStringFromList = createImportStringFromList; +//# sourceMappingURL=createImportStringFromList.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/createImportStringFromList.js.map b/dist/bin/frameworks/string/createImportStringFromList.js.map new file mode 100644 index 000000000..fbe0cce9f --- /dev/null +++ b/dist/bin/frameworks/string/createImportStringFromList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createImportStringFromList.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/createImportStringFromList.ts"],"names":[],"mappings":";;;AAAA,6CAG0B;AAK1B,SAAgB,0BAA0B,CAAC,WAAkB;IAC3D,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,wCAA+B,CAAC,CAAC;IACnE,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAyC,CAAC,CAAC;IAE1F,IAAI,YAAY,GAAG,EAAE,CAAC;IAEtB,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACxB,YAAY,IAAI,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AAXD,gEAWC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/normalizeUnits.js b/dist/bin/frameworks/string/normalizeUnits.js new file mode 100644 index 000000000..b345727f0 --- /dev/null +++ b/dist/bin/frameworks/string/normalizeUnits.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeUnits = void 0; +const errors_1 = require("../errors/errors"); +function normalizeUnits(value, currentUnit, newUnit, remSize) { + if (!value || !currentUnit || !newUnit) + throw new Error(errors_1.ErrorNormalizeUnits); + let rootSize = undefined; + let unitSize = undefined; + if (currentUnit === 'px') + rootSize = 1; + if (currentUnit === 'percent') + rootSize = 1; + if (newUnit === 'rem' || newUnit === 'em') { + if (!remSize) + throw new Error(errors_1.ErrorNormalizeUnitsNoRemSize); + unitSize = remSize; + } + if (newUnit === 'unitless') + unitSize = value / 100; + if (currentUnit === 'cornerRadius' && newUnit === 'adjustedRadius') + return `${value}px`; + if (rootSize === undefined || unitSize === undefined) + throw new Error(errors_1.ErrorNormalizeUnitsUndefined); + if (newUnit === 'unitless') + return `${unitSize}`; + else { + const ADJUSTED_VALUE = value * (rootSize / unitSize); + return `${ADJUSTED_VALUE}${newUnit}`; + } +} +exports.normalizeUnits = normalizeUnits; +//# sourceMappingURL=normalizeUnits.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/normalizeUnits.js.map b/dist/bin/frameworks/string/normalizeUnits.js.map new file mode 100644 index 000000000..7376a35bc --- /dev/null +++ b/dist/bin/frameworks/string/normalizeUnits.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalizeUnits.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/normalizeUnits.ts"],"names":[],"mappings":";;;AAAA,6CAI0B;AAK1B,SAAgB,cAAc,CAC5B,KAAa,EACb,WAAmB,EACnB,OAAe,EACf,OAAgB;IAEhB,IAAI,CAAC,KAAK,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,4BAAmB,CAAC,CAAC;IAE7E,IAAI,QAAQ,GAAG,SAAS,CAAC;IACzB,IAAI,QAAQ,GAAG,SAAS,CAAC;IAGzB,IAAI,WAAW,KAAK,IAAI;QAAE,QAAQ,GAAG,CAAC,CAAC;IAGvC,IAAI,WAAW,KAAK,SAAS;QAAE,QAAQ,GAAG,CAAC,CAAC;IAG5C,IAAI,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,IAAI,EAAE;QACzC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;QAC5D,QAAQ,GAAG,OAAO,CAAC;KACpB;IAED,IAAI,OAAO,KAAK,UAAU;QAAE,QAAQ,GAAG,KAAK,GAAG,GAAG,CAAC;IAGnD,IAAI,WAAW,KAAK,cAAc,IAAI,OAAO,KAAK,gBAAgB;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IAExF,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS;QAClD,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;IAEhD,IAAI,OAAO,KAAK,UAAU;QAAE,OAAO,GAAG,QAAQ,EAAE,CAAC;SAC5C;QACH,MAAM,cAAc,GAAG,KAAK,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;QACrD,OAAO,GAAG,cAAc,GAAG,OAAO,EAAE,CAAC;KACtC;AACH,CAAC;AApCD,wCAoCC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/replaceMediaQuery.js b/dist/bin/frameworks/string/replaceMediaQuery.js new file mode 100644 index 000000000..9b99539e3 --- /dev/null +++ b/dist/bin/frameworks/string/replaceMediaQuery.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.replaceMediaQuery = void 0; +const errors_1 = require("../errors/errors"); +function replaceMediaQuery(str, match) { + if (!str || !match) + throw new Error(errors_1.ErrorReplaceMediaQuery); + const INDEX = str.indexOf(match); + if (INDEX === -1) + return str; + const QUERY_TYPE = match === '@upto' ? 'max' : 'min'; + const SLICE_START = match.length + 1; + const SLICE_LENGTH = SLICE_START + 6; + const QUERY = str.slice(INDEX, INDEX + SLICE_LENGTH); + const SIZE = QUERY.slice(SLICE_START, SLICE_LENGTH); + const REMAINDER = QUERY.replace(match, ''); + SIZE.replace(/![0-9]/gi, '').trim(); + return str + .replace(match, `@media query and (${QUERY_TYPE}-width: ${SIZE}px) {`) + .replace(REMAINDER, ''); +} +exports.replaceMediaQuery = replaceMediaQuery; +//# sourceMappingURL=replaceMediaQuery.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/replaceMediaQuery.js.map b/dist/bin/frameworks/string/replaceMediaQuery.js.map new file mode 100644 index 000000000..754818f51 --- /dev/null +++ b/dist/bin/frameworks/string/replaceMediaQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"replaceMediaQuery.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/replaceMediaQuery.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAK1D,SAAgB,iBAAiB,CAAC,GAAW,EAAE,KAAa;IAC1D,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,+BAAsB,CAAC,CAAC;IAE5D,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IAG7B,MAAM,UAAU,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAGrD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,WAAW,GAAG,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAG3C,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAEpC,OAAO,GAAG;SACP,OAAO,CAAC,KAAK,EAAE,qBAAqB,UAAU,WAAW,IAAI,OAAO,CAAC;SACrE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC5B,CAAC;AAtBD,8CAsBC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/roundColorValue.js b/dist/bin/frameworks/string/roundColorValue.js new file mode 100644 index 000000000..03d08672f --- /dev/null +++ b/dist/bin/frameworks/string/roundColorValue.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.roundColorValue = void 0; +const errors_1 = require("../errors/errors"); +function roundColorValue(quantity = 0.0, scale = 255) { + if (scale < 0 || scale > 255) + throw new Error(errors_1.ErrorRoundColorValue); + const MIN_VALUE = 0.0; + const MAX_VALUE = 1.0; + if (quantity < MIN_VALUE) + quantity = MIN_VALUE; + if (quantity > MAX_VALUE) + quantity = MAX_VALUE; + if (scale <= 1.0) + return parseFloat(quantity.toFixed(2)); + return parseFloat((quantity * scale).toFixed(0)); +} +exports.roundColorValue = roundColorValue; +//# sourceMappingURL=roundColorValue.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/roundColorValue.js.map b/dist/bin/frameworks/string/roundColorValue.js.map new file mode 100644 index 000000000..cdd2d8175 --- /dev/null +++ b/dist/bin/frameworks/string/roundColorValue.js.map @@ -0,0 +1 @@ +{"version":3,"file":"roundColorValue.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/roundColorValue.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAKxD,SAAgB,eAAe,CAAC,QAAQ,GAAG,GAAG,EAAE,KAAK,GAAG,GAAG;IACzD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;IAGpE,MAAM,SAAS,GAAG,GAAG,CAAC;IACtB,MAAM,SAAS,GAAG,GAAG,CAAC;IACtB,IAAI,QAAQ,GAAG,SAAS;QAAE,QAAQ,GAAG,SAAS,CAAC;IAC/C,IAAI,QAAQ,GAAG,SAAS;QAAE,QAAQ,GAAG,SAAS,CAAC;IAG/C,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD,OAAO,UAAU,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAbD,0CAaC"} \ No newline at end of file diff --git a/dist/bin/frameworks/string/toPascalCase.js b/dist/bin/frameworks/string/toPascalCase.js new file mode 100644 index 000000000..3779539da --- /dev/null +++ b/dist/bin/frameworks/string/toPascalCase.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toPascalCase = void 0; +const errors_1 = require("../errors/errors"); +function toPascalCase(str) { + if (!str) + throw new Error(errors_1.ErrorToPascalCase); + return str + .replace(/\w+/g, (w) => w[0].toUpperCase() + w.slice(1).toLowerCase()) + .replace(/\s+/g, ''); +} +exports.toPascalCase = toPascalCase; +//# sourceMappingURL=toPascalCase.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/string/toPascalCase.js.map b/dist/bin/frameworks/string/toPascalCase.js.map new file mode 100644 index 000000000..a1280182d --- /dev/null +++ b/dist/bin/frameworks/string/toPascalCase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toPascalCase.js","sourceRoot":"","sources":["../../../../bin/frameworks/string/toPascalCase.ts"],"names":[],"mappings":";;;AAAA,6CAAqD;AAKrD,SAAgB,YAAY,CAAC,GAAW;IACtC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;IAE7C,OAAO,GAAG;SACP,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACrE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACzB,CAAC;AAND,oCAMC"} \ No newline at end of file diff --git a/dist/bin/frameworks/system/acceptedFileTypes.js b/dist/bin/frameworks/system/acceptedFileTypes.js new file mode 100644 index 000000000..1290c9ab5 --- /dev/null +++ b/dist/bin/frameworks/system/acceptedFileTypes.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.acceptedFileTypes = void 0; +exports.acceptedFileTypes = [ + 'raw', + 'token', + 'component', + 'style', + 'css', + 'story', + 'description' +]; +//# sourceMappingURL=acceptedFileTypes.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/system/acceptedFileTypes.js.map b/dist/bin/frameworks/system/acceptedFileTypes.js.map new file mode 100644 index 000000000..dcb85f2f5 --- /dev/null +++ b/dist/bin/frameworks/system/acceptedFileTypes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"acceptedFileTypes.js","sourceRoot":"","sources":["../../../../bin/frameworks/system/acceptedFileTypes.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAa;IACzC,KAAK;IACL,OAAO;IACP,WAAW;IACX,OAAO;IACP,KAAK;IACL,OAAO;IACP,aAAa;CACd,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/system/acceptedTokenTypes.js b/dist/bin/frameworks/system/acceptedTokenTypes.js new file mode 100644 index 000000000..f6d130a5a --- /dev/null +++ b/dist/bin/frameworks/system/acceptedTokenTypes.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.acceptedTokenTypes = void 0; +exports.acceptedTokenTypes = [ + 'borderwidths', + 'color', + 'colors', + 'delays', + 'durations', + 'easings', + 'fontfamilies', + 'fontsizes', + 'fontweights', + 'letterspacings', + 'lineheights', + 'mediaqueries', + 'opacities', + 'radii', + 'shadows', + 'spacing', + 'spacings', + 'zindices' +]; +//# sourceMappingURL=acceptedTokenTypes.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/system/acceptedTokenTypes.js.map b/dist/bin/frameworks/system/acceptedTokenTypes.js.map new file mode 100644 index 000000000..8def3d32d --- /dev/null +++ b/dist/bin/frameworks/system/acceptedTokenTypes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"acceptedTokenTypes.js","sourceRoot":"","sources":["../../../../bin/frameworks/system/acceptedTokenTypes.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAa;IAC1C,cAAc;IACd,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,SAAS;IACT,cAAc;IACd,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,WAAW;IACX,OAAO;IACP,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;CACX,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/system/colors.js b/dist/bin/frameworks/system/colors.js new file mode 100644 index 000000000..d5a711242 --- /dev/null +++ b/dist/bin/frameworks/system/colors.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.colors = void 0; +exports.colors = { + BgBlack: '\x1b[40m', + BgBlue: '\x1b[44m', + BgCyan: '\x1b[46m', + BgGreen: '\x1b[42m', + BgMagenta: '\x1b[45m', + BgRed: '\x1b[41m', + BgWhite: '\x1b[47m', + BgYellow: '\x1b[43m', + FgBlack: '\x1b[30m', + FgBlue: '\x1b[34m', + FgCyan: '\x1b[36m', + FgGreen: '\x1b[32m', + FgMagenta: '\x1b[35m', + FgRed: '\x1b[31m', + FgWhite: '\x1b[37m', + FgYellow: '\x1b[33m', + Blink: '\x1b[5m', + Bright: '\x1b[1m', + Dim: '\x1b[2m', + Hidden: '\x1b[8m', + Reset: '\x1b[0m', + Reverse: '\x1b[7m', + Underscore: '\x1b[4m' +}; +//# sourceMappingURL=colors.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/system/colors.js.map b/dist/bin/frameworks/system/colors.js.map new file mode 100644 index 000000000..34369916a --- /dev/null +++ b/dist/bin/frameworks/system/colors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../../bin/frameworks/system/colors.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAQ;IACzB,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IAEpB,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IAEpB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;CACtB,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/system/ignoreElementsKeywords.js b/dist/bin/frameworks/system/ignoreElementsKeywords.js new file mode 100644 index 000000000..f8ad3982c --- /dev/null +++ b/dist/bin/frameworks/system/ignoreElementsKeywords.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ignoreElementsKeywords = void 0; +exports.ignoreElementsKeywords = ['ignore']; +//# sourceMappingURL=ignoreElementsKeywords.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/system/ignoreElementsKeywords.js.map b/dist/bin/frameworks/system/ignoreElementsKeywords.js.map new file mode 100644 index 000000000..78f5fb534 --- /dev/null +++ b/dist/bin/frameworks/system/ignoreElementsKeywords.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ignoreElementsKeywords.js","sourceRoot":"","sources":["../../../../bin/frameworks/system/ignoreElementsKeywords.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAa,CAAC,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/frameworks/system/validatorLists.js b/dist/bin/frameworks/system/validatorLists.js new file mode 100644 index 000000000..23b59a33a --- /dev/null +++ b/dist/bin/frameworks/system/validatorLists.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validSpacingUnitList = exports.validOutputDataTypeTokenList = exports.validOutputFormatTokensList = exports.validOutputFormatStorybookList = exports.validOutputFormatGraphicsList = exports.validOutputFormatElementsList = exports.validOutputFormatDescList = exports.validOutputFormatCssList = exports.validOpacitiesUnitList = exports.validLetterSpacingUnitList = exports.validFontUnitList = void 0; +exports.validFontUnitList = ['rem', 'em']; +exports.validLetterSpacingUnitList = ['em', 'px']; +exports.validOpacitiesUnitList = ['float', 'percent']; +exports.validOutputFormatCssList = ['ts', 'mjs', 'js']; +exports.validOutputFormatDescList = ['md', 'txt']; +exports.validOutputFormatElementsList = ['tsx', 'jsx', 'mjs', 'js']; +exports.validOutputFormatGraphicsList = ['svg', 'png']; +exports.validOutputFormatStorybookList = ['ts', 'js']; +exports.validOutputFormatTokensList = ['ts', 'mjs', 'js']; +exports.validOutputDataTypeTokenList = ['enum', 'null', null, undefined]; +exports.validSpacingUnitList = ['rem', 'em']; +//# sourceMappingURL=validatorLists.js.map \ No newline at end of file diff --git a/dist/bin/frameworks/system/validatorLists.js.map b/dist/bin/frameworks/system/validatorLists.js.map new file mode 100644 index 000000000..62a8c49d8 --- /dev/null +++ b/dist/bin/frameworks/system/validatorLists.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validatorLists.js","sourceRoot":"","sources":["../../../../bin/frameworks/system/validatorLists.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAClC,QAAA,0BAA0B,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC1C,QAAA,sBAAsB,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC9C,QAAA,wBAAwB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC/C,QAAA,yBAAyB,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,QAAA,6BAA6B,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC5D,QAAA,6BAA6B,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/C,QAAA,8BAA8B,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,QAAA,2BAA2B,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAClD,QAAA,4BAA4B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AACjE,QAAA,oBAAoB,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/usecases/createElements.js b/dist/bin/usecases/createElements.js new file mode 100644 index 000000000..0ca02da4a --- /dev/null +++ b/dist/bin/usecases/createElements.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createElements = void 0; +const createPage_1 = require("./interactors/common/createPage"); +const processElements_1 = require("./interactors/elements/processElements"); +const writeElements_1 = require("./interactors/elements/writeElements"); +const refresh_1 = require("../frameworks/filesystem/refresh"); +const messages_1 = require("../frameworks/messages/messages"); +const errors_1 = require("../frameworks/errors/errors"); +async function createElements(config, data) { + try { + if (!config || !data) + throw new Error(errors_1.ErrorCreateElements); + console.log(messages_1.MsgSyncElements); + } + catch (error) { + throw new Error(error); + } + try { + await refresh_1.refresh(config.outputFolderElements); + const { components } = data; + const ELEMENTS_PAGE = createPage_1.createPage(data.document.children, 'Elements'); + const ELEMENTS = processElements_1.processElements(ELEMENTS_PAGE, config, components); + writeElements_1.writeElements(ELEMENTS, config); + } + catch (error) { + throw new Error(error); + } +} +exports.createElements = createElements; +//# sourceMappingURL=createElements.js.map \ No newline at end of file diff --git a/dist/bin/usecases/createElements.js.map b/dist/bin/usecases/createElements.js.map new file mode 100644 index 000000000..89512f024 --- /dev/null +++ b/dist/bin/usecases/createElements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createElements.js","sourceRoot":"","sources":["../../../bin/usecases/createElements.ts"],"names":[],"mappings":";;;AAGA,gEAA6D;AAC7D,4EAAyE;AACzE,wEAAqE;AAErE,8DAA2D;AAE3D,8DAAkE;AAClE,wDAAkE;AAK3D,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,IAAe;IAClE,IAAI;QACF,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4BAAmB,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,0BAAe,CAAC,CAAC;KAC9B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;KACxB;IAED,IAAI;QACF,MAAM,iBAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAE3C,MAAM,EAAE,UAAU,EAAE,GAAQ,IAAI,CAAC;QACjC,MAAM,aAAa,GAAG,uBAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,iCAAe,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAEpE,6BAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACjC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC;AAnBD,wCAmBC"} \ No newline at end of file diff --git a/dist/bin/usecases/createGraphics.js b/dist/bin/usecases/createGraphics.js new file mode 100644 index 000000000..d015b021e --- /dev/null +++ b/dist/bin/usecases/createGraphics.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createGraphics = void 0; +const createPage_1 = require("./interactors/common/createPage"); +const processGraphics_1 = require("./interactors/graphics/processGraphics"); +const writeGraphics_1 = require("./interactors/graphics/writeGraphics"); +const refresh_1 = require("../frameworks/filesystem/refresh"); +const messages_1 = require("../frameworks/messages/messages"); +const errors_1 = require("../frameworks/errors/errors"); +async function createGraphics(config, data) { + try { + if (!config || !data) + throw new Error(errors_1.ErrorCreateGraphics); + console.log(messages_1.MsgSyncGraphics); + await refresh_1.refresh(config.outputFolderGraphics); + const graphicsPage = createPage_1.createPage(data.document.children, 'Graphics'); + const fileList = await processGraphics_1.processGraphics(graphicsPage, config); + await writeGraphics_1.writeGraphics(fileList, config); + } + catch (error) { + throw new Error(errors_1.ErrorCreateGraphics); + } +} +exports.createGraphics = createGraphics; +//# sourceMappingURL=createGraphics.js.map \ No newline at end of file diff --git a/dist/bin/usecases/createGraphics.js.map b/dist/bin/usecases/createGraphics.js.map new file mode 100644 index 000000000..c0bdb3f71 --- /dev/null +++ b/dist/bin/usecases/createGraphics.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createGraphics.js","sourceRoot":"","sources":["../../../bin/usecases/createGraphics.ts"],"names":[],"mappings":";;;AAGA,gEAA6D;AAC7D,4EAAyE;AACzE,wEAAqE;AAErE,8DAA2D;AAE3D,8DAAkE;AAClE,wDAAkE;AAK3D,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,IAAe;IAClE,IAAI;QACF,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4BAAmB,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,0BAAe,CAAC,CAAC;QAE7B,MAAM,iBAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAE3C,MAAM,YAAY,GAAG,uBAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,iCAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAE7D,MAAM,6BAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACvC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,4BAAmB,CAAC,CAAC;KACtC;AACH,CAAC;AAdD,wCAcC"} \ No newline at end of file diff --git a/dist/bin/usecases/createTokens.js b/dist/bin/usecases/createTokens.js new file mode 100644 index 000000000..2c28b7e94 --- /dev/null +++ b/dist/bin/usecases/createTokens.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createTokens = void 0; +const createPage_1 = require("./interactors/common/createPage"); +const processTokens_1 = require("./interactors/tokens/processTokens"); +const writeTokens_1 = require("./interactors/tokens/writeTokens"); +const refresh_1 = require("../frameworks/filesystem/refresh"); +const messages_1 = require("../frameworks/messages/messages"); +const errors_1 = require("../frameworks/errors/errors"); +async function createTokens(config, data) { + try { + if (!config || !data) + throw new Error(errors_1.ErrorCreateTokens); + console.log(messages_1.MsgWriteTokens); + await refresh_1.refresh(config.outputFolderTokens); + const tokensPage = createPage_1.createPage(data.document.children, 'Design Tokens'); + const processedTokens = processTokens_1.processTokens(tokensPage, config); + writeTokens_1.writeTokens(processedTokens); + } + catch (error) { + throw new Error(errors_1.ErrorCreateTokens); + } +} +exports.createTokens = createTokens; +//# sourceMappingURL=createTokens.js.map \ No newline at end of file diff --git a/dist/bin/usecases/createTokens.js.map b/dist/bin/usecases/createTokens.js.map new file mode 100644 index 000000000..26061510d --- /dev/null +++ b/dist/bin/usecases/createTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createTokens.js","sourceRoot":"","sources":["../../../bin/usecases/createTokens.ts"],"names":[],"mappings":";;;AAIA,gEAA6D;AAC7D,sEAAmE;AACnE,kEAA+D;AAE/D,8DAA2D;AAE3D,8DAAiE;AACjE,wDAAgE;AAKzD,KAAK,UAAU,YAAY,CAAC,MAAc,EAAE,IAAe;IAChE,IAAI;QACF,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,yBAAc,CAAC,CAAC;QAE5B,MAAM,iBAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAEzC,MAAM,UAAU,GAAY,uBAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAChF,MAAM,eAAe,GAAG,6BAAa,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAE1D,yBAAW,CAAC,eAAe,CAAC,CAAC;KAC9B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,0BAAiB,CAAC,CAAC;KACpC;AACH,CAAC;AAdD,oCAcC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/common/createPage.js b/dist/bin/usecases/interactors/common/createPage.js new file mode 100644 index 000000000..954be0f18 --- /dev/null +++ b/dist/bin/usecases/interactors/common/createPage.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createPage = void 0; +const errors_1 = require("../../../frameworks/errors/errors"); +function createPage(figmaPages, matchingPageName) { + try { + if (!figmaPages || !(figmaPages.length > 0)) + throw new Error(errors_1.ErrorCreatePage); + const PAGE = figmaPages.filter((page) => page.name.toLowerCase().replace(/ /g, '') === + matchingPageName.toLowerCase().replace(/ /g, '')); + if (PAGE.length > 0 && PAGE[0].children) + return PAGE[0].children; + return []; + } + catch (error) { + throw new Error(errors_1.ErrorCreatePage); + } +} +exports.createPage = createPage; +//# sourceMappingURL=createPage.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/common/createPage.js.map b/dist/bin/usecases/interactors/common/createPage.js.map new file mode 100644 index 000000000..530242677 --- /dev/null +++ b/dist/bin/usecases/interactors/common/createPage.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createPage.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/common/createPage.ts"],"names":[],"mappings":";;;AAEA,8DAAoE;AAKpE,SAAgB,UAAU,CAAC,UAAmB,EAAE,gBAAwB;IACtE,IAAI;QACF,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAe,CAAC,CAAC;QAE9E,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAC5B,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACzC,gBAAgB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CACnD,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACjE,OAAO,EAAE,CAAC;KACX;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,wBAAe,CAAC,CAAC;KAClC;AACH,CAAC;AAfD,gCAeC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/elements/processElements.js b/dist/bin/usecases/interactors/elements/processElements.js new file mode 100644 index 000000000..4793297fc --- /dev/null +++ b/dist/bin/usecases/interactors/elements/processElements.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.processElements = void 0; +const FigmagicElement_1 = require("../../../entities/FigmagicElement"); +const errors_1 = require("../../../frameworks/errors/errors"); +function processElements(elementsPage, config, components) { + try { + if (!elementsPage || !components || !config) + throw new Error(errors_1.ErrorProcessElements); + const FILTERED_ELEMENTS = elementsPage.filter((element) => element.type === 'COMPONENT'); + const PARSED_ELEMENTS = FILTERED_ELEMENTS.map((element) => FigmagicElement_1.makeFigmagicElement(element, config, components[element.id].description)); + return PARSED_ELEMENTS; + } + catch (error) { + throw new Error(errors_1.ErrorProcessElements); + } +} +exports.processElements = processElements; +//# sourceMappingURL=processElements.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/elements/processElements.js.map b/dist/bin/usecases/interactors/elements/processElements.js.map new file mode 100644 index 000000000..e15e76e76 --- /dev/null +++ b/dist/bin/usecases/interactors/elements/processElements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processElements.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/elements/processElements.ts"],"names":[],"mappings":";;;AAAA,uEAAwE;AAMxE,8DAAyE;AASzE,SAAgB,eAAe,CAC7B,YAAmB,EACnB,MAAc,EACd,UAA+B;IAE/B,IAAI;QACF,IAAI,CAAC,YAAY,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;QAEnF,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QACzF,MAAM,eAAe,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,OAAqB,EAAE,EAAE,CACtE,qCAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CACzE,CAAC;QACF,OAAO,eAAe,CAAC;KACxB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;KACvC;AACH,CAAC;AAhBD,0CAgBC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/elements/writeElements.js b/dist/bin/usecases/interactors/elements/writeElements.js new file mode 100644 index 000000000..2790cb0b3 --- /dev/null +++ b/dist/bin/usecases/interactors/elements/writeElements.js @@ -0,0 +1,130 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeElements = void 0; +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const toPascalCase_1 = require("../../../frameworks/string/toPascalCase"); +const writeFile_1 = require("../../../frameworks/filesystem/writeFile"); +const errors_1 = require("../../../frameworks/errors/errors"); +function writeElements(elements, config) { + try { + if (!elements || !config) + throw new Error(errors_1.ErrorWriteElements); + elements.forEach((element) => { + const FIXED_CONFIG = makeFixedConfig(element, config); + if (!config.skipFileGeneration.skipReact) + writeComponent(FIXED_CONFIG); + if (!config.skipFileGeneration.skipStyled) + writeStyled(FIXED_CONFIG); + if (!config.skipFileGeneration.skipCss) + writeCss(FIXED_CONFIG); + if (!config.skipFileGeneration.skipStorybook) + writeStorybook(FIXED_CONFIG); + if (!config.skipFileGeneration.skipDescription) + writeDescription(FIXED_CONFIG); + }); + } + catch (error) { + throw new Error(errors_1.ErrorWriteElements); + } +} +exports.writeElements = writeElements; +const makeFixedConfig = (element, config) => { + const html = element.html || ' '; + const css = element.css || ' '; + const description = element.description || ' '; + const name = toPascalCase_1.toPascalCase(element.name); + const folder = `${config.outputFolderElements}/${name}`; + const outputFormatCss = config.outputFormatCss; + const outputFormatDescription = config.outputFormatDescription; + const outputFormatElements = config.outputFormatElements; + const outputFormatStorybook = config.outputFormatStorybook; + const metadata = { + dataType: null, + html: element.html, + element: element.element, + extraProps: element.extraProps, + text: element.text || ' ', + imports: element.imports + }; + const templates = config.templates; + const forceUpdate = config.skipFileGeneration.forceUpdate; + const fixedName = name.replace(/\//gi, ''); + return { + html, + css, + description, + name, + folder, + outputFormatCss, + outputFormatDescription, + outputFormatElements, + outputFormatStorybook, + metadata, + templates, + forceUpdate, + fixedName + }; +}; +const writeComponent = (config) => { + const FILE_EXISTS = fs.existsSync(`${config.folder}/${config.fixedName}.${config.outputFormatElements}`); + if (!FILE_EXISTS || config.forceUpdate) + writeFile_1.writeFile({ + type: 'component', + file: config.html, + path: config.folder, + name: config.fixedName, + format: config.outputFormatElements, + metadata: config.metadata, + templates: config.templates + }); +}; +const writeStyled = (config) => { + const FILE_EXISTS = fs.existsSync(`${config.folder}/${config.fixedName}Styled.${config.outputFormatElements}`); + if (!FILE_EXISTS || config.forceUpdate) + writeFile_1.writeFile({ + type: 'style', + file: config.css, + path: config.folder, + name: config.fixedName, + format: config.outputFormatElements, + metadata: config.metadata, + templates: config.templates + }); +}; +const writeCss = (config) => { + writeFile_1.writeFile({ + type: 'css', + file: config.css, + path: config.folder, + name: config.name, + format: config.outputFormatCss, + metadata: config.metadata, + templates: config.templates + }); +}; +const writeStorybook = (config) => { + const FILE_EXISTS = fs.existsSync(`${config.folder}/${config.fixedName}.stories.${config.outputFormatStorybook}`); + if (!FILE_EXISTS || config.forceUpdate) + writeFile_1.writeFile({ + type: 'story', + file: config.css, + path: config.folder, + name: config.fixedName, + format: config.outputFormatStorybook, + metadata: config.metadata, + templates: config.templates + }); +}; +const writeDescription = (config) => { + writeFile_1.writeFile({ + type: 'description', + file: config.description, + path: config.folder, + name: config.name, + format: config.outputFormatDescription, + metadata: config.metadata, + templates: config.templates + }); +}; +//# sourceMappingURL=writeElements.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/elements/writeElements.js.map b/dist/bin/usecases/interactors/elements/writeElements.js.map new file mode 100644 index 000000000..1b26f7870 --- /dev/null +++ b/dist/bin/usecases/interactors/elements/writeElements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"writeElements.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/elements/writeElements.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AAMzB,0EAAuE;AACvE,wEAAqE;AAErE,8DAAuE;AAKvE,SAAgB,aAAa,CAAC,QAAe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AAW,IAAI,MAAM,CAAC,WAAW;QACpC,qBAAS,CAAC;YACR,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM,CAAC,GAAG;YAChB,IAAI,EAAE,MAAM,CAAC,MAAM;YACnB,IAAI,EAAE,MAAM,CAAC,SAAS;YACtB,MAAM,EAAE,MAAM,CAAC,qBAAqB;YACpC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,SAAS;SACV,CAAC,CAAC;AACzB,CAAC,CAAC;AAKF,MAAM,gBAAgB,GAAG,CAAC,MAAsB,EAAQ,EAAE;IACxD,qBAAS,CAAC;QACR,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,MAAM,CAAC,WAAW;QACxB,IAAI,EAAE,MAAM,CAAC,MAAM;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,uBAAuB;QACtC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,EAAE,MAAM,CAAC,SAAS;KACV,CAAC,CAAC;AACvB,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/getFileList.js b/dist/bin/usecases/interactors/graphics/getFileList.js new file mode 100644 index 000000000..912b48d1f --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/getFileList.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getFileList = void 0; +const camelize_1 = require("../../../frameworks/string/camelize"); +const errors_1 = require("../../../frameworks/errors/errors"); +exports.getFileList = (imageResponse, ids, outputFormatGraphics) => { + if (!imageResponse || !ids || !outputFormatGraphics) + throw new Error(errors_1.ErrorGetFileList); + return Object.entries(imageResponse.images).map((image) => { + const MATCH = ids.filter((id) => id.id === image[0]); + return { + url: image[1], + file: `${camelize_1.camelize(MATCH[0].name)}.${outputFormatGraphics}` + }; + }); +}; +//# sourceMappingURL=getFileList.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/getFileList.js.map b/dist/bin/usecases/interactors/graphics/getFileList.js.map new file mode 100644 index 000000000..34e9c2c14 --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/getFileList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFileList.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/graphics/getFileList.ts"],"names":[],"mappings":";;;AAGA,kEAA+D;AAC/D,8DAAqE;AAKxD,QAAA,WAAW,GAAG,CACzB,aAA4B,EAC5B,GAAU,EACV,oBAA4B,EAChB,EAAE;IACd,IAAI,CAAC,aAAa,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;IAEvF,OAAO,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACxD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO;YACL,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACb,IAAI,EAAE,GAAG,mBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,oBAAoB,EAAE;SAC/C,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/getIdString.js b/dist/bin/usecases/interactors/graphics/getIdString.js new file mode 100644 index 000000000..38e65a268 --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/getIdString.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIdString = void 0; +const errors_1 = require("../../../frameworks/errors/errors"); +exports.getIdString = (ids) => { + if (!ids) + throw new Error(errors_1.ErrorGetIdstring); + let idString = ''; + ids.forEach((item) => (idString += `${item.id},`)); + return idString.slice(0, idString.length - 1); +}; +//# sourceMappingURL=getIdString.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/getIdString.js.map b/dist/bin/usecases/interactors/graphics/getIdString.js.map new file mode 100644 index 000000000..df9c37d72 --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/getIdString.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getIdString.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/graphics/getIdString.ts"],"names":[],"mappings":";;;AAAA,8DAAqE;AAKxD,QAAA,WAAW,GAAG,CAAC,GAAU,EAAU,EAAE;IAChD,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;IAE5C,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,IAAI,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/getIds.js b/dist/bin/usecases/interactors/graphics/getIds.js new file mode 100644 index 000000000..f4f60971a --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/getIds.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIds = void 0; +const errors_1 = require("../../../frameworks/errors/errors"); +exports.getIds = (graphicsPage) => { + if (!graphicsPage) + throw new Error(errors_1.ErrorGetIds); + if (!(graphicsPage.length > 0)) + throw new Error(errors_1.ErrorGetIds); + return graphicsPage + .filter((item) => item.type === 'COMPONENT') + .map((item) => { + return { id: item.id, name: item.name }; + }); +}; +//# sourceMappingURL=getIds.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/getIds.js.map b/dist/bin/usecases/interactors/graphics/getIds.js.map new file mode 100644 index 000000000..e74d72321 --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/getIds.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getIds.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/graphics/getIds.ts"],"names":[],"mappings":";;;AAEA,8DAAgE;AAKnD,QAAA,MAAM,GAAG,CAAC,YAAqB,EAA6B,EAAE;IACzE,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAW,CAAC,CAAC;IAChD,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAW,CAAC,CAAC;IAE7D,OAAO,YAAY;SAChB,MAAM,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;SAChD,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;QACjB,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/processGraphics.js b/dist/bin/usecases/interactors/graphics/processGraphics.js new file mode 100644 index 000000000..c074fa27b --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/processGraphics.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.processGraphics = void 0; +const getIds_1 = require("./getIds"); +const getIdString_1 = require("./getIdString"); +const getFileList_1 = require("./getFileList"); +const getFromApi_1 = require("../../../frameworks/network/getFromApi"); +const errors_1 = require("../../../frameworks/errors/errors"); +async function processGraphics(graphicsPage, config) { + if (!graphicsPage) + throw new Error(errors_1.ErrorProcessGraphics); + const { token, url, outputFormatGraphics, outputScaleGraphics } = config; + if (!token) + throw new Error(errors_1.ErrorProcessGraphics); + if (graphicsPage.length === 0 || !graphicsPage[0].children) + throw new Error(errors_1.ErrorProcessGraphics); + const IDS = getIds_1.getIds(graphicsPage); + const SETTINGS = `&scale=${outputScaleGraphics}&format=${outputFormatGraphics}`; + const URL = `${url}?ids=${getIdString_1.getIdString(IDS)}${SETTINGS}`; + const IMAGE_RESPONSE = await getFromApi_1.getFromApi(token, URL, 'images'); + if (IMAGE_RESPONSE.err) + throw new Error(errors_1.ErrorProcessGraphicsImageError); + if (!IMAGE_RESPONSE.images) + throw new Error(errors_1.ErrorProcessGraphicsNoImages); + return getFileList_1.getFileList(IMAGE_RESPONSE, IDS, outputFormatGraphics); +} +exports.processGraphics = processGraphics; +//# sourceMappingURL=processGraphics.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/processGraphics.js.map b/dist/bin/usecases/interactors/graphics/processGraphics.js.map new file mode 100644 index 000000000..ef8ff3416 --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/processGraphics.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processGraphics.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/graphics/processGraphics.ts"],"names":[],"mappings":";;;AAKA,qCAAkC;AAClC,+CAA4C;AAC5C,+CAA4C;AAE5C,uEAAoE;AAEpE,8DAI2C;AAKpC,KAAK,UAAU,eAAe,CAAC,YAAqB,EAAE,MAAc;IACzE,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;IAEzD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IACzE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;IAClD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,CAAC;IAElG,MAAM,GAAG,GAAG,eAAM,CAAC,YAAY,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,UAAU,mBAAmB,WAAW,oBAAoB,EAAE,CAAC;IAChF,MAAM,GAAG,GAAG,GAAG,GAAG,QAAQ,yBAAW,CAAC,GAAG,CAAC,GAAG,QAAQ,EAAE,CAAC;IAExD,MAAM,cAAc,GAAkB,MAAM,uBAAU,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7E,IAAI,cAAc,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,uCAA8B,CAAC,CAAC;IACxE,IAAI,CAAC,cAAc,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,qCAA4B,CAAC,CAAC;IAE1E,OAAO,yBAAW,CAAC,cAAc,EAAE,GAAG,EAAE,oBAAoB,CAAC,CAAC;AAChE,CAAC;AAhBD,0CAgBC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/writeGraphics.js b/dist/bin/usecases/interactors/graphics/writeGraphics.js new file mode 100644 index 000000000..f695055c7 --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/writeGraphics.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeGraphics = void 0; +const createFolder_1 = require("../../../frameworks/filesystem/createFolder"); +const downloadFile_1 = require("../../../frameworks/network/downloadFile"); +const errors_1 = require("../../../frameworks/errors/errors"); +async function writeGraphics(fileList, config) { + try { + if (!fileList || !config) + throw new Error(errors_1.ErrorWriteGraphics); + const { outputFolderGraphics } = config; + createFolder_1.createFolder(outputFolderGraphics); + await Promise.all(fileList.map(async (file) => await downloadFile_1.downloadFile(file.url, `${outputFolderGraphics}/${file.file}`))); + } + catch (error) { + throw new Error(errors_1.ErrorWriteGraphics); + } +} +exports.writeGraphics = writeGraphics; +//# sourceMappingURL=writeGraphics.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/graphics/writeGraphics.js.map b/dist/bin/usecases/interactors/graphics/writeGraphics.js.map new file mode 100644 index 000000000..c239bba9d --- /dev/null +++ b/dist/bin/usecases/interactors/graphics/writeGraphics.js.map @@ -0,0 +1 @@ +{"version":3,"file":"writeGraphics.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/graphics/writeGraphics.ts"],"names":[],"mappings":";;;AAEA,8EAA2E;AAC3E,2EAAwE;AAExE,8DAAuE;AAKhE,KAAK,UAAU,aAAa,CAAC,QAAe,EAAE,MAAc;IACjE,IAAI;QACF,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;QAE9D,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;QACxC,2BAAY,CAAC,oBAAoB,CAAC,CAAC;QAEnC,MAAM,OAAO,CAAC,GAAG,CACf,QAAQ,CAAC,GAAG,CACV,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,2BAAY,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,oBAAoB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CACrF,CACF,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,2BAAkB,CAAC,CAAC;KACrC;AACH,CAAC;AAfD,sCAeC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/tokens/processTokens.js b/dist/bin/usecases/interactors/tokens/processTokens.js new file mode 100644 index 000000000..75995f484 --- /dev/null +++ b/dist/bin/usecases/interactors/tokens/processTokens.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.processTokens = void 0; +const index_1 = require("../../../entities/Token/index"); +const camelize_1 = require("../../../frameworks/string/camelize"); +const acceptedTokenTypes_1 = require("../../../frameworks/system/acceptedTokenTypes"); +const errors_1 = require("../../../frameworks/errors/errors"); +function processTokens(tokens, config) { + try { + if (!tokens) + throw new Error(errors_1.ErrorWriteTokens); + if (!(tokens.length > 0)) + throw new Error(errors_1.ErrorWriteTokens); + if (!config) + throw new Error(errors_1.ErrorWriteTokensNoSettings); + const PROCESSED_TOKENS = []; + tokens.forEach((token) => { + const TOKEN_NAME = camelize_1.camelize(token.name); + if (acceptedTokenTypes_1.acceptedTokenTypes.includes(TOKEN_NAME.toLowerCase())) { + const _TOKEN = index_1.makeToken(token, TOKEN_NAME, config); + const WRITE_OP = _TOKEN.getWriteOperation(); + if (WRITE_OP) + PROCESSED_TOKENS.push(WRITE_OP); + } + }); + return PROCESSED_TOKENS; + } + catch (error) { + throw new Error(errors_1.ErrorWriteTokens); + } +} +exports.processTokens = processTokens; +//# sourceMappingURL=processTokens.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/tokens/processTokens.js.map b/dist/bin/usecases/interactors/tokens/processTokens.js.map new file mode 100644 index 000000000..d0189a578 --- /dev/null +++ b/dist/bin/usecases/interactors/tokens/processTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processTokens.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/tokens/processTokens.ts"],"names":[],"mappings":";;;AAAA,yDAA0D;AAM1D,kEAA+D;AAC/D,sFAAmF;AAEnF,8DAAiG;AAKjG,SAAgB,aAAa,CAAC,MAAe,EAAE,MAAc;IAC3D,IAAI;QACF,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;QAC/C,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,mCAA0B,CAAC,CAAC;QAEzD,MAAM,gBAAgB,GAAqB,EAAE,CAAC;QAE9C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,MAAM,UAAU,GAAG,mBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,uCAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE;gBACzD,MAAM,MAAM,GAAG,iBAAS,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;gBACpD,MAAM,QAAQ,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC5C,IAAI,QAAQ;oBAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC;KACzB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;KACnC;AACH,CAAC;AArBD,sCAqBC"} \ No newline at end of file diff --git a/dist/bin/usecases/interactors/tokens/writeTokens.js b/dist/bin/usecases/interactors/tokens/writeTokens.js new file mode 100644 index 000000000..4386103ab --- /dev/null +++ b/dist/bin/usecases/interactors/tokens/writeTokens.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeTokens = void 0; +const writeFile_1 = require("../../../frameworks/filesystem/writeFile"); +const errors_1 = require("../../../frameworks/errors/errors"); +function writeTokens(processedTokens) { + try { + if (!processedTokens) + throw new Error(errors_1.ErrorWriteTokens); + processedTokens.forEach((token) => writeFile_1.writeFile(token)); + } + catch (error) { + throw new Error(errors_1.ErrorWriteTokens); + } +} +exports.writeTokens = writeTokens; +//# sourceMappingURL=writeTokens.js.map \ No newline at end of file diff --git a/dist/bin/usecases/interactors/tokens/writeTokens.js.map b/dist/bin/usecases/interactors/tokens/writeTokens.js.map new file mode 100644 index 000000000..8e4e24aef --- /dev/null +++ b/dist/bin/usecases/interactors/tokens/writeTokens.js.map @@ -0,0 +1 @@ +{"version":3,"file":"writeTokens.js","sourceRoot":"","sources":["../../../../../bin/usecases/interactors/tokens/writeTokens.ts"],"names":[],"mappings":";;;AAEA,wEAAqE;AAErE,8DAAqE;AAKrE,SAAgB,WAAW,CAAC,eAAiC;IAC3D,IAAI;QACF,IAAI,CAAC,eAAe;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;QACxD,eAAe,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;KACtD;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,CAAC;KACnC;AACH,CAAC;AAPD,kCAOC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100755 index 000000000..b62ef1c03 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,53 @@ +#! node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const fs = tslib_1.__importStar(require("fs")); +const path = tslib_1.__importStar(require("path")); +const dotenv = tslib_1.__importStar(require("dotenv")); +const index_1 = require("./bin/entities/Config/index"); +const FigmagicController_1 = require("./bin/controllers/FigmagicController"); +const write_1 = require("./bin/frameworks/filesystem/write"); +const getData_1 = require("./bin/frameworks/network/getData"); +const writeBaseJson_1 = require("./bin/frameworks/filesystem/writeBaseJson"); +const colors_1 = require("./bin/frameworks/system/colors"); +const messages_1 = require("./bin/frameworks/messages/messages"); +const BASE_CONFIG = { + templates: { + templatePathReact: '/node_modules/figmagic/templates/react', + templatePathStorybook: '/node_modules/figmagic/templates/story', + templatePathStyled: '/node_modules/figmagic/templates/styled' + } +}; +const RC_FILE = '.figmagicrc'; +async function main() { + try { + dotenv.config(); + const [, , ...CLI_ARGS] = process.argv; + if (CLI_ARGS[0]?.toLowerCase() === 'init') + initConfig(BASE_CONFIG); + else { + const USER_CONFIG_PATH = path.join(`${process.cwd()}`, RC_FILE); + const CONFIG = await index_1.makeConfiguration(USER_CONFIG_PATH, ...CLI_ARGS); + const { recompileLocal, figmagicFolder, figmaData, token, url } = CONFIG; + const DATA = await getData_1.getData(recompileLocal, figmagicFolder, figmaData, token, url); + if (!recompileLocal) + await writeBaseJson_1.writeBaseJson(figmagicFolder, figmaData, DATA); + await FigmagicController_1.FigmagicController(CONFIG, DATA); + } + } + catch (error) { + console.error(`${colors_1.colors.FgRed}${error}`); + } +} +function initConfig(file) { + const FILE_EXISTS = fs.existsSync(RC_FILE); + if (!FILE_EXISTS) { + write_1.write(RC_FILE, JSON.stringify(file, null, ' ')); + console.log(messages_1.MsgJobCompleteInit); + return; + } + console.log(messages_1.MsgJobCompleteInitStopped); +} +main(); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 000000000..8e046626d --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAEA,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AAEjC,uDAAgE;AAKhE,6EAA0E;AAE1E,6DAA0D;AAC1D,8DAA2D;AAC3D,6EAA0E;AAC1E,2DAAwD;AAExD,iEAAmG;AAEnG,MAAM,WAAW,GAAG;IAClB,SAAS,EAAE;QACT,iBAAiB,EAAE,wCAAwC;QAC3D,qBAAqB,EAAE,wCAAwC;QAC/D,kBAAkB,EAAE,yCAAyC;KAC9D;CACF,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC;AAK9B,KAAK,UAAU,IAAI;IACjB,IAAI;QAEF,MAAM,CAAC,MAAM,EAAE,CAAC;QAEhB,MAAM,CAAC,EAAE,AAAD,EAAG,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;QACvC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,MAAM;YAAE,UAAU,CAAC,WAAW,CAAC,CAAC;aAC9D;YACH,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;YAChE,MAAM,MAAM,GAAW,MAAM,yBAAiB,CAAC,gBAAgB,EAAE,GAAG,QAAQ,CAAC,CAAC;YAG9E,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;YACzE,MAAM,IAAI,GAAc,MAAM,iBAAO,CAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAG7F,IAAI,CAAC,cAAc;gBAAE,MAAM,6BAAa,CAAC,cAAc,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAG1E,MAAM,uCAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACxC;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,GAAG,eAAM,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC,CAAC;KAC1C;AACH,CAAC;AAKD,SAAS,UAAU,CAAC,IAAS;IAC3B,MAAM,WAAW,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,WAAW,EAAE;QAChB,aAAK,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,6BAAkB,CAAC,CAAC;QAChC,OAAO;KACR;IACD,OAAO,CAAC,GAAG,CAAC,oCAAyB,CAAC,CAAC;AACzC,CAAC;AAED,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/index.ts b/index.ts index 777e03531..3f357bc15 100755 --- a/index.ts +++ b/index.ts @@ -1,5 +1,4 @@ -#!/bin/sh -':'; //# ; exec /usr/bin/env node --experimental-modules --no-warnings "$0" "$@" +#! node import * as fs from 'fs'; import * as path from 'path'; diff --git a/package-lock.json b/package-lock.json index fb7de5200..b154b04b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1109,107 +1109,6 @@ "minimist": "^1.2.0" } }, - "@commitlint/execute-rule": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-11.0.0.tgz", - "integrity": "sha512-g01p1g4BmYlZ2+tdotCavrMunnPFPhTzG1ZiLKTCYrooHRbmvqo42ZZn4QMStUEIcn+jfLb6BRZX3JzIwA1ezQ==", - "dev": true, - "optional": true - }, - "@commitlint/load": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-11.0.0.tgz", - "integrity": "sha512-t5ZBrtgvgCwPfxmG811FCp39/o3SJ7L+SNsxFL92OR4WQxPcu6c8taD0CG2lzOHGuRyuMxZ7ps3EbngT2WpiCg==", - "dev": true, - "optional": true, - "requires": { - "@commitlint/execute-rule": "^11.0.0", - "@commitlint/resolve-extends": "^11.0.0", - "@commitlint/types": "^11.0.0", - "chalk": "4.1.0", - "cosmiconfig": "^7.0.0", - "lodash": "^4.17.19", - "resolve-from": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "optional": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@commitlint/resolve-extends": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-11.0.0.tgz", - "integrity": "sha512-WinU6Uv6L7HDGLqn/To13KM1CWvZ09VHZqryqxXa1OY+EvJkfU734CwnOEeNlSCK7FVLrB4kmodLJtL1dkEpXw==", - "dev": true, - "optional": true, - "requires": { - "import-fresh": "^3.0.0", - "lodash": "^4.17.19", - "resolve-from": "^5.0.0", - "resolve-global": "^1.0.0" - } - }, - "@commitlint/types": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-11.0.0.tgz", - "integrity": "sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ==", - "dev": true, - "optional": true - }, "@eslint/eslintrc": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz", @@ -2848,6 +2747,12 @@ "string-width": "^3.0.0" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -2858,6 +2763,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -3048,28 +2962,6 @@ "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==", "dev": true }, - "babel-eslint": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", - "integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.0", - "@babel/traverse": "^7.7.0", - "@babel/types": "^7.7.0", - "eslint-visitor-keys": "^1.0.0", - "resolve": "^1.12.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, "babel-jest": { "version": "26.3.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-26.3.0.tgz", @@ -3417,15 +3309,6 @@ "strip-ansi": "^6.0.0" } }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -3571,12 +3454,6 @@ } } }, - "cachedir": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.2.0.tgz", - "integrity": "sha512-VvxA0xhNqIIfg0V9AmJkDg91DaJwryutH5rVEZAhcNi4iJFj9f+QxmAjgK1LT9I8OgToX27fypX6/MeCXVbBjQ==", - "dev": true - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3679,27 +3556,12 @@ "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, "cli-spinner": { "version": "0.2.10", "resolved": "https://registry.npmjs.org/cli-spinner/-/cli-spinner-0.2.10.tgz", "integrity": "sha512-U0sSQ+JJvSLi1pAYuJykwiA8Dsr15uHEy85iCJ6A+0DjVxivr3d+N2Wjvodeg89uP5K6TswFkKBfAD7B3YSn/Q==", "dev": true }, - "cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, "cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -3818,59 +3680,6 @@ "integrity": "sha1-0SG7roYNmZKj1Re6lvVliOR8Z4E=", "dev": true }, - "commitizen": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-4.2.1.tgz", - "integrity": "sha512-nZsp8IThkDu7C+93BFD/mLShb9Gd6Wsaf90tpKE3x/6u5y/Q52kzanIJpGr0qvIsJ5bCMpgKtr3Lbu3miEJfaA==", - "dev": true, - "requires": { - "cachedir": "2.2.0", - "cz-conventional-changelog": "3.2.0", - "dedent": "0.7.0", - "detect-indent": "6.0.0", - "find-node-modules": "2.0.0", - "find-root": "1.1.0", - "fs-extra": "8.1.0", - "glob": "7.1.4", - "inquirer": "6.5.2", - "is-utf8": "^0.2.1", - "lodash": "^4.17.20", - "minimist": "1.2.5", - "strip-bom": "4.0.0", - "strip-json-comments": "3.0.1" - }, - "dependencies": { - "cz-conventional-changelog": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.2.0.tgz", - "integrity": "sha512-yAYxeGpVi27hqIilG1nh4A9Bnx4J3Ov+eXy4koL3drrR+IO9GaWPsKjik20ht608Asqi8TQPf0mczhEeyAtMzg==", - "dev": true, - "requires": { - "@commitlint/load": ">6.1.1", - "chalk": "^2.4.1", - "commitizen": "^4.0.3", - "conventional-commit-types": "^3.0.0", - "lodash.map": "^4.5.1", - "longest": "^2.0.1", - "word-wrap": "^1.0.3" - } - }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, "compare-versions": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", @@ -3910,12 +3719,6 @@ } } }, - "conventional-commit-types": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/conventional-commit-types/-/conventional-commit-types-3.0.0.tgz", - "integrity": "sha512-SmmCYnOniSsAa9GqWOeLqc179lfr5TRu5b4QFDkbsrJ5TZjPJx85wtOr3zn+1dbeNiXDKGPbZ72IKbPhLXh/Lg==", - "dev": true - }, "convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", @@ -4083,21 +3886,6 @@ } } }, - "cz-conventional-changelog": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.3.0.tgz", - "integrity": "sha512-U466fIzU5U22eES5lTNiNbZ+d8dfcHcssH4o7QsdWaCcRs/feIPCxKYSWkYBNs5mny7MvEfwpTLWjvbm94hecw==", - "dev": true, - "requires": { - "@commitlint/load": ">6.1.1", - "chalk": "^2.4.1", - "commitizen": "^4.0.3", - "conventional-commit-types": "^3.0.0", - "lodash.map": "^4.5.1", - "longest": "^2.0.1", - "word-wrap": "^1.0.3" - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -4168,12 +3956,6 @@ } } }, - "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", - "dev": true - }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -4279,18 +4061,6 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "dev": true }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", - "dev": true - }, - "detect-indent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz", - "integrity": "sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==", - "dev": true - }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -4619,9 +4389,9 @@ } }, "eslint": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz", - "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz", + "integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -4632,7 +4402,7 @@ "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", - "eslint-scope": "^5.1.0", + "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^1.3.0", "espree": "^7.3.0", @@ -4731,15 +4501,6 @@ "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -4758,9 +4519,9 @@ } }, "eslint-config-prettier": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", - "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz", + "integrity": "sha512-9jWPlFlgNwRUYVoujvWTQ1aMO8o6648r+K7qU7K5Jmkbyqav1fuEZC0COYpGBxyiAJb65Ra9hrmFx19xRGwXWw==", "dev": true, "requires": { "get-stdin": "^6.0.0" @@ -4962,15 +4723,6 @@ } } }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, "expect": { "version": "26.4.2", "resolved": "https://registry.npmjs.org/expect/-/expect-26.4.2.tgz", @@ -5230,15 +4982,6 @@ "bser": "2.1.1" } }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", @@ -5263,28 +5006,12 @@ "to-regex-range": "^5.0.1" } }, - "find-node-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.0.0.tgz", - "integrity": "sha512-8MWIBRgJi/WpjjfVXumjPKCtmQ10B+fjx6zmSA+770GMJirLhWIzg8l763rhjl9xaeaHbnxPNRQKq2mgMhr+aw==", - "dev": true, - "requires": { - "findup-sync": "^3.0.0", - "merge": "^1.2.1" - } - }, "find-parent-dir": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", "dev": true }, - "find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", - "dev": true - }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -5322,123 +5049,6 @@ "commander": "~2.1.0" } }, - "findup-sync": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", - "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - }, - "dependencies": { - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } - }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -5494,17 +5104,6 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -5660,40 +5259,6 @@ "is-glob": "^4.0.1" } }, - "global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", - "dev": true, - "optional": true, - "requires": { - "ini": "^1.3.4" - } - }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - } - }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -5862,15 +5427,6 @@ "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "dev": true }, - "homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" - } - }, "hosted-git-info": { "version": "2.8.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", @@ -6153,27 +5709,6 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, - "inquirer": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", - "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", - "dev": true, - "requires": { - "ansi-escapes": "^3.2.0", - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^2.1.0", - "strip-ansi": "^5.1.0", - "through": "^2.3.6" - } - }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -6439,12 +5974,6 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -8905,15 +8434,6 @@ "minimist": "^1.2.5" } }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -9106,12 +8626,6 @@ "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", "dev": true }, - "lodash.map": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", - "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=", - "dev": true - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -9148,12 +8662,6 @@ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", "dev": true }, - "longest": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-2.0.1.tgz", - "integrity": "sha1-eB4YMpaqlPbU2RbcM10NF676I/g=", - "dev": true - }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -9222,12 +8730,6 @@ "object-visit": "^1.0.0" } }, - "merge": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", - "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", - "dev": true - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -9265,12 +8767,6 @@ "mime-db": "1.44.0" } }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -9386,12 +8882,6 @@ } } }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -9767,15 +9257,6 @@ "wrappy": "1" } }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, "open": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/open/-/open-7.2.1.tgz", @@ -10081,12 +9562,6 @@ "xtend": "~4.0.1" } }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", - "dev": true - }, "parse5": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", @@ -10882,32 +10357,12 @@ "resolve-from": "^5.0.0" } }, - "resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - } - }, "resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, - "resolve-global": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", - "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", - "dev": true, - "optional": true, - "requires": { - "global-dirs": "^0.1.1" - } - }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -10923,16 +10378,6 @@ "lowercase-keys": "^2.0.0" } }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -11473,9 +10918,9 @@ } }, "snyk": { - "version": "1.399.1", - "resolved": "https://registry.npmjs.org/snyk/-/snyk-1.399.1.tgz", - "integrity": "sha512-9FCUPi+jfVlqNc1MrhpuPgCc5aIGCiIponBsn64zrPzd4joMvi7pfKgRqffoeaXrqhAsxWQ8YIp0QBfYxbZL/g==", + "version": "1.401.0", + "resolved": "https://registry.npmjs.org/snyk/-/snyk-1.401.0.tgz", + "integrity": "sha512-8D9M1JcCegAKcsUmyn/9uXTIJwEEofYMSLpY86yDKWdk1ZvgSjM264GHWlJf0B29TtGPKqWbqSm8aGUdvJQAWA==", "dev": true, "requires": { "@snyk/cli-interface": "2.9.2", @@ -11500,8 +10945,8 @@ "proxy-from-env": "^1.0.0", "semver": "^6.0.0", "snyk-config": "3.1.1", - "snyk-cpp-plugin": "1.5.0", - "snyk-docker-plugin": "3.21.0", + "snyk-cpp-plugin": "2.0.0", + "snyk-docker-plugin": "3.23.0", "snyk-go-plugin": "1.16.2", "snyk-gradle-plugin": "3.6.3", "snyk-module": "3.1.0", @@ -11695,6 +11140,23 @@ } } }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -11784,9 +11246,9 @@ } }, "snyk-cpp-plugin": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/snyk-cpp-plugin/-/snyk-cpp-plugin-1.5.0.tgz", - "integrity": "sha512-nBZ0cBmpT4RVJUFzYydQJOxwjcdXk7NtRJE1UIIOafQa2FcvIl3GBezfrCJ6pu61svOAf5r8Qi/likx6F15K1A==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/snyk-cpp-plugin/-/snyk-cpp-plugin-2.0.0.tgz", + "integrity": "sha512-/xcDy8H5wxhk+4E9e8zDDGfcNo5g+zpwy585sCDkH5KpHdZHmguPi0GmZ9ZCBTuGIodeTIqsDqkBiA1WXSH7+w==", "dev": true, "requires": { "@snyk/dep-graph": "^1.19.3", @@ -11854,9 +11316,9 @@ } }, "snyk-docker-plugin": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/snyk-docker-plugin/-/snyk-docker-plugin-3.21.0.tgz", - "integrity": "sha512-A7oJS3QGR7bwm1qeeczCb8PDfi8go1KM6VWph/drJHBQ7JxVKKLb3j4AzrMmIM96mGZFbmyNOL4pznwumaOM8g==", + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/snyk-docker-plugin/-/snyk-docker-plugin-3.23.0.tgz", + "integrity": "sha512-krMQ7hw+7j+DFJnSPMfPHry2BN8nZDtK8hI8PJf6U82C1s+nVARD8pD/PFhisBQUGLBqX8nNSI9FSWNP/seMaA==", "dev": true, "requires": { "@snyk/rpm-parser": "^2.0.0", @@ -11868,7 +11330,7 @@ "gunzip-maybe": "^1.4.2", "mkdirp": "^1.0.4", "semver": "^6.1.0", - "snyk-nodejs-lockfile-parser": "1.28.1", + "snyk-nodejs-lockfile-parser": "1.29.0", "tar-stream": "^2.1.0", "tmp": "^0.2.1", "tslib": "^1", @@ -11881,6 +11343,12 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -11890,6 +11358,29 @@ "glob": "^7.1.3" } }, + "snyk-nodejs-lockfile-parser": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/snyk-nodejs-lockfile-parser/-/snyk-nodejs-lockfile-parser-1.29.0.tgz", + "integrity": "sha512-pQL5fe0lypifou0QAvirTsj0Ez7zHjwBUUq9U5ManMfPqFt89nwIK/5/xW0o3OiFM56Iu3uLUQXM/BhYqBokzQ==", + "dev": true, + "requires": { + "@yarnpkg/lockfile": "^1.1.0", + "event-loop-spinner": "^2.0.0", + "got": "11.4.0", + "graphlib": "2.1.8", + "lodash.clonedeep": "^4.5.0", + "lodash.flatmap": "^4.5.0", + "lodash.isempty": "^4.4.0", + "lodash.set": "^4.3.2", + "lodash.topairs": "^4.3.0", + "p-map": "2.1.0", + "snyk-config": "^3.0.0", + "source-map-support": "^0.5.7", + "tslib": "^1.9.3", + "uuid": "^8.3.0", + "yaml": "^1.9.2" + } + }, "tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -12673,33 +12164,6 @@ } } }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, "string.prototype.trimend": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", @@ -12769,20 +12233,12 @@ "dev": true }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - } + "ansi-regex": "^5.0.0" } }, "strip-bom": { @@ -12802,12 +12258,6 @@ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true }, - "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", - "dev": true - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -12862,6 +12312,12 @@ "string-width": "^3.0.0" }, "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -12872,6 +12328,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } } } }, @@ -13297,12 +12762,6 @@ "crypto-random-string": "^2.0.0" } }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -13665,15 +13124,6 @@ "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } } } }, diff --git a/package.json b/package.json index e082e9ff9..c3ba27517 100644 --- a/package.json +++ b/package.json @@ -41,26 +41,20 @@ "license": "MIT", "devDependencies": { "@babel/core": "^7.11.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-modules-commonjs": "^7.10.4", "@babel/preset-env": "^7.11.5", "@babel/preset-typescript": "^7.10.4", "@types/jest": "^26.0.14", "@types/node-fetch": "^2.5.7", "@typescript-eslint/eslint-plugin": "^4.2.0", "@typescript-eslint/parser": "^4.2.0", - "babel-eslint": "^10.1.0", - "babel-plugin-dynamic-import-node": "^2.3.3", - "commitizen": "^4.2.1", - "cz-conventional-changelog": "^3.3.0", - "eslint": "^7.9.0", - "eslint-config-prettier": "^6.11.0", + "eslint": "^7.10.0", + "eslint-config-prettier": "^6.12.0", "eslint-plugin-prettier": "^3.1.4", "husky": "^4.3.0", "jest": "^26.4.2", "prettier": "^2.1.2", "pretty-quick": "^3.0.2", - "snyk": "^1.399.1", + "snyk": "^1.401.0", "ts-jest": "^26.4.0", "typescript": "^4.0.3", "validate-commit-msg": "^2.14.0" @@ -73,8 +67,6 @@ "bin": { "figmagic": "dist/index.js" }, - "main": "dist/index.js", - "source": "index.ts", "scripts": { "figmagic": "node dist/index.js", "build": "rm -rf dist && tsc", @@ -83,28 +75,5 @@ "snyk-protect": "snyk protect", "prepare": "npm run snyk-protect" }, - "config": { - "commitizen": { - "path": "cz-conventional-changelog" - }, - "validate-commit-msg": { - "types": [ - "feat", - "fix", - "docs", - "style", - "refactor", - "perf", - "test", - "chore", - "revert" - ], - "warnOnFail": false, - "maxSubjectLength": 100, - "subjectPattern": "^[A-Z]+-[0-9]+ - .*", - "subjectPatternErrorMsg": "Subject must be in format 'CMS-123 - Commit message'", - "helpMessage": "" - } - }, "snyk": true } diff --git a/tsconfig.json b/tsconfig.json index 05fd0e29d..796668913 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "importHelpers": true, - "lib": ["esnext", "dom"], + "lib": ["esnext"], "module": "commonjs", "moduleResolution": "node", "noEmit": false,