diff --git a/package.json b/package.json index 3bb25c7..a89d517 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,12 @@ "watch": "webpack watch", "lint": "run-p lint:*", "lint:eslint": "eslint .", - "lint:stylelint": "stylelint src/**.css", + "lint:stylelint": "stylelint src/ui/**.css", "lint:prettier": "prettier --check .", "lint:tsc": "tsc --noEmit --pretty false", "fix-lint": "run-p fix-lint:*", "fix-lint:eslint": "eslint . --fix", - "fix-lint:stylelint": "stylelint src/**.css --fix", + "fix-lint:stylelint": "stylelint src/ui/**.css --fix", "fix-lint:prettier": "prettier --write ." }, "author": "Kaleidos", diff --git a/src/interfaces.ts b/src/common/interfaces.ts similarity index 100% rename from src/interfaces.ts rename to src/common/interfaces.ts diff --git a/src/code.ts b/src/plugin/code.ts similarity index 98% rename from src/code.ts rename to src/plugin/code.ts index 6f1a915..0796bd6 100644 --- a/src/code.ts +++ b/src/plugin/code.ts @@ -1,4 +1,4 @@ -import { NodeData, TextData } from './interfaces'; +import { NodeData, TextData } from '../common/interfaces'; interface Signatures { [key: string]: string; diff --git a/src/converters/createPenpotBoard.ts b/src/ui/converters/createPenpotBoard.ts similarity index 91% rename from src/converters/createPenpotBoard.ts rename to src/ui/converters/createPenpotBoard.ts index 4bec289..61ba476 100644 --- a/src/converters/createPenpotBoard.ts +++ b/src/ui/converters/createPenpotBoard.ts @@ -1,5 +1,5 @@ import { createPenpotItem } from '.'; -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; import { translateFills } from '../translators'; diff --git a/src/converters/createPenpotCircle.ts b/src/ui/converters/createPenpotCircle.ts similarity index 88% rename from src/converters/createPenpotCircle.ts rename to src/ui/converters/createPenpotCircle.ts index d68899a..e25ac0a 100644 --- a/src/converters/createPenpotCircle.ts +++ b/src/ui/converters/createPenpotCircle.ts @@ -1,4 +1,4 @@ -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; import { translateFills } from '../translators'; diff --git a/src/converters/createPenpotFile.ts b/src/ui/converters/createPenpotFile.ts similarity index 83% rename from src/converters/createPenpotFile.ts rename to src/ui/converters/createPenpotFile.ts index 1e1bbdc..faa575c 100644 --- a/src/converters/createPenpotFile.ts +++ b/src/ui/converters/createPenpotFile.ts @@ -1,5 +1,5 @@ import { createPenpotItem } from '.'; -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { createFile } from '../penpot'; export const createPenpotFile = (node: NodeData) => { diff --git a/src/converters/createPenpotGroup.ts b/src/ui/converters/createPenpotGroup.ts similarity index 86% rename from src/converters/createPenpotGroup.ts rename to src/ui/converters/createPenpotGroup.ts index ac41579..783fc47 100644 --- a/src/converters/createPenpotGroup.ts +++ b/src/ui/converters/createPenpotGroup.ts @@ -1,5 +1,5 @@ import { createPenpotItem } from '.'; -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; export const createPenpotGroup = ( diff --git a/src/converters/createPenpotImage.ts b/src/ui/converters/createPenpotImage.ts similarity index 88% rename from src/converters/createPenpotImage.ts rename to src/ui/converters/createPenpotImage.ts index d015df1..0e2be85 100644 --- a/src/converters/createPenpotImage.ts +++ b/src/ui/converters/createPenpotImage.ts @@ -1,4 +1,4 @@ -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; export const createPenpotImage = ( diff --git a/src/converters/createPenpotItem.ts b/src/ui/converters/createPenpotItem.ts similarity index 96% rename from src/converters/createPenpotItem.ts rename to src/ui/converters/createPenpotItem.ts index d7cd75b..7eceb47 100644 --- a/src/converters/createPenpotItem.ts +++ b/src/ui/converters/createPenpotItem.ts @@ -7,7 +7,7 @@ import { createPenpotRectangle, createPenpotText } from '.'; -import { NodeData, TextData } from '../interfaces'; +import { NodeData, TextData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; import { calculateAdjustment } from '../utils'; diff --git a/src/converters/createPenpotPage.ts b/src/ui/converters/createPenpotPage.ts similarity index 84% rename from src/converters/createPenpotPage.ts rename to src/ui/converters/createPenpotPage.ts index 4f324c2..4f886a6 100644 --- a/src/converters/createPenpotPage.ts +++ b/src/ui/converters/createPenpotPage.ts @@ -1,5 +1,5 @@ import { createPenpotItem } from '.'; -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; export const createPenpotPage = (file: PenpotFile, node: NodeData) => { diff --git a/src/converters/createPenpotRectangle.ts b/src/ui/converters/createPenpotRectangle.ts similarity index 88% rename from src/converters/createPenpotRectangle.ts rename to src/ui/converters/createPenpotRectangle.ts index 56b9f64..36e5c30 100644 --- a/src/converters/createPenpotRectangle.ts +++ b/src/ui/converters/createPenpotRectangle.ts @@ -1,4 +1,4 @@ -import { NodeData } from '../interfaces'; +import { NodeData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; import { translateFills } from '../translators'; diff --git a/src/converters/createPenpotText.ts b/src/ui/converters/createPenpotText.ts similarity index 97% rename from src/converters/createPenpotText.ts rename to src/ui/converters/createPenpotText.ts index 4504636..fdc264a 100644 --- a/src/converters/createPenpotText.ts +++ b/src/ui/converters/createPenpotText.ts @@ -1,6 +1,6 @@ import slugify from 'slugify'; -import { TextData } from '../interfaces'; +import { TextData } from '../../common/interfaces'; import { PenpotFile } from '../penpot'; import { translateFills, diff --git a/src/converters/index.ts b/src/ui/converters/index.ts similarity index 100% rename from src/converters/index.ts rename to src/ui/converters/index.ts diff --git a/src/gfonts.json b/src/ui/gfonts.json similarity index 100% rename from src/gfonts.json rename to src/ui/gfonts.json diff --git a/src/logo.svg b/src/ui/logo.svg similarity index 100% rename from src/logo.svg rename to src/ui/logo.svg diff --git a/src/penpot.d.ts b/src/ui/penpot.d.ts similarity index 100% rename from src/penpot.d.ts rename to src/ui/penpot.d.ts diff --git a/src/penpot.js b/src/ui/penpot.js similarity index 100% rename from src/penpot.js rename to src/ui/penpot.js diff --git a/src/translators/index.ts b/src/ui/translators/index.ts similarity index 100% rename from src/translators/index.ts rename to src/ui/translators/index.ts diff --git a/src/translators/translateFills.ts b/src/ui/translators/translateFills.ts similarity index 100% rename from src/translators/translateFills.ts rename to src/ui/translators/translateFills.ts diff --git a/src/translators/translateFontStyle.ts b/src/ui/translators/translateFontStyle.ts similarity index 100% rename from src/translators/translateFontStyle.ts rename to src/ui/translators/translateFontStyle.ts diff --git a/src/translators/translateGradientLinearFill.ts b/src/ui/translators/translateGradientLinearFill.ts similarity index 100% rename from src/translators/translateGradientLinearFill.ts rename to src/ui/translators/translateGradientLinearFill.ts diff --git a/src/translators/translateHorizontalAlign.ts b/src/ui/translators/translateHorizontalAlign.ts similarity index 100% rename from src/translators/translateHorizontalAlign.ts rename to src/ui/translators/translateHorizontalAlign.ts diff --git a/src/translators/translateSolidFill.ts b/src/ui/translators/translateSolidFill.ts similarity index 100% rename from src/translators/translateSolidFill.ts rename to src/ui/translators/translateSolidFill.ts diff --git a/src/translators/translateTextDecoration.ts b/src/ui/translators/translateTextDecoration.ts similarity index 80% rename from src/translators/translateTextDecoration.ts rename to src/ui/translators/translateTextDecoration.ts index e95afb2..97129f5 100644 --- a/src/translators/translateTextDecoration.ts +++ b/src/ui/translators/translateTextDecoration.ts @@ -1,4 +1,4 @@ -import { TextData, TextDataChildren } from '../interfaces.js'; +import { TextData, TextDataChildren } from '../../common/interfaces'; export const translateTextDecoration = (node: TextData | TextDataChildren) => { const textDecoration = node.textDecoration; diff --git a/src/translators/translateTextTransform.ts b/src/ui/translators/translateTextTransform.ts similarity index 81% rename from src/translators/translateTextTransform.ts rename to src/ui/translators/translateTextTransform.ts index 1861683..5967e3f 100644 --- a/src/translators/translateTextTransform.ts +++ b/src/ui/translators/translateTextTransform.ts @@ -1,4 +1,4 @@ -import { TextData, TextDataChildren } from '../interfaces.js'; +import { TextData, TextDataChildren } from '../../common/interfaces'; export const translateTextTransform = (node: TextData | TextDataChildren) => { const textCase = node.textCase; diff --git a/src/translators/translateVerticalAlign.ts b/src/ui/translators/translateVerticalAlign.ts similarity index 100% rename from src/translators/translateVerticalAlign.ts rename to src/ui/translators/translateVerticalAlign.ts diff --git a/src/ui.css b/src/ui/ui.css similarity index 100% rename from src/ui.css rename to src/ui/ui.css diff --git a/src/ui.html b/src/ui/ui.html similarity index 100% rename from src/ui.html rename to src/ui/ui.html diff --git a/src/ui.tsx b/src/ui/ui.tsx similarity index 100% rename from src/ui.tsx rename to src/ui/ui.tsx diff --git a/src/utils/calculateAdjustment.ts b/src/ui/utils/calculateAdjustment.ts similarity index 88% rename from src/utils/calculateAdjustment.ts rename to src/ui/utils/calculateAdjustment.ts index da4f1c6..4f723f9 100644 --- a/src/utils/calculateAdjustment.ts +++ b/src/ui/utils/calculateAdjustment.ts @@ -1,4 +1,4 @@ -import { NodeData } from '../interfaces.js'; +import { NodeData } from '../../common/interfaces'; export const calculateAdjustment = (node: NodeData) => { // For each child, check whether the X or Y position is less than 0 and less than the diff --git a/src/utils/index.ts b/src/ui/utils/index.ts similarity index 100% rename from src/utils/index.ts rename to src/ui/utils/index.ts diff --git a/src/utils/rgbToHex.ts b/src/ui/utils/rgbToHex.ts similarity index 100% rename from src/utils/rgbToHex.ts rename to src/ui/utils/rgbToHex.ts diff --git a/src/validators/index.ts b/src/ui/validators/index.ts similarity index 100% rename from src/validators/index.ts rename to src/ui/validators/index.ts diff --git a/src/validators/validateFont.ts b/src/ui/validators/validateFont.ts similarity index 100% rename from src/validators/validateFont.ts rename to src/ui/validators/validateFont.ts diff --git a/tsconfig.json b/tsconfig.json index 4e0be55..75d4625 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "module": "ESNext", "moduleResolution": "Node10", "strict": true, - "typeRoots": ["src/penpot.d.ts", "node_modules/@figma", "node_modules/@types"], + "typeRoots": ["src/ui/penpot.d.ts", "node_modules/@figma", "node_modules/@types"], "resolveJsonModule": true } } diff --git a/webpack.config.cjs b/webpack.config.cjs index c315875..19d641c 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -12,8 +12,8 @@ module.exports = (env, argv) => ({ devtool: argv.mode === 'production' ? false : 'inline-source-map', entry: { - ui: './src/ui.tsx', // The entry point for your UI code - code: './src/code.ts' // The entry point for your plugin code + ui: './src/ui/ui.tsx', // The entry point for your UI code + code: './src/plugin/code.ts' // The entry point for your plugin code }, module: { @@ -54,7 +54,7 @@ module.exports = (env, argv) => ({ }), new HtmlWebpackPlugin({ inject: 'body', - template: './src/ui.html', + template: './src/ui/ui.html', filename: 'ui.html', chunks: ['ui'] }),