Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prop-types definitions from mjml-react #93

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
210739b
Types: Add types for mjml-react
henrinormak Nov 4, 2018
dfdfbec
Types: Use correct version of typescript
henrinormak Nov 6, 2018
988c5cc
Types: Fix lint
VincentLanglet Feb 12, 2019
7edfc67
Types: [mjml-react] Move extensions and utils to correct location (#4…
CarsonF Feb 12, 2020
40d1aaf
Types: Add align to MjmlTableProps (#42312)
michalgrzelak Feb 18, 2020
ad874a4
Types: 🤖 Merge PR #47420 Children are optional in MjmlText. by @daliusd
daliusd Sep 16, 2020
164c06a
Types: 🤖 Merge PR #50503 MJML-React loosen children type by @IanEdington
IanEdington Jan 10, 2021
0093d65
Types: 🤖 Merge PR #50518 [mjml-react] Add iconPadding to social eleme…
tubbo Jan 11, 2021
dd6c048
Types: 🤖 Merge PR #53600 Add mjClass prop to ClassNameProps in mjml-r…
philipwindeyer Jun 4, 2021
f3d915f
Types: 🤖 Merge PR #53601 add cssClass prop to MjmlSocial component in…
philipwindeyer Jun 4, 2021
25f2711
Types: 🤖 Merge PR #53878 Add MjmlError by @adamth
adamth Jun 17, 2021
2bbe70d
Types: 🤖 Merge PR #53951 Update MjmlColumn props by @adamth
Jun 28, 2021
974c200
Types: Add undefined to optional properties, part H (#54355)
sandersn Jul 7, 2021
d119c24
Types: 🤖 Merge PR #54456 mjml-react: Add missing table props by @adamth
Jul 13, 2021
743952f
Types: 🤖 Merge PR #56254 [mjml-react] Add Explicit types for children…
eps1lon Nov 8, 2021
7d01e56
Types: [mjml-react] Add explicit types for children (#57301)
eps1lon Nov 25, 2021
6d3af69
Types: Change tslint.json 'extends' property (#57489)
sandersn Dec 2, 2021
b7a7db2
Types: [mjml-react] Add backgroundPosition to MjmlWrapperProps and Mj…
zecka Jan 20, 2022
7a7f782
Types: 🤖 Merge PR #59026 mjml-react v2.0.5: add MjmlHtmlAttributes ty…
philipwindeyer Mar 15, 2022
4d16a28
Types: Replace $ExpectError with @ts-expect-error (#60697)
jablko Jun 24, 2022
36016fe
Types: 🤖 Merge PR #61411 mjml-react: Allow Non-Number as MjmlButton f…
jdemangeon Aug 2, 2022
fa5ef3e
Types: 🤖 Merge PR #62082 Update `mjml-react` to allow `letterSpacing`…
nahtnam Sep 7, 2022
4ddb4ae
Update build tools for mjml-react and release the first version (#1)
harry-wang-faire Sep 21, 2022
ace15f3
Types: Rearrange files for Faire/mjml-react
IanEdington Sep 24, 2022
1316e63
Merge DefinitelyTyped mjml-react types
IanEdington Sep 24, 2022
d3fe52b
Add type definitions for compatibility with typescript projects (#4)
emmclaughlin Sep 24, 2022
9c05da2
Update the readme to include updated import and Faire's announcement …
harry-wang-faire Sep 26, 2022
0821bac
Update README.md (#6)
IanEdington Sep 26, 2022
8351a7b
Remove prop-types definitions from mjml-react
IanEdington Sep 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
dist
node_modules
*npm-debug.log
target
maven
package-lock.json
coverage
typings
.history
.idea
*.iml
test/e2e/screenshots
.yo-rc.json
.DS_Store
/dist

/.idea

/node_modules
/package-lock.json
/yarn-error.log
5 changes: 4 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
package-lock=false
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
registry=https://registry.npmjs.org/
always-auth=true
package-lock=false
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# mjml-react &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/wix-incubator/mjml-react/blob/master/LICENSE) <a href="https://www.npmjs.com/package/mjml-react"><img src="https://img.shields.io/npm/v/mjml-react.svg" alt="npm version"></a> [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/wix-incubator/mjml-react/pulls)
## Annoucement from Engineering @ Faire
Hello mjml community, we at Faire are excited to announce we will be taking over maintaining the open-source mjml-react project!

---
Over the past year, Faire has used mjml-react extensively. This package allowed us to incorporate all the benefits of mjml without having to ask our developers to learn a new dev environment when moving from web to email. As a result, we significantly reduced the development effort for creating emails, while keeping email rendering issues to a minimum.

## NOTICE: This project is no longer maintained. :warning:
We saw so much benefit from mjml-react, and we don’t want to see it go. That is why we want to continue to maintain the package, and improve it with some of our own new ideas! For now you can check us out at [@faire/mjml-react](https://github.com/Faire/mjml-react). We hope this can be a drop-in replacement for mjml-react in most cases, but are eager to work with you if there are any issues. Don’t hesitate to reach out to us on the #mjml-react channel in the [MJML Slack Group](https://join.slack.com/t/mjml/shared_invite/zt-gqmwfwmr-kPBnfuuB7wof5httaTcXxg) or file a [github issue](https://github.com/Faire/mjml-react/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). From there, you can look forward to new improvements coming soon.

This project is no longer maintained. There will be no more new features, fixes and releases. Feel free to fork this repository, use different build system and release this project under different name.
And of course we want to extend a massive thank you to the Wix team for building and previously maintaining this project.

---
# mjml-react &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/faire/mjml-react/blob/master/LICENSE) <a href="https://www.npmjs.com/package/mjml-react"><img src="https://img.shields.io/npm/v/@faire/mjml-react" alt="npm version"></a> [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/faire/mjml-react/pulls)

<img src="https://cdn.worldvectorlogo.com/logos/mjml-by-mailjet.svg" height="64"/> &middot; <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xMS41IC0xMC4yMzE3NCAyMyAyMC40NjM0OCI+CiAgPHRpdGxlPlJlYWN0IExvZ288L3RpdGxlPgogIDxjaXJjbGUgY3g9IjAiIGN5PSIwIiByPSIyLjA1IiBmaWxsPSIjNjFkYWZiIi8+CiAgPGcgc3Ryb2tlPSIjNjFkYWZiIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIi8+CiAgICA8ZWxsaXBzZSByeD0iMTEiIHJ5PSI0LjIiIHRyYW5zZm9ybT0icm90YXRlKDYwKSIvPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIiB0cmFuc2Zvcm09InJvdGF0ZSgxMjApIi8+CiAgPC9nPgo8L3N2Zz4K" width="64" height="64"/>

Expand All @@ -20,7 +21,7 @@ So in order to create emails on the fly we created a library with `React` compon
Install the required dependencies first:

```bash
npm install react react-dom mjml mjml-react
npm install react react-dom mjml @faire/mjml-react
```

And afterwards write a code like a pro:
Expand All @@ -37,7 +38,7 @@ import {
MjmlColumn,
MjmlButton,
MjmlImage,
} from "mjml-react";
} from "@faire/mjml-react";

const { html, errors } = render(
<Mjml>
Expand Down Expand Up @@ -74,7 +75,7 @@ And as the result you will get a nice looking email HTML (works in mobile too!)

## Options

mjml-react sets the following MJML options when rendering to HTML:
@faire/mjml-react sets the following MJML options when rendering to HTML:

```js
{
Expand All @@ -94,7 +95,7 @@ import {
MjmlHtml,
MjmlComment,
MjmlConditionalComment
} from 'mjml-react/extensions';
} from '@faire/mjml-react/extensions';

<MjmlComment>Built with ... at ...</MjmlComment>
// <!--Built with ... at ...-->
Expand All @@ -116,7 +117,7 @@ Because not all mail clients do support named HTML entities, like `&apos;`.
So we need to replace them to hex.

```js
import { namedEntityToHexCode, fixConditionalComment } from "mjml-react/utils";
import { namedEntityToHexCode, fixConditionalComment } from "@faire/mjml-react/utils";

const html = "<div>&apos;</div>";
namedEntityToHexCode(html);
Expand All @@ -132,7 +133,7 @@ fixConditionalComment(

## Limitations

Currently `mjml` and `mjml-react` libraries are meant to be run inside a node.
Currently `mjml` and `@faire/mjml-react` libraries are meant to be run inside a node.

## Example project

Expand Down
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"presets": [
"@babel/env",
"@babel/preset-react"
]
}
7 changes: 7 additions & 0 deletions babel.esm.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var babelConfig = require('./babel.config')

babelConfig.presets[0] = ["@babel/preset-env", {
"targets": { "esmodules": true }
}]

module.exports = babelConfig
84 changes: 36 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,77 +1,65 @@
{
"name": "mjml-react",
"version": "2.0.2",
"name": "@faire/mjml-react",
"version": "2.1.2",
"license": "MIT",
"author": {
"name": "Mantas Miliukas",
"email": "[email protected]"
"description": "React component library to generate the HTML emails on the fly",
"keywords": [
"email",
"mjml",
"react"
],
"author": "Ian Edington <[email protected]>",
"homepage": "https://github.com/Faire/mjml-react",
"repository": {
"type": "git",
"url": "git+https://github.com/Faire/mjml-react.git"
},
"bugs": {
"url": "https://github.com/Faire/mjml-react/issues"
},
"homepage": "https://github.com/wix-incubator/mjml-react",
"bugs": "https://github.com/wix-incubator/mjml-react/issues",
"main": "dist/src/index.js",
"files": [
"extensions.js",
"utils.js",
"dist"
"dist",
"types"
],
"types": "types/index.d.ts",
"directories": {
"test": "test"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"versionBumpStrategy": "patch"
},
"scripts": {
"start": "yoshi start",
"pretest": "yoshi build",
"test": "yoshi test --mocha",
"posttest": "yoshi lint"
"build": "/bin/rm -rf dist && yarn build-cjs && yarn build-esm",
"build-cjs": "babel --out-dir dist/src ./src",
"build-esm": "babel --config-file ./babel.esm.config.js --out-dir dist/esm ./src",
"test": "jest test"
},
"devDependencies": {
"babel-plugin-transform-runtime": "~6.23.0",
"chai": "~4.1.0",
"@babel/cli": "^7.18.10",
"@babel/core": "^7.19.0",
"@babel/preset-env": "^7.19.0",
"@babel/preset-react": "^7.18.6",
"@types/react": "^17.0.4",
"chai": "^4.3.6",
"jest": "^29.0.3",
"mjml": "^4.7.0",
"mjml2json": "^1.0.1",
"puppeteer": "^1.4.0",
"prop-types": "^15.8.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"@wix/yoshi": "^4.186.0"
"react-dom": "^17.0.0"
},
"peerDependencies": {
"mjml": "^4.7.0",
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
},
"yoshi": {
"hmr": "auto"
},
"module": "dist/es/src/index.js",
"module": "dist/esm/index.js",
"dependencies": {
"@babel/runtime": "^7.14.6",
"babel-runtime": "~6.25.0",
"color": "^3.1.3",
"react-reconciler": "^0.26.1"
},
"babel": {
"plugins": [
"transform-runtime"
],
"presets": [
"wix"
]
},
"eslintConfig": {
"extends": "yoshi",
"rules": {
"quote-props": 0,
"indent": [
"error",
2,
{
"SwitchCase": 1,
"ignoredNodes": [
"JSXElement",
"JSXElement *"
]
}
]
}
}
}
5 changes: 0 additions & 5 deletions src/extensions/mjml-comment.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { string } from 'prop-types';

import { handleMjmlProps } from '../utils';

export class MjmlComment extends Component {
static propTypes = {
children: string.isRequired,
};

render() {
const { children, ...rest } = this.props;
if (children && children.trim().length) {
Expand Down
6 changes: 0 additions & 6 deletions src/extensions/mjml-conditional-comment.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import React, { Component } from 'react';
import { string } from 'prop-types';

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

export class MjmlConditionalComment extends Component {
static propTypes = {
children: string.isRequired,
condition: string.isRequired,
};

static defaultProps = {
condition: 'if gte mso 9',
};
Expand Down
6 changes: 0 additions & 6 deletions src/extensions/mjml-html.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React, { Component } from 'react';
import { string } from 'prop-types';

export class MjmlHtml extends Component {
static propTypes = {
tag: string,
html: string.isRequired,
};

render() {
const { tag, html } = this.props;
return React.createElement(tag || 'mj-raw', {
Expand Down
5 changes: 0 additions & 5 deletions src/extensions/mjml-tracking-pixel.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { string } from 'prop-types';

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

export class MjmlTrackingPixel extends Component {
static propTypes = {
src: string.isRequired,
};

render() {
const { src } = this.props;
const trackingPixelStyle = {
Expand Down
5 changes: 0 additions & 5 deletions src/extensions/mjml-yahoo-style.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { string } from 'prop-types';

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

export class MjmlYahooStyle extends Component {
static propTypes = {
children: string.isRequired,
};

render() {
const { children, ...rest } = this.props;
if (children && children.trim().length) {
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-accordion-element.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlAccordionElement extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement(
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-accordion-text.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlAccordionText extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement(
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-accordion-title.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlAccordionTitle extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement(
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-accordion.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlAccordion extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement('mj-accordion', handleMjmlProps(rest), children);
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-attributes.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlAttributes extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement(
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-body.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlBody extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement('mj-body', handleMjmlProps(rest), children);
Expand Down
5 changes: 0 additions & 5 deletions src/mjml-button.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, { Component } from 'react';
import { node } from 'prop-types';

import { handleMjmlProps } from './utils';

export class MjmlButton extends Component {
static propTypes = {
children: node,
};

render() {
const { children, ...rest } = this.props;
return React.createElement('mj-button', handleMjmlProps(rest), children);
Expand Down
Loading