@softlimit/theme-envy 0.1.11-alpha → 0.1.12-alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,9 @@ module.exports = function(path) {
13
13
  if (path.includes('sections/')) {
14
14
  return `sections/${filename}`
15
15
  }
16
+ if (path.includes('blocks/')) {
17
+ return `blocks/${filename}`
18
+ }
16
19
  if (path.includes('layout/')) {
17
20
  return `layout/${filename}`
18
21
  }
@@ -9,7 +9,7 @@ const path = require('path')
9
9
  const { parseSchema } = require('#Helpers')
10
10
 
11
11
  module.exports = function({ source, filePath }) {
12
- if (!filePath.includes('sections')) return source
12
+ if (!filePath.includes('sections') && !filePath.includes('blocks')) return source
13
13
  // inject installs into inlined schema with {% schema %} {% endschema %} tags
14
14
  const hasSchemaTag = source.match(/{% schema %}/g)
15
15
  if (hasSchemaTag) return injectInstallsSchema({ source, filePath })
@@ -21,6 +21,9 @@ module.exports = function({ source, filePath }) {
21
21
  }
22
22
 
23
23
  function injectJsSchema({ source, filePath, schema }) {
24
+ if (filePath.includes('blocks')) {
25
+ console.log('inject block schema', filePath, schema)
26
+ }
24
27
  // regexp for a quoted string within our schema match
25
28
  const schemaFile = schema[0].match(/'(.*)'/)[1] || schema[0].match(/"(.*)"/)[1]
26
29
  // load the file export
@@ -18,8 +18,8 @@ module.exports = function({ file, mode, verbose }) {
18
18
  const outputPath = `${ThemeEnvy.outputPath}/${shopifyPath}`
19
19
  let source = fs.readFileSync(file, 'utf8')
20
20
 
21
- // inject schema .js into liquid section files
22
- if (file.includes('sections/')) source = sectionSchemaInject({ source, filePath: file })
21
+ // inject schema .js into liquid section or block files
22
+ if (file.includes('sections/') || file.includes('blocks/')) source = sectionSchemaInject({ source, filePath: file })
23
23
 
24
24
  // apply our custom liquid tags: partial, hook, theme
25
25
  source = extendLiquid({ source, filePath: file })
@@ -10,7 +10,7 @@
10
10
  const fs = require('fs-extra')
11
11
  const path = require('path')
12
12
 
13
- const directories = ['assets', 'config', 'layout', 'locales', 'sections', 'snippets', 'templates']
13
+ const directories = ['assets', 'blocks', 'config', 'layout', 'locales', 'sections', 'snippets', 'templates']
14
14
  const envyDirectories = ['theme-envy/elements', 'theme-envy/features', 'theme-envy/partials', 'theme-envy/schema']
15
15
  function ensureDirectory(root, dir) {
16
16
  fs.ensureDirSync(path.resolve(root, dir))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softlimit/theme-envy",
3
- "version": "0.1.11-alpha",
3
+ "version": "0.1.12-alpha",
4
4
  "description": "Softlimit Shopify Theme Development Environment",
5
5
  "bin": {
6
6
  "theme-envy": "./index.js"
@@ -36,7 +36,7 @@
36
36
  "url": "https://github.com/softlimit/theme-envy"
37
37
  },
38
38
  "engines": {
39
- "npm": "8.x"
39
+ "npm": ">=8.x"
40
40
  },
41
41
  "standard-version": {
42
42
  "scripts": {