@softlimit/theme-envy 0.1.5-alpha → 0.1.7-alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,7 +72,8 @@ function watch({ mode, verbose }) {
72
72
  const chokidar = require('chokidar')
73
73
  console.log('watching for changes...')
74
74
  chokidar.watch(ThemeEnvy.themePath).on('change', (path) => {
75
- ThemeEnvy.events.emit('watch:start')
75
+ // pass path to the event so we can use to update files separately
76
+ ThemeEnvy.events.emit('watch:change', path)
76
77
  const isJSONTemplate = path.includes('templates/') && path.extname(path) === '.json'
77
78
  if (!isJSONTemplate) {
78
79
  console.log(`updated: ${path.split(ThemeEnvy.themePath + '/')[1]}`)
@@ -17,5 +17,7 @@ assets.forEach(asset => {
17
17
  ThemeEnvy.progress.increment('assets', 1)
18
18
  } catch (err) {
19
19
  console.error(err)
20
+ } finally {
21
+ // use chokidar to watch for changes and copy to dist again
20
22
  }
21
23
  })
@@ -34,7 +34,7 @@ const writeSettingsSchema = () => {
34
34
 
35
35
  writeSettingsSchema()
36
36
 
37
- ThemeEnvy.events.on('watch:start', () => {
37
+ ThemeEnvy.events.on('watch:change', () => {
38
38
  // clear node cache of ThemeRequired modules
39
39
  requiredModules.forEach(module => {
40
40
  delete require.cache[require.resolve(module)]
@@ -23,7 +23,7 @@ const setPreGlobs = () => {
23
23
  }
24
24
 
25
25
  // uncache all required files after a build is complete so changes can be made to partials and schemas in between watch events
26
- ThemeEnvy.events.on('watch:start', () => {
26
+ ThemeEnvy.events.on('watch:change', () => {
27
27
  // clear node cache of ThemeRequired modules
28
28
  requiredModules.forEach(module => {
29
29
  delete require.cache[require.resolve(module)]
@@ -12,11 +12,11 @@ const { spawn } = require('child_process')
12
12
 
13
13
  module.exports = function() {
14
14
  const relativeDistPath = path.relative(process.cwd(), ThemeEnvy.outputPath)
15
- const themePull = ['theme', 'pull', `--store=${ThemeEnvy.store}`, `--path=${relativeDistPath}`]
16
- const shopify = spawn('shopify', themePull, { cwd: ThemeEnvy.outputPath, stdio: 'inherit' })
15
+ const themePull = ['theme', 'pull', `--store=${ThemeEnvy.store}`, `--path=${relativeDistPath}`, '--only=settings_data.json', '--only=templates/*.json']
16
+ const shopify = spawn('shopify', themePull, { cwd: path.resolve(process.cwd()), stdio: 'inherit' })
17
17
 
18
18
  shopify.on('exit', function() {
19
- const files = glob.sync(path.resolve(ThemeEnvy.outputPath, '{templates,config,sections}/**/*.json')).filter(file => file.indexOf('settings_schema') > -1)
19
+ const files = glob.sync(path.resolve(ThemeEnvy.outputPath, '{templates,config,sections}/**/*.json')).filter(file => file.indexOf('settings_schema') === -1)
20
20
  files.forEach(file => fs.copyFileSync(file, file.replace(ThemeEnvy.outputPath, ThemeEnvy.themePath)))
21
21
  })
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softlimit/theme-envy",
3
- "version": "0.1.5-alpha",
3
+ "version": "0.1.7-alpha",
4
4
  "description": "Softlimit Shopify Theme Development Environment",
5
5
  "bin": {
6
6
  "theme-envy": "./index.js"