[TASK][SECURITY][!!!] Update to mjml 4 due to security npm issues

* [TASK][SECURITY][!!!] Update to mjml 4 due to security npm issues

* WIP|TASK: Fix broken test

Fix error in test.

Still the expected HTML is not as returned from mjml.

* [TASK] Remove comment generated by the consoleOutput in the test

* [TASK] Modify Expected.html to fit generated entry

* [TASK] Add same conversions on both outputs

* [TASK] Try with phpunit assertStringEqualsFile function

* [TASK] remove the \n again

* [BUGFIX] Add some compression configs to keep it small

* [BUGFIX] reduce line length
This commit is contained in:
Daniel Huf 2018-06-13 10:28:05 +02:00 committed by GitHub
parent 543fbba727
commit d1a97b9be8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 70 additions and 2925 deletions

View file

@ -9,15 +9,17 @@ class Command implements RendererInterface
{
public function getHtmlFromMjml($mjml)
{
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml']);
$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml']);
$temporaryMjmlFileWithPath = GeneralUtility::tempnam('mjml_', '.mjml');
GeneralUtility::writeFileToTypo3tempDir($temporaryMjmlFileWithPath, $mjml);
$mjmlExtPath = ExtensionManagementUtility::extPath('mjml');
// see https://mjml.io/download and https://www.npmjs.com/package/mjml-cli
$cmd = $configuration['nodeBinaryPath'] . ' ' . ExtensionManagementUtility::extPath('mjml') . $configuration['mjmlBinaryPath'] . $configuration['mjmlBinary'];
$args = $configuration['mjmlParams'] . ' ' . $temporaryMjmlFileWithPath;
$cmd = $conf['nodeBinaryPath'] . ' ' . $mjmlExtPath . $conf['mjmlBinaryPath'] . $conf['mjmlBinary'];
$args = $temporaryMjmlFileWithPath . ' ' . $conf['mjmlParams'];
$result = [];
$returnValue = '';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -9,23 +9,21 @@ class MjmlBasedViewTest extends AbstractUnitTestCase
{
public const EXAMPLE_MJML_TEMPLATE = '<mjml>
<mj-body>
<mj-container>
<mj-section>
<mj-column>
<mj-image src="/assets/img/easy-and-quick.png" width="112" />
<mj-text font-size="20px" color="#595959" align="center">Easy and Quick</mj-text>
</mj-column>
<mj-column>
<mj-image src="/assets/img/responsive.png" width="135" />
<mj-text font-size="20px" color="#595959" align="center">Responsive</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-button background-color="#F45E43" font-size="15px">Discover</mj-button>
</mj-column>
</mj-section>
</mj-container>
<mj-section>
<mj-column>
<mj-image src="/assets/img/easy-and-quick.png" width="112px" />
<mj-text font-size="20px" color="#595959" align="center">Easy and Quick</mj-text>
</mj-column>
<mj-column>
<mj-image src="/assets/img/responsive.png" width="135px" />
<mj-text font-size="20px" color="#595959" align="center">Responsive</mj-text>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-button background-color="#F45E43" font-size="15px">Discover</mj-button>
</mj-column>
</mj-section>
</mj-body>
</mjml>
';

View file

@ -1,11 +1,11 @@
# cat=node/Binary/1000; type=string; label=Path to node binary : /usr/bin/node
nodeBinaryPath = /usr/bin/node
# cat=mjml/Binary/2000; type=string; label=Path to mjml binary in mjml EXT folder : ./node_modules/.bin/
mjmlBinaryPath = ./node_modules/.bin/
# cat=mjml/Binary/2000; type=string; label=Path to mjml binary in mjml EXT folder : ./node_modules/mjml/bin/
mjmlBinaryPath = ./node_modules/mjml/bin/
# cat=mjml/Binary/3000; type=string; label=mjml binary : mjml
mjmlBinary = mjml
# cat=mjml/Binary/4000; type=string; label=mjml params : -s -m
mjmlParams = -s -m
# cat=mjml/Binary/4000; type=string; label=mjml params : -s --config.beautify true --config.minify true
mjmlParams = -s --config.beautify true --config.minify true

2878
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "mjml-typo3",
"dependencies": {
"mjml": "^3.3.5"
"mjml": "^4.0.5"
}
}