Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

Commit

Permalink
fix: LocalStorage: vuex plugins error #69
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Mar 2, 2018
1 parent 531b047 commit 26dd6b8
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 50 deletions.
2 changes: 2 additions & 0 deletions lib/build/app-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ module.exports = {

entryTemplateFile: resolve(cliDir, 'templates/app/entry.js'),
entryFile: resolve(appDir, '.quasar/entry.js'),
quasarTemplateFile: resolve(cliDir, 'templates/app/quasar.js'),
quasarFile: resolve(appDir, '.quasar/quasar.js'),

resolve: {
cli: dir => join(cliDir, dir),
Expand Down
8 changes: 5 additions & 3 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@ const

class Generator {
constructor () {
const content = fs.readFileSync(appPaths.entryTemplateFile, 'utf-8')
this.template = compileTemplate(content)
this.entryTemplate = compileTemplate(fs.readFileSync(appPaths.entryTemplateFile, 'utf-8'))
this.quasarTemplate = compileTemplate(fs.readFileSync(appPaths.quasarTemplateFile, 'utf-8'))
}

build (quasarConfig) {
log(`Generating Webpack entry point`)
const data = quasarConfig.getBuildConfig()

fse.mkdirpSync(dirname(appPaths.entryFile))
fs.writeFileSync(appPaths.entryFile, this.template(data), 'utf-8')
fs.writeFileSync(appPaths.entryFile, this.entryTemplate(data), 'utf-8')
fs.writeFileSync(appPaths.quasarFile, this.quasarTemplate(data), 'utf-8')

const
now = Date.now() / 1000,
then = now - 10

fs.utimes(appPaths.entryFile, then, then, function (err) { if (err) throw err })
fs.utimes(appPaths.quasarFile, then, then, function (err) { if (err) throw err })

if (!fse.existsSync(destAppStylFile)) {
const
Expand Down
57 changes: 10 additions & 47 deletions templates/app/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,10 @@
* One plugin per concern. Then reference the file(s) in quasar.conf.js > plugins:
* plugins: ['file', ...] // do not add ".js" extension to it.
**/
<%
function hash (str) {
const name = str.replace(/\W+/g, '')
return name.charAt(0).toUpperCase() + name.slice(1)
}

let QImports, QOptions = []
if (framework === 'all') {
QImports = ', * as All'
QOptions = ', {components: All, directives: All, plugins: All}'
}
else if (framework !== false) {
let options = []
;['components', 'directives', 'plugins'].forEach(type => {
if (framework[type]) {
let items = framework[type].filter(item => item)
if (items.length > 0) {
QOptions.push(type + ': {' + items.join(',') + '}')
options = options.concat(items)
}
}
})
if (options.length) {
QImports = ', {' + options.join(',') + '}'
QOptions = ', {' + QOptions.join(',') + '}'
}
}
%>
import Vue from 'vue'
import './quasar'

<% if (supportIE) { %>
import 'quasar-framework/dist/quasar.ie.polyfills'
<% } %>
Vue.config.productionTip = false

<%
extras && extras.filter(asset => asset).forEach(asset => {
Expand Down Expand Up @@ -69,23 +41,8 @@ import 'quasar-app-styl'
import 'src/css/<%= asset %>'
<% }) %>

import Vue from 'vue'
import Quasar<%= QImports || '' %> from 'quasar'

Vue.config.productionTip = false
import App from 'src/App'

Vue.use(Quasar<%= QImports ? QOptions : '' %>)

<% if (framework && framework.i18n) { %>
import lang from 'quasar-framework/i18n/<%= framework.i18n %>'
Quasar.i18n.set(lang)
<% } %>
<% if (framework && framework.iconSet) { %>
import iconSet from 'quasar-framework/icons/<%= framework.iconSet %>'
Quasar.icons.set(iconSet)
<% } %>

import router from 'src/router'
<% if (store) { %>
import store from 'src/store'
Expand All @@ -98,7 +55,13 @@ const app = {
...App
}

<% if (plugins) { %>
<%
if (plugins) {
function hash (str) {
const name = str.replace(/\W+/g, '')
return name.charAt(0).toUpperCase() + name.slice(1)
}
%>
const plugins = []
<%
plugins.filter(asset => asset).forEach(asset => {
Expand Down
49 changes: 49 additions & 0 deletions templates/app/quasar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* THIS FILE IS GENERATED AUTOMATICALLY.
* DO NOT EDIT.
*
* You are probably looking on adding initialization code.
* Use "quasar new plugin <name>" and add it there.
* One plugin per concern. Then reference the file(s) in quasar.conf.js > plugins:
* plugins: ['file', ...] // do not add ".js" extension to it.
**/
<%
let QImports, QOptions = []
if (framework === 'all') {
QImports = ', * as All'
QOptions = ', {components: All, directives: All, plugins: All}'
}
else if (framework !== false) {
let options = []
;['components', 'directives', 'plugins'].forEach(type => {
if (framework[type]) {
let items = framework[type].filter(item => item)
if (items.length > 0) {
QOptions.push(type + ': {' + items.join(',') + '}')
options = options.concat(items)
}
}
})
if (options.length) {
QImports = ', {' + options.join(',') + '}'
QOptions = ', {' + QOptions.join(',') + '}'
}
}

if (supportIE) { %>
import 'quasar-framework/dist/quasar.ie.polyfills'
<% } %>

import Vue from 'vue'
import Quasar<%= QImports || '' %> from 'quasar'

Vue.use(Quasar<%= QImports ? QOptions : '' %>)

<% if (framework && framework.i18n) { %>
import lang from 'quasar-framework/i18n/<%= framework.i18n %>'
Quasar.i18n.set(lang)
<% } %>
<% if (framework && framework.iconSet) { %>
import iconSet from 'quasar-framework/icons/<%= framework.iconSet %>'
Quasar.icons.set(iconSet)
<% } %>

0 comments on commit 26dd6b8

Please sign in to comment.