Skip to content

Commit 72f72e2

Browse files
authored
Upgrade to yoshi 4 (#40)
* Node version and packages upgrade. * Prettier changes. * Remaining linting problems fixed. * We should be using mocha for testing.
1 parent ba30d39 commit 72f72e2

Some content is hidden

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

52 files changed

+901
-877
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.9.1
1+
12

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020
"scripts": {
2121
"start": "yoshi start",
2222
"pretest": "yoshi build",
23-
"test": "yoshi test",
23+
"test": "yoshi test --mocha",
2424
"posttest": "yoshi lint",
2525
"release": "yoshi release"
2626
},
2727
"devDependencies": {
2828
"babel-plugin-transform-runtime": "~6.23.0",
2929
"chai": "~4.1.0",
30-
"mjml": "^4.1.2",
30+
"mjml": "^4.6.3",
3131
"puppeteer": "^1.4.0",
32-
"react": "^16.4.0",
33-
"react-dom": "^16.4.0",
34-
"with-eyes": "^2.0.3",
35-
"yoshi": "^2.1.2"
32+
"react": "^16.13.1",
33+
"react-dom": "^16.13.1",
34+
"with-eyes": "^3.0.1",
35+
"yoshi": "^4.186.0"
3636
},
3737
"peerDependencies": {
3838
"mjml": "^4.1.2",
@@ -55,7 +55,7 @@
5555
]
5656
},
5757
"eslintConfig": {
58-
"extends": "wix/react",
58+
"extends": "yoshi",
5959
"rules": {
6060
"quote-props": 0,
6161
"indent": [

src/extensions/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export {MjmlComment} from './mjml-comment';
2-
export {MjmlConditionalComment} from './mjml-conditional-comment';
3-
export {MjmlYahooStyle} from './mjml-yahoo-style';
4-
export {MjmlTrackingPixel} from './mjml-tracking-pixel';
1+
export { MjmlComment } from './mjml-comment';
2+
export { MjmlConditionalComment } from './mjml-conditional-comment';
3+
export { MjmlYahooStyle } from './mjml-yahoo-style';
4+
export { MjmlTrackingPixel } from './mjml-tracking-pixel';

src/extensions/mjml-comment.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import React, {Component} from 'react';
2-
import {string} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { string } from 'prop-types';
33

4-
import {handleMjmlProps} from '../utils';
4+
import { handleMjmlProps } from '../utils';
55

66
export class MjmlComment extends Component {
7-
87
static propTypes = {
9-
children: string.isRequired
10-
}
8+
children: string.isRequired,
9+
};
1110

1211
render() {
13-
const {children, ...rest} = this.props;
12+
const { children, ...rest } = this.props;
1413
if (children && children.trim().length) {
1514
return React.createElement('mj-raw', {
1615
...handleMjmlProps(rest),
1716
dangerouslySetInnerHTML: {
18-
__html: `<!--${children}-->`
19-
}
17+
__html: `<!--${children}-->`,
18+
},
2019
});
2120
}
2221
return null;
2322
}
24-
2523
}
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import React, {Component} from 'react';
2-
import {string} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { string } from 'prop-types';
33

4-
import {MjmlComment} from './mjml-comment';
4+
import { MjmlComment } from './mjml-comment';
55

66
export class MjmlConditionalComment extends Component {
7-
87
static propTypes = {
98
children: string.isRequired,
10-
condition: string.isRequired
11-
}
9+
condition: string.isRequired,
10+
};
1211

1312
static defaultProps = {
14-
condition: 'if gte mso 9'
15-
}
13+
condition: 'if gte mso 9',
14+
};
1615

1716
render() {
18-
const {children, condition, ...rest} = this.props;
17+
const { children, condition, ...rest } = this.props;
1918
if (children && children.trim().length) {
2019
return (
2120
<MjmlComment {...rest}>
@@ -25,5 +24,4 @@ export class MjmlConditionalComment extends Component {
2524
}
2625
return null;
2726
}
28-
2927
}

src/extensions/mjml-tracking-pixel.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1-
import React, {Component} from 'react';
2-
import {string} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { string } from 'prop-types';
33

4-
import {MjmlRaw} from '../mjml-raw';
4+
import { MjmlRaw } from '../mjml-raw';
55

66
export class MjmlTrackingPixel extends Component {
77
static propTypes = {
8-
src: string.isRequired
9-
}
8+
src: string.isRequired,
9+
};
1010

1111
render() {
12-
const {src} = this.props;
12+
const { src } = this.props;
1313
const trackingPixelStyle = {
1414
display: 'table',
1515
height: '1px!important',
1616
width: '1px!important',
1717
border: '0!important',
1818
margin: '0!important',
19-
padding: '0!important'
19+
padding: '0!important',
2020
};
21-
return <MjmlRaw><img src={src} style={trackingPixelStyle} width={1} height={1} border={0}/></MjmlRaw>;
21+
return (
22+
<MjmlRaw>
23+
{/* eslint-disable-next-line jsx-a11y/alt-text */}
24+
<img
25+
src={src}
26+
style={trackingPixelStyle}
27+
width={1}
28+
height={1}
29+
border={0}
30+
/>
31+
</MjmlRaw>
32+
);
2233
}
2334
}

