mikser-io-post-mjml 3.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/index.js +20 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,15 +14,18 @@ npm install mikser-io-post-mjml
|
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
16
|
// mikser.config.js
|
|
17
|
+
import { postMjml } from 'mikser-io-post-mjml'
|
|
18
|
+
|
|
17
19
|
export default {
|
|
18
|
-
plugins: [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
plugins: [
|
|
21
|
+
postMjml({
|
|
22
|
+
options: { keepComments: false, minify: true }
|
|
23
|
+
})
|
|
24
|
+
]
|
|
22
25
|
}
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
`
|
|
28
|
+
The `options` key is passed through to [`mjml2html`](https://www.npmjs.com/package/mjml). The plugin sets `validationLevel: 'soft'` by default.
|
|
26
29
|
|
|
27
30
|
## Layout naming
|
|
28
31
|
|
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import mjml2html from 'mjml'
|
|
2
|
-
import { readFile } from 'node:fs/promises'
|
|
2
|
+
import { readFile, writeFile, mkdir } from 'node:fs/promises'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
|
|
5
5
|
// Declare the produced file extension so mikser-io can compute the
|
|
6
6
|
// destination correctly even though the postprocessor name and the
|
|
7
|
-
// output extension differ.
|
|
7
|
+
// output extension differ.
|
|
8
8
|
export const output = 'html'
|
|
9
9
|
|
|
10
10
|
export async function postprocess({ entity, options, config, logger }) {
|
|
@@ -22,5 +22,22 @@ export async function postprocess({ entity, options, config, logger }) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
return
|
|
25
|
+
// File-path contract: write directly to entity.destination, return
|
|
26
|
+
// its path so the chain dispatcher can thread it as the next stage's
|
|
27
|
+
// origin. Intermediates land in scratch under runtimeFolder; final
|
|
28
|
+
// stage's destination is the outputFolder/<destination>.
|
|
29
|
+
const outputPath = path.join(options.outputFolder, entity.destination)
|
|
30
|
+
await mkdir(path.dirname(outputPath), { recursive: true })
|
|
31
|
+
await writeFile(outputPath, html)
|
|
32
|
+
return { success: true, result: entity.destination }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// v9 factory — ADR-0010.
|
|
36
|
+
export function postMjml(options = {}) {
|
|
37
|
+
return {
|
|
38
|
+
name: options.name ?? 'mjml',
|
|
39
|
+
options,
|
|
40
|
+
output,
|
|
41
|
+
postprocess,
|
|
42
|
+
}
|
|
26
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mikser-io-post-mjml",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/almero-digital-marketing/mikser-io-post-mjml#readme",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"mikser-io": "^
|
|
19
|
+
"mikser-io": "^9.0.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"mjml": "^5.
|
|
22
|
+
"mjml": "^5.3.0"
|
|
23
23
|
}
|
|
24
24
|
}
|