Skip to content

Commit e545099

Browse files
authored
Merge pull request #16 from uicrooks/dev
v2.2.1
2 parents b0586b7 + b1bc675 commit e545099

File tree

10 files changed

+17
-25
lines changed

10 files changed

+17
-25
lines changed

.config/plugins/shopify/theme.init.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,9 @@ const initTheme = async () => {
100100
const settingsFilePath = path.resolve(__dirname, '../../../shopify/config/settings_data.json')
101101

102102
// check if settings_data.json already exists and if not then create that file
103-
fs.stat(settingsFilePath, (e) => {
104-
if (e && e.code === 'ENOENT') {
105-
fs.outputFile(settingsFilePath, JSON.stringify(settingsData))
106-
} else if (e) {
107-
console.error(chalk.red(e))
108-
process.exit(1)
109-
}
110-
})
103+
if (!fs.existsSync(settingsFilePath)) {
104+
await fs.outputFile(settingsFilePath, JSON.stringify(settingsData))
105+
}
111106
} catch (e) {
112107
console.error(chalk.red(e))
113108
process.exit(1)

.config/webpack/webpack.dev.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ const ESLintPlugin = require('eslint-webpack-plugin')
44
const common = require('./webpack.common.js')
55
const log = require('../plugins/log')
66

7-
/**
8-
* initial console.log on development start
9-
*/
7+
// initial console.log on development start
108
log.box({
119
msg: 'Shopify Theme Lab:\nStarting development',
1210
color: 'green'

.config/webpack/webpack.prod.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ const TerserPlugin = require('terser-webpack-plugin') // included in webpack 5,
66
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
77
const log = require('../plugins/log')
88

9-
/**
10-
* initial console.log on build start
11-
*/
9+
// initial console.log on build start
1210
log.box({
1311
msg: 'Shopify Theme Lab:\nStarting build',
1412
color: 'green'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ By running `shopify:init` and entering credentials, the task initializes a new t
409409

410410
### Shopify + webpack
411411
- You will spend most of your time in `shopify/` and `src/` directories.
412-
- By running `yarn start` 3 tasks are executed in parallel: `dev`, `reloadr` and `shopify:watch`.
412+
- By running `npm run start` 3 tasks are executed in parallel: `dev`, `reloadr` and `shopify:watch`.
413413
- All vue related files are auto-loaded by webpack with [require.context](https://webpack.js.org/guides/dependency-management/#requirecontext) - vue components, vuex modules, as well as mixins, directives and filters with `global` in their filename. Everything is defined in `src/main.js`.
414414
- Vue components can be either used as regular single-file-components or as [renderless components](https://css-tricks.com/building-renderless-vue-components) without `<template></template>` tags (You can use Liquid templating while hooking in vue functionality).
415415
- The webpack bundle and all other assets are outputted to `shopify/assets/` directory. This directory is cleaned on every build. If you want to keep certain files like favicons add `static` to their filenames: `myfile.static.png`.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "shopify-theme-lab",
33
"description": "Customizable modular development environment for blazing-fast Shopify theme creation",
44
"author": "Sergej Samsonenko <contact@sergej.codes>",
5-
"version": "2.2.0",
5+
"version": "2.2.1",
66
"license": "MIT",
77
"repository": {
88
"type": "git",

shopify/snippets/vue-examples.liquid

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</div>
6363

6464
<div>
65-
vuex my-module state 'visible' is set to <strong>{% raw %}{{ visible }}{% endraw %}</strong>
65+
Vuex “my-module state visible is set to <strong>{% raw %}{{ visible }}{% endraw %}</strong>
6666
</div>
6767

6868
<button @click="toggle" class="shopify-theme-lab__button">
@@ -78,7 +78,7 @@
7878
</div>
7979

8080
<div>
81-
vuex my-module state 'visible' is set to <strong>{% raw %}{{ $store.state['my-module'].visible }}{% endraw %}</strong>
81+
Vuex “my-module state visible is set to <strong>{% raw %}{{ $store.state['my-module'].visible }}{% endraw %}</strong>
8282
</div>
8383

8484
<button

src/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ Vue.config.productionTip = false
1515
* vue components
1616
* auto-import all vue components
1717
*/
18-
const vueComponents = require.context('./vue/components/', true, /(\.vue$|\.js$)/)
18+
const vueComponents = require.context('./vue/components/', true, /\.(vue|js)$/)
1919

2020
vueComponents.keys().forEach(key => {
2121
const component = vueComponents(key).default
2222

2323
// if a component has a name defined use the name, else use the path as the component name
2424
const name = component.name
2525
? component.name
26-
: key.replace(/(\.\/|\.vue|\.js)/g, '').replace(/(\/|-|_)\w/g, (match) => match.slice(1).toUpperCase())
26+
: key.replace(/\.(\/|vue|js)/g, '').replace(/(\/|-|_|\s)\w/g, (match) => match.slice(1).toUpperCase())
2727

2828
Vue.component(name, component)
2929
})
@@ -34,11 +34,12 @@ vueComponents.keys().forEach(key => {
3434
*/
3535
Vue.use(Vuex)
3636

37-
const vuexModules = require.context('./vue/store/', false, /\.js$/)
37+
const vuexModules = require.context('./vue/store/', true, /\.js$/)
3838
const modules = {}
3939

4040
vuexModules.keys().forEach(key => {
41-
modules[key.replace(/(\.\/|\.js)/g, '')] = vuexModules(key).default
41+
const name = key.replace(/\.(\/|js)/g, '').replace(/\s/g, '-')
42+
modules[name] = vuexModules(key).default
4243
})
4344

4445
const store = new Vuex.Store({

src/vue/directives/global.directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default {
22
name: 'myDirective',
33
directive: {
44
inserted (el) {
5-
console.log(`${el.innerText} 'v-my-directive' was used on this element.`)
5+
console.log(`${el.innerText} v-my-directive was used on this element.`)
66
}
77
}
88
}

src/vue/filters/global.filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export default {
22
name: 'myFilter',
3-
filter: value => `'my-filter' was used on ${value}`
3+
filter: value => `my-filter was used on ${value}`
44
}

0 commit comments

Comments
 (0)