src/extensions/mjml-yahoo-style.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import React, {Component} from 'react';
2-
import {string} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { string } from 'prop-types';
33

4-
import {MjmlRaw} from '../mjml-raw';
4+
import { MjmlRaw } from '../mjml-raw';
55

66
export class MjmlYahooStyle extends Component {
7-
87
static propTypes = {
9-
children: string.isRequired
10-
}
8+
children: string.isRequired,
9+
};
1110

1211
render() {
13-
const {children, ...rest} = this.props;
12+
const { children, ...rest } = this.props;
1413
if (children && children.trim().length) {
1514
return (
1615
<MjmlRaw {...rest}>
@@ -20,5 +19,4 @@ export class MjmlYahooStyle extends Component {
2019
}
2120
return null;
2221
}
23-
2422
}

src/index.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
import ReactDOMServer from 'react-dom/server';
22
import mjml2html from 'mjml';
33

4-
export {render, renderToMjml};
4+
export { render, renderToMjml };
55

6-
export {Mjml} from './mjml';
7-
export {MjmlAccordion} from './mjml-accordion';
8-
export {MjmlAccordionElement} from './mjml-accordion-element';
9-
export {MjmlAccordionText} from './mjml-accordion-text';
10-
export {MjmlAccordionTitle} from './mjml-accordion-title';
11-
export {MjmlAll} from './mjml-all';
12-
export {MjmlAttributes} from './mjml-attributes';
13-
export {MjmlBody} from './mjml-body';
14-
export {MjmlBreakpoint} from './mjml-breakpoint';
15-
export {MjmlButton} from './mjml-button';
16-
export {MjmlCarousel} from './mjml-carousel';
17-
export {MjmlCarouselImage} from './mjml-carousel-image';
18-
export {MjmlClass} from './mjml-class';
19-
export {MjmlColumn} from './mjml-column';
20-
export {MjmlDivider} from './mjml-divider';
21-
export {MjmlFont} from './mjml-font';
22-
export {MjmlGroup} from './mjml-group';
23-
export {MjmlHead} from './mjml-head';
24-
export {MjmlHero} from './mjml-hero';
25-
export {MjmlImage} from './mjml-image';
26-
export {MjmlNavbar} from './mjml-navbar';
27-
export {MjmlNavbarLink} from './mjml-navbar-link';
28-
export {MjmlPreview} from './mjml-preview';
29-
export {MjmlRaw} from './mjml-raw';
30-
export {MjmlSection} from './mjml-section';
31-
export {MjmlSocial} from './mjml-social';
32-
export {MjmlSocialElement} from './mjml-social-element';
33-
export {MjmlSpacer} from './mjml-spacer';
34-
export {MjmlStyle} from './mjml-style';
35-
export {MjmlTable} from './mjml-table';
36-
export {MjmlText} from './mjml-text';
37-
export {MjmlTitle} from './mjml-title';
38-
export {MjmlWrapper} from './mjml-wrapper';
6+
export { Mjml } from './mjml';
7+
export { MjmlAccordion } from './mjml-accordion';
8+
export { MjmlAccordionElement } from './mjml-accordion-element';
9+
export { MjmlAccordionText } from './mjml-accordion-text';
10+
export { MjmlAccordionTitle } from './mjml-accordion-title';
11+
export { MjmlAll } from './mjml-all';
12+
export { MjmlAttributes } from './mjml-attributes';
13+
export { MjmlBody } from './mjml-body';
14+
export { MjmlBreakpoint } from './mjml-breakpoint';
15+
export { MjmlButton } from './mjml-button';
16+
export { MjmlCarousel } from './mjml-carousel';
17+
export { MjmlCarouselImage } from './mjml-carousel-image';
18+
export { MjmlClass } from './mjml-class';
19+
export { MjmlColumn } from './mjml-column';
20+
export { MjmlDivider } from './mjml-divider';
21+
export { MjmlFont } from './mjml-font';
22+
export { MjmlGroup } from './mjml-group';
23+
export { MjmlHead } from './mjml-head';
24+
export { MjmlHero } from './mjml-hero';
25+
export { MjmlImage } from './mjml-image';
26+
export { MjmlNavbar } from './mjml-navbar';
27+
export { MjmlNavbarLink } from './mjml-navbar-link';
28+
export { MjmlPreview } from './mjml-preview';
29+
export { MjmlRaw } from './mjml-raw';
30+
export { MjmlSection } from './mjml-section';
31+
export { MjmlSocial } from './mjml-social';
32+
export { MjmlSocialElement } from './mjml-social-element';
33+
export { MjmlSpacer } from './mjml-spacer';
34+
export { MjmlStyle } from './mjml-style';
35+
export { MjmlTable } from './mjml-table';
36+
export { MjmlText } from './mjml-text';
37+
export { MjmlTitle } from './mjml-title';
38+
export { MjmlWrapper } from './mjml-wrapper';
3939

4040
function render(email, options = {}) {
4141
const defaults = {
4242
keepComments: false,
4343
beautify: false,
4444
minify: true,
45-
validationLevel: 'strict'
45+
validationLevel: 'strict',
4646
};
47-
return mjml2html(renderToMjml(email), {...defaults, ...options});
47+
return mjml2html(renderToMjml(email), { ...defaults, ...options });
4848
}
4949

5050
function renderToMjml(email) {

src/mjml-accordion-element.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import React, {Component} from 'react';
2-
import {node} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { node } from 'prop-types';
33

4-
import {handleMjmlProps} from './utils';
4+
import { handleMjmlProps } from './utils';
55

66
export class MjmlAccordionElement extends Component {
77
static propTypes = {
8-
children: node.isRequired
8+
children: node.isRequired,
99
};
1010

1111
render() {
12-
const {children, ...rest} = this.props;
13-
return React.createElement('mj-accordion-element', handleMjmlProps(rest), children);
12+
const { children, ...rest } = this.props;
13+
return React.createElement(
14+
'mj-accordion-element',
15+
handleMjmlProps(rest),
16+
children,
17+
);
1418
}
1519
}

src/mjml-accordion-text.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import React, {Component} from 'react';
2-
import {node} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { node } from 'prop-types';
33

4-
import {handleMjmlProps} from './utils';
4+
import { handleMjmlProps } from './utils';
55

66
export class MjmlAccordionText extends Component {
77
static propTypes = {
8-
children: node.isRequired
8+
children: node.isRequired,
99
};
1010

1111
render() {
12-
const {children, ...rest} = this.props;
13-
return React.createElement('mj-accordion-text', handleMjmlProps(rest), children);
12+
const { children, ...rest } = this.props;
13+
return React.createElement(
14+
'mj-accordion-text',
15+
handleMjmlProps(rest),
16+
children,
17+
);
1418
}
1519
}

src/mjml-accordion-title.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import React, {Component} from 'react';
2-
import {node} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { node } from 'prop-types';
33

4-
import {handleMjmlProps} from './utils';
4+
import { handleMjmlProps } from './utils';
55

66
export class MjmlAccordionTitle extends Component {
77
static propTypes = {
8-
children: node.isRequired
8+
children: node.isRequired,
99
};
1010

1111
render() {
12-
const {children, ...rest} = this.props;
13-
return React.createElement('mj-accordion-title', handleMjmlProps(rest), children);
12+
const { children, ...rest } = this.props;
13+
return React.createElement(
14+
'mj-accordion-title',
15+
handleMjmlProps(rest),
16+
children,
17+
);
1418
}
1519
}

src/mjml-accordion.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import React, {Component} from 'react';
2-
import {node} from 'prop-types';
1+
import React, { Component } from 'react';
2+
import { node } from 'prop-types';
33

4-
import {handleMjmlProps} from './utils';
4+
import { handleMjmlProps } from './utils';
55

66
export class MjmlAccordion extends Component {
77
static propTypes = {
8-
children: node.isRequired
8+
children: node.isRequired,
99
};
1010

1111
render() {
12-
const {children, ...rest} = this.props;
12+
const { children, ...rest } = this.props;
1313
return React.createElement('mj-accordion', handleMjmlProps(rest), children);
1414
}
1515
}

src/mjml-all.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import React, {Component} from 'react';
1+
import React, { Component } from 'react';
22

3-
import {handleMjmlProps} from './utils';
3+
import { handleMjmlProps } from './utils';
44

55
export class MjmlAll extends Component {
6-
76
render() {
87
return React.createElement('mj-all', handleMjmlProps(this.props), null);
98
}
10-
119
}

0 commit comments

Comments
 (0)