@maizzle/framework 4.4.0-beta.4 → 4.4.0-beta.6

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 CHANGED
@@ -34,9 +34,9 @@ The Maizzle framework is open-sourced software licensed under the [MIT license](
34
34
 
35
35
  [npm]: https://www.npmjs.com/package/@maizzle/framework
36
36
  [npm-stats]: https://npm-stat.com/charts.html?package=%40maizzle%2Fframework&from=2019-03-27
37
- [npm-version-shield]: https://img.shields.io/npm/v/@maizzle/framework.svg?style=flat-square
38
- [npm-stats-shield]: https://img.shields.io/npm/dt/@maizzle/framework.svg?style=flat-square&color=4f46e5
37
+ [npm-version-shield]: https://img.shields.io/npm/v/@maizzle/framework.svg
38
+ [npm-stats-shield]: https://img.shields.io/npm/dt/@maizzle/framework.svg?color=4f46e5
39
39
  [github-ci]: https://github.com/maizzle/framework/actions
40
- [github-ci-shield]: https://img.shields.io/github/workflow/status/maizzle/framework/Node.js%20CI?style=flat-square
40
+ [github-ci-shield]: https://github.com/maizzle/framework/actions/workflows/nodejs.yml/badge.svg
41
41
  [license]: ./LICENSE
42
- [license-shield]: https://img.shields.io/npm/l/@maizzle/framework.svg?style=flat-square&color=0e9f6e
42
+ [license-shield]: https://img.shields.io/npm/l/@maizzle/framework.svg?color=0e9f6e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "4.4.0-beta.4",
3
+ "version": "4.4.0-beta.6",
4
4
  "description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
5
5
  "license": "MIT",
6
6
  "main": "src/index.js",
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@maizzle/cli": "^1.5.1",
44
44
  "autoprefixer": "^10.4.13",
45
- "browser-sync": "^2.26.13",
45
+ "browser-sync": "^2.27.11",
46
46
  "color-shorthand-hex-to-six-digit": "^3.0.2",
47
47
  "email-comb": "^5.2.0",
48
48
  "front-matter": "^4.0.0",
@@ -53,7 +53,7 @@
53
53
  "juice": "^8.0.0",
54
54
  "lodash": "^4.17.20",
55
55
  "ora": "^5.1.0",
56
- "postcss": "^8.4.19",
56
+ "postcss": "^8.4.21",
57
57
  "postcss-import": "^15.0.0",
58
58
  "postcss-merge-longhand": "^5.1.7",
59
59
  "posthtml": "^0.16.6",
@@ -64,20 +64,20 @@
64
64
  "posthtml-extend": "^0.6.0",
65
65
  "posthtml-extra-attributes": "^1.0.0",
66
66
  "posthtml-fetch": "^2.2.0",
67
- "posthtml-markdownit": "^1.3.0",
67
+ "posthtml-markdownit": "^1.3.1",
68
68
  "posthtml-match-helper": "^1.0.3",
69
69
  "posthtml-mso": "^1.0.4",
70
70
  "posthtml-postcss-merge-longhand": "^1.0.2",
71
71
  "posthtml-safe-class-names": "^2.0.0",
72
72
  "posthtml-url-parameters": "^1.0.4",
73
73
  "pretty": "^2.0.0",
74
- "query-string": "^7.1.0",
74
+ "query-string": "^7.1.3",
75
75
  "string-remove-widows": "^2.1.0",
76
76
  "string-strip-html": "^8.2.0",
77
77
  "tailwindcss": "^3.2.4"
78
78
  },
