Skip to content

Commit 723e44d

Browse files
fix missing deps (#464)
fix missing deps
2 parents 566575a + 13c9e18 commit 723e44d

File tree

7 files changed

+36
-30
lines changed

7 files changed

+36
-30
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"react/default-props-match-prop-types": 0,
2525
"jsx-a11y/label-has-for": 0,
2626
"no-mixed-operators": 0,
27-
"import/no-cycle": 0
27+
"import/no-cycle": 0,
28+
"import/extensions": 0
2829
},
2930
"env": {
3031
"node": true,

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This project adheres to [Semantic Versioning](http://semver.org/). Every release, along with the migration instructions, is documented on the Github [Releases](https://github.com/airbnb/react-sketchapp/releases) page.
44

5+
## Version 3.0.5
6+
7+
- Fix missing dependency (#462)
8+
59
## Version 3.0.4
610

711
- Fix rendering images (#458)

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-sketchapp",
3-
"version": "3.0.4",
3+
"version": "3.0.5",
44
"description": "A React renderer for Sketch.app",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -42,6 +42,7 @@
4242
},
4343
"dependencies": {
4444
"@lona/svg-model": "^1.0.1",
45+
"@sketch-hq/sketch-file-format-ts": "^4.0.0",
4546
"airbnb-prop-types": "^2.15.0",
4647
"error-stack-parser": "^2.0.4",
4748
"invariant": "^2.2.2",
@@ -85,8 +86,6 @@
8586
]
8687
},
8788
"devDependencies": {
88-
"@sketch-hq/sketch-file-format": "^3.2.0",
89-
"@sketch-hq/sketch-file-format-ts": "^3.0.0",
9089
"@skpm/babel-preset": "^0.2.1",
9190
"@skpm/test-runner": "^0.4.1",
9291
"@types/airbnb-prop-types": "^2.13.1",
@@ -97,34 +96,35 @@
9796
"@types/react": "^16.9.11",
9897
"@types/react-test-renderer": "^16.9.1",
9998
"@types/seedrandom": "^2.4.28",
100-
"@typescript-eslint/eslint-plugin": "^2.7.0",
101-
"@typescript-eslint/parser": "^2.7.0",
102-
"eslint": "^6.6.0",
99+
"@typescript-eslint/eslint-plugin": "^2.11.0",
100+
"@typescript-eslint/parser": "^2.11.0",
101+
"eslint": "^6.7.2",
103102
"eslint-config-airbnb": "^18.0.1",
104-
"eslint-config-prettier": "^6.6.0",
103+
"eslint-config-prettier": "^6.7.0",
105104
"eslint-config-sketch": "^0.2.4",
106-
"eslint-plugin-import": "^2.18.2",
105+
"eslint-plugin-import": "^2.19.1",
107106
"eslint-plugin-jsx-a11y": "^6.2.3",
108107
"eslint-plugin-prettier": "^3.1.1",
109-
"eslint-plugin-react": "^7.16.0",
108+
"eslint-plugin-react": "^7.17.0",
110109
"eslint-plugin-react-hooks": "^1.7.0",
111110
"gitbook-cli": "^2.3.0",
112111
"gitbook-plugin-anchorjs": "^2.1.0",
113112
"gitbook-plugin-codeblock-disable-glossary": "0.0.1",
114113
"gitbook-plugin-edit-link": "^2.0.2",
115114
"gitbook-plugin-github": "^2.0.0",
116115
"gitbook-plugin-prism": "^2.3.0",
116+
"jest": "^24.9.0",
117117
"jest-cli": "^24.9.0",
118-
"lint-staged": "^9.4.3",
118+
"lint-staged": "^9.5.0",
119119
"npm-run-all": "^4.1.5",
120120
"pre-commit": "^1.2.2",
121121
"prettier": "^1.19.1",
122122
"react": "^16.12.0",
123123
"react-test-renderer": "^16.12.0",
124124
"sketchapp-json-flow-types": "^0.3.6",
125125
"trash-cli": "^3.0.0",
126-
"ts-jest": "^24.1.0",
127-
"typescript": "^3.7.2"
126+
"ts-jest": "^24.2.0",
127+
"typescript": "^3.7.3"
128128
},
129129
"skpm": {
130130
"test": {

src/jsonUtils/models.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ export const makeColorFill = (cssColor: Color): FileFormat.Fill => ({
139139
});
140140

141141
export const makeImageFill = (
142-
image: FileFormat.ImageFileRef,
142+
image: FileFormat.ImageDataRef,
143143
patternFillType: FileFormat.PatternFillType = FileFormat.PatternFillType.Fill,
144144
): FileFormat.Fill => ({
145145
_class: 'fill',
146146
isEnabled: true,
147-
fillType: 4, // FileFormat.FillType.Pattern,
148-
// @ts-ignore
147+
fillType: FileFormat.FillType.Pattern,
148+
color: makeColorFromCSS('white'),
149149
image,
150150
noiseIndex: 0,
151151
noiseIntensity: 0,
@@ -172,7 +172,6 @@ export const makeRect = (x: number, y: number, width: number, height: number): F
172172
export const makeJSONDataReference = (image: {
173173
data: string;
174174
sha1: string;
175-
// @ts-ignore
176175
}): FileFormat.ImageDataRef => ({
177176
_class: 'MSJSONOriginalDataReference',
178177
_ref: `images/${generateID()}`,
@@ -189,11 +188,12 @@ export const makeJSONDataReference = (image: {
189188
export const makeOverride = (
190189
path: string,
191190
type: 'symbolID' | 'stringValue' | 'layerStyle' | 'textStyle' | 'flowDestination' | 'image',
192-
value: string | FileFormat.ImageFileRef,
191+
value: string | FileFormat.ImageDataRef,
193192
): FileFormat.OverrideValue => ({
194193
_class: 'overrideValue',
195194
do_objectID: generateID(),
196195
overrideName: `${path}_${type}`,
196+
// @ts-ignore https://github.com/sketch-hq/sketch-file-format-ts/issues/9
197197
value,
198198
});
199199

src/jsonUtils/style.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ export const makeShadow = (
6464
: 'textShadowRadius' in style && style.textShadowRadius !== undefined
6565
? style.textShadowRadius
6666
: 1;
67-
const _class: 'innerShadow' | 'shadow' =
68-
style.shadowInner !== undefined ? 'innerShadow' : 'shadow';
6967
const spread =
7068
style.shadowSpread !== undefined
7169
? style.shadowSpread
@@ -76,7 +74,6 @@ export const makeShadow = (
7674
style.shadowOffset || ('textShadowOffset' in style && style.textShadowOffset) || {};
7775

7876
const commonProps = {
79-
_class,
8077
isEnabled: true,
8178
blurRadius: radius,
8279
color: makeColorFromCSS(color, opacity),
@@ -88,11 +85,17 @@ export const makeShadow = (
8885
offsetX,
8986
offsetY,
9087
spread,
91-
};
88+
} as const;
89+
90+
if (style.shadowInner) {
91+
return {
92+
_class: 'innerShadow',
93+
...commonProps,
94+
};
95+
}
9296

9397
return {
94-
// @ts-ignore
95-
_class,
98+
_class: 'shadow',
9699
...commonProps,
97100
};
98101
};
@@ -146,19 +149,19 @@ export const makeStyle = (
146149
if (hasAnyDefined(style, SHADOW_STYLES)) {
147150
const shadow = [makeShadow(style)];
148151
if (style.shadowInner) {
149-
json.innerShadows = shadow;
152+
json.innerShadows = shadow as FileFormat.InnerShadow[];
150153
} else {
151-
json.shadows = shadow;
154+
json.shadows = shadow as FileFormat.Shadow[];
152155
}
153156
}
154157

155158
if (shadowsProp) {
156159
shadowsProp.map(shadowStyle => {
157160
const shadow = makeShadow(shadowStyle);
158161
if (shadowStyle.shadowInner) {
159-
json.innerShadows.push(shadow);
162+
json.innerShadows.push(shadow as FileFormat.InnerShadow);
160163
} else {
161-
json.shadows.push(shadow);
164+
json.shadows.push(shadow as FileFormat.Shadow);
162165
}
163166
return shadowStyle;
164167
});

src/renderers/SymbolInstanceRenderer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const findInGroup = (layer: FileFormat.AnyGroup, type: string): FileFormat.AnyLa
2121
layer && layer.layers && layer.layers.find(l => l._class === type);
2222

2323
const hasImageFill = (layer: FileFormat.AnyLayer): boolean =>
24-
// @ts-ignore
2524
!!(layer.style && layer.style.fills && layer.style.fills.some(f => f.image));
2625

2726
const removeDuplicateOverrides = (overrides: Array<Override>): Array<Override> => {

src/renderers/TextRenderer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export default class TextRenderer extends SketchRenderer {
3636
if (!layer.style) {
3737
layer.style = resolvedTextStyle.sketchStyle;
3838
}
39-
// @ts-ignore
4039
layer.sharedStyleID = resolvedTextStyle.sharedObjectID;
4140
}
4241

0 commit comments

Comments
 (0)