Skip to content

Commit 5064efe

Browse files
committed
test: increase test coverage, use tsconfig paths
1 parent ef27b4b commit 5064efe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+681
-257
lines changed

dist/plugin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/ui.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@
183183
],
184184
"moduleNameMapper": {
185185
"^@config/(.*)$": "<rootDir>/src/config/$1",
186-
"^@src/(.*)$": "<rootDir>/src/$1"
186+
"^@src/(.*)$": "<rootDir>/src/$1",
187+
"^@utils/(.*)$": "<rootDir>/src/utilities/$1"
187188
}
188189
},
189190
"dependencies": {

src/extractor/extractBorders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import extractorInterface from '@typings/extractorInterface'
22
import { borderPropertyInterface } from '@typings/propertyObject'
33
import { StrokeCap, StrokeAlign, PropertyType } from '@typings/valueTypes'
44
import { customTokenNode } from '@typings/tokenNodeTypes'
5-
import roundWithDecimals from '../utilities/roundWithDecimals'
5+
import roundWithDecimals from '@utils/roundWithDecimals'
66
import { tokenTypes } from '@config/tokenTypes'
77
import { filterByPrefix } from './extractUtilities'
88
import { tokenCategoryType } from '@typings/tokenCategory'

src/extractor/extractBreakpoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { breakpointPropertyInterface } from '@typings/propertyObject'
33
import { customTokenNode } from '@typings/tokenNodeTypes'
44
import { UnitTypePixel, PropertyType } from '@typings/valueTypes'
55
import { tokenTypes } from '@config/tokenTypes'
6-
import roundWithDecimals from '../utilities/roundWithDecimals'
6+
import roundWithDecimals from '@utils/roundWithDecimals'
77
import { filterByPrefix } from './extractUtilities'
88
import { tokenCategoryType } from '@typings/tokenCategory'
99
import { tokenExportKeyType } from '@typings/tokenExportKey'

src/extractor/extractColors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { colorPropertyInterface, fillValuesType, gradientValuesType } from '@typ
33
import { PaintStyleObject } from '@typings/styles'
44
import { GradientType, PropertyType } from '@typings/valueTypes'
55
import { tokenTypes } from '@config/tokenTypes'
6-
import { convertPaintToRgba, roundRgba } from '../utilities/convertColor'
7-
import roundWithDecimals from '../utilities/roundWithDecimals'
6+
import { convertPaintToRgba, roundRgba } from '@utils/convertColor'
7+
import roundWithDecimals from '@utils/roundWithDecimals'
88
import { tokenCategoryType } from '@typings/tokenCategory'
99
import { tokenExportKeyType } from '@typings/tokenExportKey'
1010
import config from '@config/config'
@@ -98,7 +98,7 @@ const extractFills = (paint): fillValuesType | gradientValuesType => {
9898
return null
9999
}
100100

101-
const extractColors: extractorInterface = (tokenNodes: PaintStyleObject[], prefixArray: {color: string[], gradient: string[], alias: string[]}): colorPropertyInterface[] => {
101+
const extractColors: extractorInterface = (tokenNodes: PaintStyleObject[], prefixArray: { color: string[], gradient: string[], alias: string[] }): colorPropertyInterface[] => {
102102
// get all paint styles
103103
return tokenNodes
104104
.reduce((previousValue, node) => {

src/extractor/extractEffects.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import extractorInterface from '@typings/extractorInterface'
22
import { effectPropertyInterface } from '@typings/propertyObject'
33
import { EffectType, UnitTypePixel, PropertyType } from '@typings/valueTypes'
44
import { tokenTypes } from '@config/tokenTypes'
5-
import { roundRgba } from '../utilities/convertColor'
5+
import { roundRgba } from '@utils/convertColor'
66
import { tokenCategoryType } from '@typings/tokenCategory'
77
import { tokenExportKeyType } from '@typings/tokenExportKey'
88
import config from '@config/config'
@@ -64,7 +64,7 @@ const extractEffects: extractorInterface = (tokenNodes: EffectStyle[], prefixArr
6464
return tokenNodes
6565
// remove tokens with no grid
6666
.filter(node => node.effects.length > 0)
67-
// build
67+
// build
6868
.map(node => ({
6969
name: `${prefixArray[0]}/${node.name}`,
7070
category: 'effect' as tokenCategoryType,

src/extractor/extractFonts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
FontStretch
1111
} from '@typings/valueTypes'
1212
import { tokenTypes } from '@config/tokenTypes'
13-
import roundWithDecimals from '../utilities/roundWithDecimals'
13+
import roundWithDecimals from '@utils/roundWithDecimals'
1414
import { tokenCategoryType } from '@typings/tokenCategory'
1515
import { tokenExportKeyType } from '@typings/tokenExportKey'
1616
import config from '@config/config'

src/extractor/extractOpacities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { opacityPropertyInterface } from '@typings/propertyObject'
33
import { customTokenNode } from '@typings/tokenNodeTypes'
44
import { PropertyType } from '@typings/valueTypes'
55
import { tokenTypes } from '@config/tokenTypes'
6-
import roundWithDecimals from '../utilities/roundWithDecimals'
6+
import roundWithDecimals from '@utils/roundWithDecimals'
77
import { filterByPrefix } from './extractUtilities'
88
import { tokenExportKeyType } from '@typings/tokenExportKey'
99
import { tokenCategoryType } from '@typings/tokenCategory'

src/extractor/extractRadii.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { radiusPropertyInterface } from '@typings/propertyObject'
33
import { customTokenNode } from '@typings/tokenNodeTypes'
44
import { UnitTypePixel, PropertyType } from '@typings/valueTypes'
55
import { tokenTypes } from '@config/tokenTypes'
6-
import roundWithDecimals from '../utilities/roundWithDecimals'
6+
import roundWithDecimals from '@utils/roundWithDecimals'
77
import { filterByPrefix } from './extractUtilities'
88
import { tokenCategoryType } from '@typings/tokenCategory'
99
import { tokenExportKeyType } from '@typings/tokenExportKey'

src/extractor/extractSizes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { sizePropertyInterface } from '@typings/propertyObject'
33
import { customTokenNode } from '@typings/tokenNodeTypes'
44
import { UnitTypePixel, PropertyType } from '@typings/valueTypes'
55
import { tokenTypes } from '@config/tokenTypes'
6-
import roundWithDecimals from '../utilities/roundWithDecimals'
6+
import roundWithDecimals from '@utils/roundWithDecimals'
77
import { filterByPrefix } from './extractUtilities'
88
import { tokenExportKeyType } from '@typings/tokenExportKey'
99
import { tokenCategoryType } from '@typings/tokenCategory'

src/extractor/extractSpacing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { spacingPropertyInterface } from '@typings/propertyObject'
33
import { customTokenNode } from '@typings/tokenNodeTypes'
44
import { UnitTypePixel, PropertyType } from '@typings/valueTypes'
55
import { tokenTypes } from '@config/tokenTypes'
6-
import roundWithDecimals from '../utilities/roundWithDecimals'
6+
import roundWithDecimals from '@utils/roundWithDecimals'
77
import { filterByPrefix } from './extractUtilities'
88
import { tokenCategoryType } from '@typings/tokenCategory'
99
import { tokenExportKeyType } from '@typings/tokenExportKey'

src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { getSettings, resetSettings, setSettings } from './utilities/settings'
2-
import { getAccessToken, setAccessToken } from './utilities/accessToken'
1+
import { getSettings, resetSettings, setSettings } from '@utils/settings'
2+
import { getAccessToken, setAccessToken } from '@utils/accessToken'
33
import { Settings as UserSettings } from '@typings/settings'
44
import config from '@config/config'
55
import { commands, PluginCommands } from '@config/commands'
6-
import getVersionDifference from './utilities/getVersionDifference'
7-
import getFileId from './utilities/getFileId'
8-
import { PluginMessage } from '../types/pluginEvent'
9-
import { exportRawTokenArray } from './utilities/getTokenJson'
10-
import { stringifyJson } from './utilities/stringifyJson'
6+
import getVersionDifference from '@utils/getVersionDifference'
7+
import getFileId from '@utils/getFileId'
8+
import { PluginMessage } from '@typings/pluginEvent'
9+
import { exportRawTokenArray } from '@utils/getTokenJson'
10+
import { stringifyJson } from '@utils/stringifyJson'
1111

1212
// initiate UI
1313
figma.showUI(__html__, {

src/transformer/originalFormatTransformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
tokenCategoryTypes
44
} from '@typings/propertyObject'
55
import { OriginalFormatTokenInterface } from '@typings/originalFormatProperties'
6-
import { convertRgbaObjectToString } from '../utilities/convertColor'
6+
import { convertRgbaObjectToString } from '@utils/convertColor'
77
import { PropertyType, UnitTypePixel } from '@typings/valueTypes'
88
import config from '@config/config'
99

src/transformer/standardTransformer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { rgbaObjectToHex8 } from '../utilities/convertColor'
1+
import { rgbaObjectToHex8 } from '@utils/convertColor'
22
import { internalTokenInterface } from '@typings/propertyObject'
33
import {
44
StandardTokenInterface,
55
StandardTokenTypes,
66
StandardTokenDataInterface,
77
StandardTokenGroup
88
} from '@typings/standardToken'
9-
import roundWithDecimals from '../utilities/roundWithDecimals'
9+
import roundWithDecimals from '@utils/roundWithDecimals'
1010
import { tokenExtensions } from './tokenExtensions'
1111
import config from '@config/config'
12-
import { changeNotation } from '../utilities/changeNotation'
12+
import { changeNotation } from '@utils/changeNotation'
1313

1414
const lineHeightToDimension = (values: {
1515
lineHeight: { unit: string; value: number };

src/ui/components/FileExportSettings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { FigmaContext, SettingsContext, TokenContext } from "@ui/context";
77
import { css } from "@emotion/css";
88
import { Footer } from "./Footer";
99
import { downloadJson } from "../modules/downloadJson";
10-
import { prepareExport } from "@src/utilities/prepareExport";
10+
import { prepareExport } from "@utils/prepareExport";
1111
import { Settings } from "@typings/settings";
12-
import { stringifyJson } from "@src/utilities/stringifyJson";
12+
import { stringifyJson } from "@utils/stringifyJson";
1313
import { Info } from "@components/Info";
1414
import { Row } from "@components/Row";
1515
import { tokenTypes } from "@config/tokenTypes";

0 commit comments

Comments
 (0)