79
79
  "devDependencies": {
80
- "ava": "^5.1.0",
80
+ "ava": "^5.1.1",
81
81
  "c8": "^7.11.0",
82
82
  "np": "*",
83
83
  "xo": "0.39.1"
@@ -13,16 +13,23 @@ module.exports = {
13
13
 
14
14
  const cwd = env === 'maizzle-ci' ? './test/stubs/config' : process.cwd()
15
15
 
16
- for (const module of ['./config', './config.local']) {
16
+ for (const module of ['./config', './config.cjs', './config.local', './config.local.cjs']) {
17
17
  try {
18
18
  baseConfig = merge(baseConfig, requireUncached(path.resolve(cwd, module)))
19
19
  } catch {}
20
20
  }
21
21
 
22
22
  if (typeof env === 'string' && env !== 'local') {
23
- try {
24
- envConfig = merge(envConfig, requireUncached(path.resolve(cwd, `./config.${env}`)))
25
- } catch {
23
+ let loaded = false
24
+ for (const module of [`./config.${env}`, `./config.${env}.cjs`]) {
25
+ try {
26
+ envConfig = merge(envConfig, requireUncached(path.resolve(cwd, module)))
27
+ loaded = true
28
+ break
29
+ } catch {}
30
+ }
31
+
32
+ if (!loaded) {
26
33
  throw new Error(`could not load config.${env}.js`)
27
34
  }
28
35
  }
@@ -32,6 +32,11 @@ module.exports = async (env, spinner, config) => {
32
32
 
33
33
  // Parse each template config object
34
34
  await asyncForEach(templatesConfig, async templateConfig => {
35
+ if (!templateConfig) {
36
+ const configFileName = env === 'local' ? 'config.js' : `config.${env}.js`
37
+ throw new Error(`No template sources defined in \`build.templates\`, check your ${configFileName} file`)
38
+ }
39
+
35
40
  const outputDir = get(templateConfig, 'destination.path', `build_${env}`)
36
41
 
37
42
  await fs.remove(outputDir)
@@ -67,6 +72,17 @@ module.exports = async (env, spinner, config) => {
67
72
  }
68
73
  }
69
74
 
75
+ // Create a pipe-delimited list of allowed extensions
76
+ // We only compile these, the rest are copied as-is
77
+ const extensions = Array.isArray(templateConfig.filetypes)
78
+ ? templateConfig.filetypes.join('|')
79
+ : templateConfig.filetypes || get(templateConfig, 'filetypes', 'html')
80
+
81
+ // List of files that won't be copied to the output directory
82
+ const omitted = Array.isArray(templateConfig.omit) ?
83
+ templateConfig.omit :
84
+ [get(templateConfig, 'omit', '')]
85
+
70
86
  // Parse each template source
71
87
  await asyncForEach(templateSource, async source => {
72
88
  /**
@@ -77,13 +93,22 @@ module.exports = async (env, spinner, config) => {
77
93
  const out = fs.lstatSync(source).isFile() ? `${outputDir}/${path.basename(source)}` : outputDir
78
94
 
79
95
  await fs
80
- .copy(source, out)
96
+ .copy(source, out, {filter: file => {
97
+ // Do not copy omitted files
98
+ return !omitted
99
+ .filter(Boolean)
100
+ .some(omit => path.normalize(file).includes(path.normalize(omit)))
101
+ }})
81
102
  .then(async () => {
82
- const extensions = Array.isArray(templateConfig.filetypes)
83
- ? templateConfig.filetypes.join('|')
84
- : templateConfig.filetypes || get(templateConfig, 'filetypes', 'html')
103
+ const allSourceFiles = await glob(`${outputDir}/**/*.+(${extensions})`)
104
+
105
+ const skipped = Array.isArray(templateConfig.skip) ?
106
+ templateConfig.skip :
107
+ [get(templateConfig, 'skip', '')]
85
108
 
86
- const templates = await glob(`${outputDir}/**/*.+(${extensions})`)
109
+ const templates = allSourceFiles.filter(template => {
110
+ return !skipped.includes(template.replace(`${outputDir}/`, ''))
111
+ })
87
112
 
88
113
  if (templates.length === 0) {
89
114
  spinner.warn(`Error: no files with the .${extensions} extension found in ${templateConfig.source}`)
@@ -114,7 +139,7 @@ module.exports = async (env, spinner, config) => {
114
139
  ...config.events
115
140
  })
116
141
 
117
- const destination = config.permalink || file
142
+ const destination = get(compiled, 'config.permalink', file)
118
143
 
119
144
  /**
120
145
  * Generate plaintext
@@ -125,7 +150,7 @@ module.exports = async (env, spinner, config) => {
125
150
 
126
151
  // Check if plaintext: true globally, fallback to template's front matter
127
152
  const plaintextConfig = get(templateConfig, 'plaintext', get(compiled.config, 'plaintext', false))
128
- const plaintextPath = get(plaintextConfig, 'destination.path', config.permalink || file)
153
+ const plaintextPath = get(plaintextConfig, 'destination.path', destination)
129
154
 
130
155
  if (Boolean(plaintextConfig) || !isEmpty(plaintextConfig)) {
131
156
  await Plaintext
@@ -9,7 +9,9 @@ module.exports = {
9
9
  return postcss([
10
10
  postcssImport(),
11
11
  postcssNested(),
12
- maizzleConfig.env === 'local' ? () => {} : mergeLonghand(),
12
+ get(maizzleConfig, 'shorthandCSS', get(maizzleConfig, 'shorthandInlineCSS')) === true ?
13
+ mergeLonghand() :
14
+ () => {},
13
15
  ...get(maizzleConfig, 'build.postcss.plugins', [])
14
16
  ])
15
17
  .process(css, {from: undefined})
@@ -5,7 +5,7 @@ const {get, merge, isObject, isEmpty} = require('lodash')
5
5
  const defaultConfig = require('../generators/posthtml/defaultConfig')
6
6
 
7
7
  module.exports = async (html, config = {}, direct = false) => {
8
- const url = direct ? config : get(config, 'baseURL')
8
+ const url = direct ? config : get(config, 'baseURL', get(config, 'baseUrl'))
9
9
  const posthtmlOptions = merge(defaultConfig, get(config, 'build.posthtml.options', {}))
10
10
 
11
11
  // Handle `baseUrl` as a string
@@ -19,11 +19,15 @@ module.exports = async (html, config = {}, direct = false) => {
19
19
  .then(result => result.html)
20
20
  }
21
21
 
22
- // Handle `baseUrl` as an object
22
+ // Handle `baseURL` as an object
23
23
  if (isObject(url) && !isEmpty(url)) {
24
- html = rewriteVMLs(html, url.url)
24
+ html = rewriteVMLs(html, get(url, 'url', ''))
25
25
 
26
- return posthtml([baseUrl(url)]).process(html, posthtmlOptions).then(result => result.html)
26
+ return posthtml([
27
+ baseUrl(merge({styleTag: true, inlineCss: true}, url))
28
+ ])
29
+ .process(html, posthtmlOptions)
30
+ .then(result => result.html)
27
31
  }
28
32
 
29
33
  return html