From 352c1eb4d684fa8a07040d596bcf71e81015c98a Mon Sep 17 00:00:00 2001
From: Pierre Charles
Date: Sun, 3 Mar 2019 11:32:41 +0100
Subject: [PATCH 01/12] :tada: Updating template using Typescript and Vue CLI 3
---
template/.babelrc | 5 -
template/.browserslistrc | 3 +
template/.editorconfig | 9 -
template/.env.dist | 2 +
template/.eslintignore | 2 -
template/.eslintrc.js | 19 -
template/.gitignore | 29 +-
template/README.md | 125 +-
template/babel.config.js | 5 +
template/build/build.js | 47 -
template/build/dev-client.js | 9 -
template/build/dev-server.js | 83 -
template/build/package-electron.js | 38 -
template/build/utils.js | 57 -
template/build/webpack.base.conf.js | 123 -
template/build/webpack.dev.conf.js | 40 -
template/build/webpack.prod.conf.js | 81 -
template/config/dev.env.js | 16 -
template/config/index.js | 47 -
template/config/prod.env.js | 3 -
template/cypress.json | 3 +
template/electron/main.js | 120 -
template/index.html | 9 -
template/locales/en.json | 21 +
template/locales/en/index.js | 20 -
template/locales/fr.json | 21 +
template/locales/fr/index.js | 20 -
template/locales/index.js | 19 -
template/package.json | 100 +-
template/postcss.config.js | 5 +
template/public/favicon.ico | Bin 0 -> 100575 bytes
template/public/index.html | 17 +
template/settings/default.json | 2 +-
template/src/App.vue | 22 +-
template/src/components/LangSwitcher.vue | 31 +-
template/src/components/Menu.vue | 21 +-
template/src/lib/locales/index.ts | 24 +
template/src/lib/router/index.ts | 9 +
template/src/lib/router/routes.ts | 25 +
template/src/lib/settings.js | 52 -
template/src/lib/store/index.ts | 40 +
template/src/main.js | 22 -
template/src/main.ts | 14 +
template/src/router/index.js | 10 -
template/src/router/routes.js | 22 -
template/src/shims-json.d.ts | 4 +
template/src/shims-tsx.d.ts | 13 +
template/src/shims-vue.d.ts | 4 +
template/src/store/index.js | 43 -
template/src/views/Garden.vue | 21 +-
template/src/views/Home.vue | 10 +-
template/src/views/Plant.vue | 48 +-
template/static/.gitkeep | 0
template/tests/e2e/plugins/index.js | 24 +
template/tests/e2e/specs/test.js | 8 +
template/tests/e2e/support/commands.js | 25 +
template/tests/e2e/support/index.js | 20 +
template/tests/unit/example.spec.ts | 13 +
template/tsconfig.json | 41 +
template/tslint.json | 20 +
template/vue.config.js | 13 +
template/yarn.lock | 7640 ++++++++++++++++++++++
62 files changed, 8228 insertions(+), 1111 deletions(-)
delete mode 100755 template/.babelrc
create mode 100644 template/.browserslistrc
delete mode 100755 template/.editorconfig
create mode 100644 template/.env.dist
delete mode 100755 template/.eslintignore
delete mode 100755 template/.eslintrc.js
mode change 100755 => 100644 template/.gitignore
mode change 100755 => 100644 template/README.md
create mode 100644 template/babel.config.js
delete mode 100755 template/build/build.js
delete mode 100755 template/build/dev-client.js
delete mode 100755 template/build/dev-server.js
delete mode 100755 template/build/package-electron.js
delete mode 100755 template/build/utils.js
delete mode 100755 template/build/webpack.base.conf.js
delete mode 100755 template/build/webpack.dev.conf.js
delete mode 100755 template/build/webpack.prod.conf.js
delete mode 100755 template/config/dev.env.js
delete mode 100755 template/config/index.js
delete mode 100755 template/config/prod.env.js
create mode 100644 template/cypress.json
delete mode 100755 template/electron/main.js
delete mode 100755 template/index.html
create mode 100644 template/locales/en.json
delete mode 100644 template/locales/en/index.js
create mode 100644 template/locales/fr.json
delete mode 100644 template/locales/fr/index.js
delete mode 100644 template/locales/index.js
mode change 100755 => 100644 template/package.json
create mode 100644 template/postcss.config.js
create mode 100644 template/public/favicon.ico
create mode 100644 template/public/index.html
mode change 100644 => 100755 template/settings/default.json
create mode 100644 template/src/lib/locales/index.ts
create mode 100644 template/src/lib/router/index.ts
create mode 100644 template/src/lib/router/routes.ts
delete mode 100755 template/src/lib/settings.js
create mode 100644 template/src/lib/store/index.ts
delete mode 100644 template/src/main.js
create mode 100644 template/src/main.ts
delete mode 100644 template/src/router/index.js
delete mode 100644 template/src/router/routes.js
create mode 100644 template/src/shims-json.d.ts
create mode 100644 template/src/shims-tsx.d.ts
create mode 100644 template/src/shims-vue.d.ts
delete mode 100644 template/src/store/index.js
delete mode 100644 template/static/.gitkeep
create mode 100644 template/tests/e2e/plugins/index.js
create mode 100644 template/tests/e2e/specs/test.js
create mode 100644 template/tests/e2e/support/commands.js
create mode 100644 template/tests/e2e/support/index.js
create mode 100644 template/tests/unit/example.spec.ts
create mode 100644 template/tsconfig.json
create mode 100644 template/tslint.json
create mode 100644 template/vue.config.js
create mode 100644 template/yarn.lock
diff --git a/template/.babelrc b/template/.babelrc
deleted file mode 100755
index 41789ca..0000000
--- a/template/.babelrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "presets": ["es2015", "stage-2"],
- "plugins": ["transform-runtime"],
- "comments": false
-}
diff --git a/template/.browserslistrc b/template/.browserslistrc
new file mode 100644
index 0000000..9dee646
--- /dev/null
+++ b/template/.browserslistrc
@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not ie <= 8
diff --git a/template/.editorconfig b/template/.editorconfig
deleted file mode 100755
index 9d08a1a..0000000
--- a/template/.editorconfig
+++ /dev/null
@@ -1,9 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-indent_style = space
-indent_size = 2
-end_of_line = lf
-insert_final_newline = true
-trim_trailing_whitespace = true
diff --git a/template/.env.dist b/template/.env.dist
new file mode 100644
index 0000000..a539789
--- /dev/null
+++ b/template/.env.dist
@@ -0,0 +1,2 @@
+NODE_ENV="development"
+VUE_APP_SEED_KEY="seed"
diff --git a/template/.eslintignore b/template/.eslintignore
deleted file mode 100755
index 34af377..0000000
--- a/template/.eslintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build/*.js
-config/*.js
diff --git a/template/.eslintrc.js b/template/.eslintrc.js
deleted file mode 100755
index af09600..0000000
--- a/template/.eslintrc.js
+++ /dev/null
@@ -1,19 +0,0 @@
-module.exports = {
- root: true,
- parserOptions: {
- sourceType: 'module'
- },
- // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
- extends: 'standard',
- // required to lint *.vue files
- plugins: [
- 'html'
- ],
- // add your custom rules here
- 'rules': {
- // allow paren-less arrow functions
- 'arrow-parens': 0,
- // allow debugger during development
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
- }
-}
diff --git a/template/.gitignore b/template/.gitignore
old mode 100755
new mode 100644
index d4eea3a..f95fb1a
--- a/template/.gitignore
+++ b/template/.gitignore
@@ -1,6 +1,25 @@
.DS_Store
-node_modules/
-dist/
-npm-debug.log
-.cache/
-releases/
+node_modules
+/dist
+
+/tests/e2e/videos/
+/tests/e2e/screenshots/
+
+# local env files
+.env
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw*
diff --git a/template/README.md b/template/README.md
old mode 100755
new mode 100644
index 209c5f2..0860f83
--- a/template/README.md
+++ b/template/README.md
@@ -1,43 +1,98 @@
+[![version](https://img.shields.io/badge/version-1.0-green.svg?style=flat-square)](https://github.com/pierrechls/seed) [![front-end-framework](https://img.shields.io/badge/framework-vue.js-lightgrey.svg?style=flat-square)](http://vuejs.org/) [![router](https://img.shields.io/badge/router-vue--router-lightgrey.svg?style=flat-square)](http://router.vuejs.org/en/index.html) [![internationalization](https://img.shields.io/badge/internationalization-vue--i18n-lightgrey.svg?style=flat-square)](https://github.com/kazupon/vue-i18n) [![js-standard-style](https://img.shields.io/badge/code_style-standard-lightgrey.svg?style=flat-square)](http://standardjs.com/) [![sass-stylesheets](https://img.shields.io/badge/stylesheets-sass-lightgrey.svg?style=flat-square)](http://sass-lang.com/)
+
# {{ name }}
> {{ description }}
-[![version](https://img.shields.io/badge/version-1.0-green.svg?style=flat-square)](https://github.com/pierrechls/seed) [![front-end-framework](https://img.shields.io/badge/framework-vue.js-lightgrey.svg?style=flat-square)](http://vuejs.org/) [![router](https://img.shields.io/badge/router-vue--router-lightgrey.svg?style=flat-square)](http://router.vuejs.org/en/index.html) [![internationalization](https://img.shields.io/badge/internationalization-vue--i18n-lightgrey.svg?style=flat-square)](https://github.com/kazupon/vue-i18n) [![js-standard-style](https://img.shields.io/badge/code_style-standard-lightgrey.svg?style=flat-square)](http://standardjs.com/) [![sass-stylesheets](https://img.shields.io/badge/stylesheets-sass-lightgrey.svg?style=flat-square)](http://sass-lang.com/)
+# :grey_exclamation: Prior installation
+
+- [Node.js](https://nodejs.org/en/download/)
+- [Yarn](https://yarnpkg.com/lang/en/docs/install/)
+- [Vue CLI](https://cli.vuejs.org/guide/installation.html)
+
+# :rocket: How to install ?
+
+#### Clone the repo
+
+```bash
+$ git clone
+```
+
+#### Install dependencies
+
+```
+$ yarn install
+```
+
+# :hammer_and_wrench: How to configure ?
+
+#### Environnement settings
+
+Create _.env_ file by running :
+
+```bash
+$ cp .env.dist .env
+```
+
+#### Application settings
+
+Go to `/settings` folder and edit _default.json_ file.
+
+#### Locales
+
+Go to `/locales` folder.
+
+For adding a new languague :
+
+- Create a new _{lang}.json_ file
+- Go to `/src/lib/locales` and import your new locale file
+
+#### Install dependencies
+
+```
+$ yarn install
+```
+
+# :video_game: How to use it ?
+
+### Compiles and hot-reloads for development
+
+```
+$ yarn run serve
+```
+
+### Compiles and minifies for production
+
+```
+$ yarn run build
+```
+
+### Run your tests
+
+```
+$ yarn run test
+```
+
+### Lints and fixes files
-## Build Setup
-
-``` bash
-# install dependencies
-npm install
-
-# serve with hot reload at localhost:8080
-# -t (or --target=) option is optionnal and override the default webpack target
-npm start [-- -t {target}] # or `npm run dev`
-
-# launch electron and open a window at localhost:8080
-# you must have run the `npm run dev` command in an other terminal window
-# -s option is optionnal is used to add settings over the default settings
-npm run electron [-- -s {settings}]
-
-# build for production with minifications and package the app.
-npm run build
-{{#electron}}
-npm run build:darwin
-npm run build:linux
-npm run build:win32
-npm run build:all # All platforms, all architectures
-npm run build:no-package # Standalone build
-{{/electron}}
-# Note: use the -t (or --target=) option to override the default webpack target (https://webpack.github.io/docs/configuration.html#target). For example `npm run build -- -t web`.
-
-{{#electron}}
-# package a portable binary for a specific platform from the available build.
-npm run package # package for you current platform
-npm run package:darwin
-npm run package:linux
-npm run package:win32
-npm run package:all # All platforms, all architectures
-{{/electron}}
+```
+$ yarn run lint
+```
+
+### Run your end-to-end tests
+
+```
+$ yarn run test:e2e
```
+### Run your unit tests
+
+```
+$ yarn run test:unit
+```
+
+## :books: Documentation
+
For detailed explanation on how things work, checkout the [guide](http://pierrechls.github.io/seed).
+
+You can also see [Vue.js guide](https://vuejs.org/v2/guide/), [Vue CLI configuration reference](https://cli.vuejs.org/config/), [Vuex guide](https://vuex.vuejs.org/guide/) and [Vue i18n guide](https://kazupon.github.io/vue-i18n/guide/formatting.html).
diff --git a/template/babel.config.js b/template/babel.config.js
new file mode 100644
index 0000000..ba17966
--- /dev/null
+++ b/template/babel.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ presets: [
+ '@vue/app'
+ ]
+}
diff --git a/template/build/build.js b/template/build/build.js
deleted file mode 100755
index 96e34c8..0000000
--- a/template/build/build.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// https://github.com/shelljs/shelljs
-require('shelljs/global')
-env.NODE_ENV = 'production'
-
-var path = require('path')
-var config = require('../config/index')
-var ora = require('ora')
-var webpack = require('webpack')
-var webpackConfig = require('./webpack.prod.conf')
-
-console.log(
- {{#if electron}}
- ' Tip:\n' +
- ' Built files are not meant to be served over an HTTP server.\n' +
- ' You have to open index.html over file://\n'
- {{else}}
- ' Tip:\n' +
- ' Built files are meant to be served over an HTTP server.\n' +
- ' Opening index.html over file:// won\'t work.\n'
- {{/if}}
-)
-
-var spinner = ora({
- text:'building for production...',
- spinner: {
- interval: 60,
- frames: ['๐ฑ ', ' ๐ฑ ', ' ๐ฑ ', ' ๐ฟ ', ' ๐ฟ ', ' ๐ฟ ', ' ๐ณ ', ' ๐ณ ', ' ๐ณ']
- }
-})
-spinner.start()
-
-var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
-rm('-rf', assetsPath)
-mkdir('-p', assetsPath)
-cp('-R', 'static/', assetsPath)
-
-webpack(webpackConfig, function (err, stats) {
- spinner.stop()
- if (err) throw err
- process.stdout.write(stats.toString({
- colors: true,
- modules: false,
- children: false,
- chunks: false,
- chunkModules: false
- }) + '\n')
-})
diff --git a/template/build/dev-client.js b/template/build/dev-client.js
deleted file mode 100755
index 18aa1e2..0000000
--- a/template/build/dev-client.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* eslint-disable */
-require('eventsource-polyfill')
-var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
-
-hotClient.subscribe(function (event) {
- if (event.action === 'reload') {
- window.location.reload()
- }
-})
diff --git a/template/build/dev-server.js b/template/build/dev-server.js
deleted file mode 100755
index a6f55ba..0000000
--- a/template/build/dev-server.js
+++ /dev/null
@@ -1,83 +0,0 @@
-var path = require('path')
-var express = require('express')
-var webpack = require('webpack')
-var config = require('../config/index')
-var proxyMiddleware = require('http-proxy-middleware')
-var webpackConfig = require('./webpack.dev.conf')
-{{#if_eq electron false}}
-var opn = require('opn')
-{{/if_eq}}
-
-// default port where dev server listens for incoming traffic
-var port = process.env.PORT || config.dev.port
-// Define HTTP proxies to your custom API backend
-// https://github.com/chimurai/http-proxy-middleware
-var proxyTable = config.dev.proxyTable
-
-var app = express()
-var compiler = webpack(webpackConfig)
-
-var devMiddleware = require('webpack-dev-middleware')(compiler, {
- publicPath: webpackConfig.output.publicPath,
- stats: {
- colors: true,
- chunks: false
- }
-})
-
-var hotMiddleware = require('webpack-hot-middleware')(compiler)
-// force page reload when html-webpack-plugin template changes
-compiler.plugin('compilation', function (compilation) {
- compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
- hotMiddleware.publish({ action: 'reload' })
- cb()
- })
-})
-
-// proxy api requests
-Object.keys(proxyTable).forEach(function (context) {
- var options = proxyTable[context]
- if (typeof options === 'string') {
- options = { target: options }
- }
- app.use(proxyMiddleware(context, options))
-})
-
-// handle fallback for HTML5 history API
-app.use(require('connect-history-api-fallback')())
-
-// serve webpack bundle output
-app.use(devMiddleware)
-
-// enable hot-reload and state-preserving
-// compilation error display
-app.use(hotMiddleware)
-
-// serve pure static assets
-var staticPath = path.posix.join(config.build.assetsPublicPath, config.build.assetsSubDirectory)
-app.use(staticPath, express.static('./static'))
-
-const mfs = devMiddleware.fileSystem
-const file = path.join(webpackConfig.output.path, 'index.html')
-
-app.get('*', (req, res) => {
- devMiddleware.waitUntilValid(() => {
- const html = mfs.readFileSync(file)
- res.end(html)
- })
-})
-
-module.exports = app.listen(port, function (err) {
- if (err) {
- console.log(err)
- return
- }
- console.log('Listening at http://localhost:' + port + '\n')
- {{#if_eq electron false}}
- opn(`http://localhost:${port}`)
- {{/if_eq}}
-
- {{#electron}}
- require('child_process').exec('npm run electron')
- {{/electron}}
-})
diff --git a/template/build/package-electron.js b/template/build/package-electron.js
deleted file mode 100755
index 2b89791..0000000
--- a/template/build/package-electron.js
+++ /dev/null
@@ -1,38 +0,0 @@
-var path = require('path')
-var config = require('../config/index')
-var packager = require('electron-packager')
-var program = require('commander')
-
-var devDependencies = require('../package.json').devDependencies
-var electronVersion = null
-for(var dependency in devDependencies) {
- if(dependency === 'electron-prebuilt'){
- electronVersion = devDependencies[dependency]
- }
-}
-
-program
- .option(
- '-p --platform ',
- `Package destination platform. Default to '${require('os').platform()}'.`,
- /^(linux|darwin|win32|all)$/i,
- require('os').platform()
- ).parse(process.argv)
-
-const packageOptions = {
- dir: config.build.appRoot,
- out: config.build.packageDestination,
- name: config.build.name,
- 'app-version': config.build.version,
- ignore: config.build.ignoredPaths,
- prune: true,
- overwrite: true,
- platform: program.platform,
- arch: 'x64',
- version: electronVersion
-}
-
-packager(packageOptions, function (err, appPaths) {
- if (err) throw err
- console.log('\nDone packaging app.\nPaths to releases created:\n', appPaths)
-})
diff --git a/template/build/utils.js b/template/build/utils.js
deleted file mode 100755
index 2d27e4f..0000000
--- a/template/build/utils.js
+++ /dev/null
@@ -1,57 +0,0 @@
-var path = require('path')
-var config = require('../config/index')
-var ExtractTextPlugin = require('extract-text-webpack-plugin')
-
-exports.assetsPath = function (_path) {
- return path.posix.join(config.build.assetsSubDirectory, _path)
-}
-
-exports.cssLoaders = function (options) {
- options = options || {}
- // generate loader string to be used with extract text plugin
- function generateLoaders (loaders) {
- var sourceLoader = loaders.map(function (loader) {
- var extraParamChar
- if (/\?/.test(loader)) {
- loader = loader.replace(/\?/, '-loader?')
- extraParamChar = '&'
- } else {
- loader = loader + '-loader'
- extraParamChar = '?'
- }
- return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
- }).join('!')
-
- if (options.extract) {
- //return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
- return ExtractTextPlugin.extract('vue-style-loader', sourceLoader, {publicPath:'../'})
- } else {
- return ['vue-style-loader', sourceLoader].join('!')
- }
- }
-
- // http://vuejs.github.io/vue-loader/configurations/extract-css.html
- return {
- css: generateLoaders(['css']),
- postcss: generateLoaders(['css']),
- less: generateLoaders(['css', 'less']),
- sass: generateLoaders(['css', 'sass?indentedSyntax']),
- scss: generateLoaders(['css', 'sass']),
- stylus: generateLoaders(['css', 'stylus']),
- styl: generateLoaders(['css', 'stylus'])
- }
-}
-
-// Generate loaders for standalone style files (outside of .vue)
-exports.styleLoaders = function (options) {
- var output = []
- var loaders = exports.cssLoaders(options)
- for (var extension in loaders) {
- var loader = loaders[extension]
- output.push({
- test: new RegExp('\\.' + extension + '$'),
- loader: loader
- })
- }
- return output
-}
diff --git a/template/build/webpack.base.conf.js b/template/build/webpack.base.conf.js
deleted file mode 100755
index fec09f5..0000000
--- a/template/build/webpack.base.conf.js
+++ /dev/null
@@ -1,123 +0,0 @@
-var path = require('path')
-var config = require('../config/index')
-var utils = require('./utils')
-var projectRoot = path.resolve(__dirname, '../')
-var webpack = require('webpack')
-
-var program = require('commander')
-program
- .option('-t, --target [value]', 'bundle target.')
- .parse(process.argv)
-
-module.exports = {
- entry: {
- app: './src/main.js'
- },
- output: {
- path: config.build.assetsRoot,
- // this causes absolute path in builds, which makes them non-distribuable on an other machine
- // we may not need this in nd at all
- // so let's remove it on august, 22th 2016 if no one complains
- //publicPath: config.build.assetsPublicPath,
- filename: '[name].js'
- },
- target: program.target || {{#if electron}}'electron-renderer'{{else}}'web'{{/if}},
- resolve: {
- extensions: ['', '.js', '.vue'],
- fallback: [path.join(__dirname, '../node_modules')],
- alias: {
- 'src': path.resolve(__dirname, '../src'),
- 'assets': path.resolve(__dirname, '../src/assets'),
- 'components': path.resolve(__dirname, '../src/components'),
- 'views': path.resolve(__dirname, '../src/views'),
- 'settings': path.resolve(__dirname, '../settings'),
- 'locales': path.resolve(__dirname, '../locales'),
- 'data': path.resolve(__dirname, '../src/data'),
- 'lib': path.resolve(__dirname, '../src/lib')
- }
- },
- resolveLoader: {
- fallback: [path.join(__dirname, '../node_modules')]
- },
- vue: {
- autoprefixer: {
- browsers: ['last 2 versions']
- }
- },
- module: {
- {{#lint}}
- preLoaders: [
- {
- test: /\.vue$/,
- loader: 'eslint',
- include: projectRoot,
- exclude: /node_modules/
- },
- {
- test: /\.js$/,
- loader: 'eslint',
- include: projectRoot,
- exclude: /node_modules/
- }
- ],
- {{/lint}}
- loaders: [
- {
- test: /\.vue$/,
- loader: 'vue'
- },
- {
- test: /\.js$/,
- loader: 'babel',
- include: projectRoot,
- exclude: /node_modules/
- },
- {
- test: /\.json$/,
- loader: 'json'
- },
- {
- test: /\.html$/,
- loader: 'vue-html'
- },
- {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- loader: 'url',
- query: {
- limit: 10000,
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url',
- query: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
- }
- }
- ]
- },
- {{#lint}}
- eslint: {
- formatter: require('eslint-friendly-formatter')
- },
- {{/lint}}
- vue: {
- loaders: utils.cssLoaders()
- },
- plugins: [ new webpack.DefinePlugin({ 'global.GENTLY': false }) ],
- externals: [
- (function () {
- var IGNORES = [
- 'electron'
- ];
- return function (context, request, callback) {
- if (IGNORES.indexOf(request) >= 0) {
- return callback(null, "require('" + request + "')");
- }
- return callback();
- };
- })()
- ]
-}
diff --git a/template/build/webpack.dev.conf.js b/template/build/webpack.dev.conf.js
deleted file mode 100755
index 484ed64..0000000
--- a/template/build/webpack.dev.conf.js
+++ /dev/null
@@ -1,40 +0,0 @@
-var config = require('../config/index')
-var webpack = require('webpack')
-var merge = require('webpack-merge')
-var utils = require('./utils')
-var baseWebpackConfig = require('./webpack.base.conf')
-var HtmlWebpackPlugin = require('html-webpack-plugin')
-
-// add hot-reload related code to entry chunks
-Object.keys(baseWebpackConfig.entry).forEach(function (name) {
- baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
-})
-
-module.exports = merge(baseWebpackConfig, {
- {{#electron}}
- output: {
- publicPath: '/'
- },
- {{/electron}}
- module: {
- loaders: utils.styleLoaders()
- },
- // eval-source-map is faster for development
- devtool: '#eval-source-map',
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': config.dev.env
- }),
- // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
- new webpack.optimize.OccurenceOrderPlugin(),
- new webpack.HotModuleReplacementPlugin(),
- new webpack.NoErrorsPlugin(),
- // https://github.com/ampedandwired/html-webpack-plugin
- new HtmlWebpackPlugin({
- favicon: 'src/assets/images/favicon.png',
- filename: 'index.html',
- template: 'index.html',
- inject: true
- })
- ]
-})
diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js
deleted file mode 100755
index c28748f..0000000
--- a/template/build/webpack.prod.conf.js
+++ /dev/null
@@ -1,81 +0,0 @@
-var path = require('path')
-var config = require('../config/index')
-var utils = require('./utils')
-var webpack = require('webpack')
-var merge = require('webpack-merge')
-var baseWebpackConfig = require('./webpack.base.conf')
-var ExtractTextPlugin = require('extract-text-webpack-plugin')
-var HtmlWebpackPlugin = require('html-webpack-plugin')
-var env = config.build.env
-
-var webpackConfig = merge(baseWebpackConfig, {
- module: {
- loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true })
- },
- devtool: config.build.productionSourceMap ? '#source-map' : false,
- output: {
- path: config.build.assetsRoot,
- filename: utils.assetsPath('js/[name].[chunkhash].js'),
- chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
- },
- vue: {
- loaders: utils.cssLoaders({
- sourceMap: config.build.productionSourceMap,
- extract: true
- })
- },
- plugins: [
- // http://vuejs.github.io/vue-loader/workflow/production.html
- new webpack.DefinePlugin({
- 'process.env': env
- }),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- }
- }),
- new webpack.optimize.OccurenceOrderPlugin(),
- // extract css into its own file
- new ExtractTextPlugin(utils.assetsPath('css/[name].[contenthash].css')),
- // generate dist index.html with correct asset hash for caching.
- // you can customize output by editing /index.html
- // see https://github.com/ampedandwired/html-webpack-plugin
- new HtmlWebpackPlugin({
- favicon: 'src/assets/images/favicon.png',
- filename: config.build.index,
- template: 'index.html',
- inject: true,
- minify: {
- removeComments: true,
- collapseWhitespace: true,
- removeAttributeQuotes: true
- // more options:
- // https://github.com/kangax/html-minifier#options-quick-reference
- },
- // necessary to consistently work with multiple chunks via CommonsChunkPlugin
- chunksSortMode: 'dependency'
- }),
- // split vendor js into its own file
- new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor',
- minChunks: function (module, count) {
- // any required modules inside node_modules are extracted to vendor
- return (
- module.resource &&
- /\.js$/.test(module.resource) &&
- module.resource.indexOf(
- path.join(__dirname, '../node_modules')
- ) === 0
- )
- }
- }),
- // extract webpack runtime and module manifest to its own file in order to
- // prevent vendor hash from being updated whenever app bundle is updated
- new webpack.optimize.CommonsChunkPlugin({
- name: 'manifest',
- chunks: ['vendor']
- })
- ]
-})
-
-module.exports = webpackConfig
diff --git a/template/config/dev.env.js b/template/config/dev.env.js
deleted file mode 100755
index 0a147c5..0000000
--- a/template/config/dev.env.js
+++ /dev/null
@@ -1,16 +0,0 @@
-{{#if electron}}
-// Do not use `webpack-merge` since there is no devDependencies in packaged app
-{{else}}
-var merge = require('webpack-merge')
-{{/if}}
-var prodEnv = require('./prod.env')
-
-{{#if electron}}
-module.exports = Object.assign({}, prodEnv, {
- NODE_ENV: '"development"'
-})
-{{else}}
-module.exports = merge(prodEnv, {
- NODE_ENV: '"development"'
-})
-{{/if}}
diff --git a/template/config/index.js b/template/config/index.js
deleted file mode 100755
index e1656ab..0000000
--- a/template/config/index.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// see http://vuejs-templates.github.io/webpack for documentation.
-var path = require('path')
-var package = require('../package.json')
-
-module.exports = {
- build: {
- env: require('./prod.env'),
- index: path.resolve(__dirname, '../dist/index.html'),
- assetsRoot: path.resolve(__dirname, '../dist'),
- assetsSubDirectory: 'static',
- {{#if electron}}
- assetsPublicPath: path.resolve(__dirname, '../dist'),
- appRoot: path.resolve(__dirname, '../'),
- version: package.version,
- name: package.name,
- packageDestination: path.resolve(__dirname, '../releases'),
- ignoredPaths: (() => {
- const paths = [
- '^/src',
- '^/index.html',
- '^/static',
- '^/.cache',
- '^/README.md',
- '^/releases',
- '^/.babelrc',
- '^/.editorconfig',
- '^/.eslint',
- '^/.gitignore',
- '^/build'
- ]
-
- const regexps = paths.map((path) => {
- return new RegExp(path)
- })
- return regexps
- })(),
- {{else}}
- assetsPublicPath: '/',
- {{/if}}
- productionSourceMap: true
- },
- dev: {
- env: require('./dev.env'),
- port: 8080,
- proxyTable: {}
- }
-}
diff --git a/template/config/prod.env.js b/template/config/prod.env.js
deleted file mode 100755
index 773d263..0000000
--- a/template/config/prod.env.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- NODE_ENV: '"production"'
-}
diff --git a/template/cypress.json b/template/cypress.json
new file mode 100644
index 0000000..470c720
--- /dev/null
+++ b/template/cypress.json
@@ -0,0 +1,3 @@
+{
+ "pluginsFile": "tests/e2e/plugins/index.js"
+}
diff --git a/template/electron/main.js b/template/electron/main.js
deleted file mode 100755
index 4b27461..0000000
--- a/template/electron/main.js
+++ /dev/null
@@ -1,120 +0,0 @@
-const path = require('path')
-const config = require('../config/index')
-
-const electron = require('electron')
-// Module to control application life.
-const app = electron.app
-// Module to create native browser window.
-const BrowserWindow = electron.BrowserWindow
-// Modules to load settings
-const program = require('commander')
-
-// add some command line arguments
-app.commandLine.appendSwitch('--disable-pinch')
-app.commandLine.appendArgument('--overscroll-history-navigation=0')
-app.commandLine.appendArgument('--ignore-gpu-blacklist')
-app.commandLine.appendSwitch('remote-debugging-port', '8315')
-app.commandLine.appendSwitch('--disable-touch-adjustment')
-
-// get command line arguments
-if (process.argv.length > 1) {
- program
- // TODO: .version('0.0.1')
- .option('-s, --settings ', 'Set settings file path')
- .parse(process.argv)
-}
-
-// Settings loader
-let settings = null
-function loadSettings (filename) {
- function load (filename) {
- try {
- settings = require(path.resolve(filename))
- let settingsString = JSON.stringify(settings)
- process.env['SETTINGS'] = settingsString
- } catch (e) {
- if (e.code === 'ENOENT') {
- console.log('no file or directory named:', program.settings)
- } else {
- console.log('Error while loading:', program.settings)
- console.error(e)
- }
- }
- }
- if (filename) {
- load(filename)
- }
- // if no config is given let the app load default configs
-}
-
-// Keep a global reference of the window object, if you don't, the window will be closed automatically when the JavaScript object is garbage collected.
-let mainWindow
-
-function createWindow () {
- loadSettings(program.settings)
-
- const options = {
- width: 1920,
- height: 1080
- }
-
- if (process.env['NODE_ENV'] !== 'dev') {
- // Add kiosk settings to the window
- options.fullScreen = true
- } else {
- // Open dev tools and devtron in dev mode
- require('devtron').install()
-
- BrowserWindow.addDevToolsExtension(path.join(__dirname, '../node_modules/devtron'))
- let installExtension = require('electron-devtools-installer')
- installExtension.default(installExtension.VUEJS_DEVTOOLS)
- .then((name) => mainWindow.webContents.openDevTools())
- .catch((err) => console.log('An error occurred: ', err))
- }
-
- options.webPreferences = {
- plugins: true,
- directWrite: true,
- webSecurity: false,
- experimentalFeatures: false,
- experimentalCanvasFeatures: false,
- allowRunningInsecureContent: true,
- allowDisplayingInsecureContent: true
- }
-
- // Create the browser window.
- mainWindow = new BrowserWindow(options)
-
- if (process.env['NODE_ENV'] !== 'dev') {
- mainWindow.loadURL(`file://${config.build.index}`)
- } else {
- mainWindow.loadURL(`http://127.0.0.1:${config.dev.port}`)
- }
-
- // Emitted when the window is closed.
- mainWindow.on('closed', function () {
- // Dereference the window object, usually you would store windows in an array if your app supports multi windows, this is the time when you should delete the corresponding element.
- mainWindow = null
- })
-
- // Dirty hack to enable touch support
- setTimeout(function () {
- mainWindow.reload()
- }, 1000)
-}
-
-// This method will be called when Electron has finished initialization and is ready to create browser windows.
-// Some APIs can only be used after this event occurs.
-app.on('ready', createWindow)
-
-// Quit when all windows are closed.
-app.on('window-all-closed', function () {
- app.quit()
-})
-
-app.on('activate', function () {
- // On OS X it's common to re-create a window in the app when the dock icon is clicked and there are no other windows open.
- if (mainWindow === null) {
- createWindow()
- }
-})
diff --git a/template/index.html b/template/index.html
deleted file mode 100755
index 915e8a4..0000000
--- a/template/index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- {{ name }}
-
-
-
-
-
diff --git a/template/locales/en.json b/template/locales/en.json
new file mode 100644
index 0000000..0387bc1
--- /dev/null
+++ b/template/locales/en.json
@@ -0,0 +1,21 @@
+{
+ "menu": {
+ "home": "home",
+ "plant": "plant",
+ "garden": "garden"
+ },
+ "home": {
+ "title": "Welcome",
+ "text": "Please read the documentation
"
+ },
+ "plant": {
+ "title": "Plant",
+ "seedText": "seed planted'",
+ "seedsText": "seeds are planted"
+ },
+ "garden": {
+ "title": "Garden",
+ "noSeed": "You don't have planted seed"
+ }
+}
+
\ No newline at end of file
diff --git a/template/locales/en/index.js b/template/locales/en/index.js
deleted file mode 100644
index 85a90d4..0000000
--- a/template/locales/en/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-module.exports = {
- 'menu': {
- 'home': 'home',
- 'plant': 'plant',
- 'garden': 'garden'
- },
- 'home': {
- 'title': 'Welcome',
- 'text': 'Please read the documentation'
- },
- 'plant': {
- 'title': 'Plant',
- 'seedText': 'seed planted',
- 'seedsText': 'seeds are planted'
- },
- 'garden': {
- 'title': 'Garden',
- 'noSeed': 'You don\'t have planted seed'
- }
-}
diff --git a/template/locales/fr.json b/template/locales/fr.json
new file mode 100644
index 0000000..058c4ac
--- /dev/null
+++ b/template/locales/fr.json
@@ -0,0 +1,21 @@
+{
+ "menu": {
+ "home": "accueil",
+ "plant": "planter",
+ "garden": "jardin"
+ },
+ "home": {
+ "title": "Bienvenue",
+ "text": "Merci de lire la documentation"
+ },
+ "plant": {
+ "title": "Planter",
+ "seedText": "graรฎne plantรฉe",
+ "seedsText": "graรฎnes sont plantรฉes"
+ },
+ "garden": {
+ "title": "Jardin",
+ "noSeed": "Vous n'avez aucune graรฎne de plantรฉe"
+ }
+}
+
\ No newline at end of file
diff --git a/template/locales/fr/index.js b/template/locales/fr/index.js
deleted file mode 100644
index 63107ad..0000000
--- a/template/locales/fr/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-module.exports = {
- 'menu': {
- 'home': 'accueil',
- 'plant': 'planter',
- 'garden': 'jardin'
- },
- 'home': {
- 'title': 'Bienvenue',
- 'text': 'Merci de lire la documentation'
- },
- 'plant': {
- 'title': 'Planter',
- 'seedText': 'graรฎne plantรฉe',
- 'seedsText': 'graรฎnes sont plantรฉes'
- },
- 'garden': {
- 'title': 'Jardin',
- 'noSeed': 'Vous n\'avez aucune graรฎne de plantรฉe'
- }
-}
diff --git a/template/locales/index.js b/template/locales/index.js
deleted file mode 100644
index 4dac834..0000000
--- a/template/locales/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import Vue from 'vue'
-import VueI18n from 'vue-i18n'
-import store from 'src/store'
-
-Vue.use(VueI18n)
-Vue.config.lang = store.state.lang
-
-const locales = {
- fr: require('locales/fr'),
- en: require('locales/en')
-}
-
-Object.keys(locales).forEach(function (lang) {
- Vue.locale(lang, locales[lang])
-})
-
-store.subscribe((mutation, state) => {
- Vue.config.lang = state.lang
-})
diff --git a/template/package.json b/template/package.json
old mode 100755
new mode 100644
index 7c3aa97..c2db53b
--- a/template/package.json
+++ b/template/package.json
@@ -5,85 +5,33 @@
"author": "{{ author }}",
"private": true,
"scripts": {
- "start": "npm run dev",
- "dev": "node build/dev-server.js",
- "build": "node build/build.js{{#electron}} && npm run package{{/electron}}",
- {{#electron}}
- "build:darwin": "node build/build.js && npm run package:darwin",
- "build:linux": "node build/build.js && npm run package:linux",
- "build:win32": "node build/build.js && npm run package:win32",
- "build:all": "node build/build.js && npm run package:all",
- "build:no-package": "node build/build.js",
- "package": "node build/package-electron",
- "package:darwin": "node build/package-electron -p darwin",
- "package:linux": "node build/package-electron -p linux",
- "package:win32": "node build/package-electron -p win32",
- "package:all": "node build/package-electron -p all",
- "electron": "export NODE_ENV=\"dev\"; ./node_modules/.bin/electron .",
- {{/electron}}
- "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
- },
- {{#electron}}
- "main": "electron/main.js",
- {{/electron}}
- "standard": {
- "globals": [
- "TweenMax"
- ]
+ "serve": "vue-cli-service serve",
+ "build": "vue-cli-service build",
+ "lint": "vue-cli-service lint",
+ "test:e2e": "vue-cli-service test:e2e",
+ "test:unit": "vue-cli-service test:unit"
},
"dependencies": {
- "babel-runtime": "^6.0.0",
- "gsap": "^1.18.5",
- "node-sass": "^3.10.0",
- {{#if_eq electron false}}"opn": "^4.0.2",{{/if_eq}}
- "sass-loader": "^4.0.2",
- "vue": "^2.0.0",
- "vue-i18n": "^5.0.0",
- "vue-router": "^2.0.0",
- "vuex": "^2.0.0",
- "vuex-router-sync": "^3.0.0"
+ "vue": "^2.6.6",
+ "vue-class-component": "^6.0.0",
+ "vue-i18n": "^8.8.2",
+ "vue-property-decorator": "^7.0.0",
+ "vue-router": "^3.0.1",
+ "vuex": "^3.0.1"
},
"devDependencies": {
- "babel-core": "^6.0.0",
- "babel-loader": "^6.0.0",
- "babel-plugin-transform-runtime": "^6.0.0",
- "babel-preset-es2015": "^6.0.0",
- "babel-preset-stage-2": "^6.0.0",
- "connect-history-api-fallback": "^1.1.0",
- "css-loader": "^0.23.0",
- "commander": "^2.9.0",
- {{#electron}}
- "devtron": "^1.2.1",
- "electron-debug": "^1.0.1",
- "electron-devtools-installer": "^2.0.0",
- "electron-packager": "^7.3.0",
- "electron-prebuilt": "1.3.4",
- {{/electron}}
- "eslint": "^2.10.2",
- "eslint-friendly-formatter": "^2.0.5",
- "eslint-loader": "^1.3.0",
- "eslint-plugin-html": "^1.3.0",
- "eslint-config-standard": "^5.1.0",
- "eslint-plugin-promise": "^1.0.8",
- "eslint-plugin-standard": "^1.3.2",
- "eventsource-polyfill": "^0.9.6",
- "express": "^4.13.3",
- "extract-text-webpack-plugin": "^1.0.1",
- "file-loader": "^0.8.4",
- "function-bind": "^1.0.2",
- "html-webpack-plugin": "^2.8.1",
- "http-proxy-middleware": "^0.12.0",
- "json-loader": "^0.5.4",
- "ora": "^0.2.0",
- "shelljs": "^0.6.0",
- "url-loader": "^0.5.7",
- "vue-hot-reload-api": "^1.2.0",
- "vue-html-loader": "^1.0.0",
- "vue-loader": "^9.0.0",
- "vue-style-loader": "^1.0.0",
- "webpack": "^1.12.2",
- "webpack-dev-middleware": "^1.4.0",
- "webpack-hot-middleware": "^2.6.0",
- "webpack-merge": "^0.8.3"
+ "@types/chai": "^4.1.0",
+ "@types/mocha": "^5.2.4",
+ "@vue/cli-plugin-babel": "^3.4.0",
+ "@vue/cli-plugin-e2e-cypress": "^3.4.0",
+ "@vue/cli-plugin-typescript": "^3.4.0",
+ "@vue/cli-plugin-unit-mocha": "^3.4.0",
+ "@vue/cli-service": "^3.4.0",
+ "@vue/test-utils": "^1.0.0-beta.20",
+ "chai": "^4.1.2",
+ "node-sass": "^4.9.0",
+ "sass-loader": "^7.1.0",
+ "typescript": "^3.0.0",
+ "vue-template-compiler": "^2.5.21"
}
}
diff --git a/template/postcss.config.js b/template/postcss.config.js
new file mode 100644
index 0000000..961986e
--- /dev/null
+++ b/template/postcss.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ plugins: {
+ autoprefixer: {}
+ }
+}
diff --git a/template/public/favicon.ico b/template/public/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..9972c1eb431acee1efa54f1cefd0fa4040a26c61
GIT binary patch
literal 100575
zcmeI)v1`<49LMqJNVJj?$=vCNmJ8A$Lt0F_oD$K1grb6rpp$i|U@f9k39XCZAK=#2
zNpLJWC>b0aL@Ed(Dh@4(p-XYGRi9rHQ-@4_hHLq}e&o5k--YKc_q;#f&+l{J`{hdM
zmF=b5dZk~!8!P2xy}i7=zCXRAS02{;hQp2hy`{YUxL0Oo*7vV|R?1+h&g^gOPnB}-
z`(Bx<*WKft8ZYJi#a_Ae_0s;yiBBf#Lr*RqSUA-Ewi`RTr#^P}YJJYJ-HQu*j$C-O
z`r!KHPi1QS_D8==-kBXffAjjx^DjT&vov<#<-rU0_ucsR=fA%?diUlxzkPA*@L#`Q
zd3x^HA3tn+yub7h`mq9eEAVps^yTem`@ilwUQ4Mg?ps>8w)e!3)AjapcSo(Wt`OI^
zURl{$*2cyiWp-}xWMiz(&JW%i0c$WfSp9%I{%N|$KilW<$N!(>KL6+cod)E;6dmw?
z{?Gq&HK6`;*>}e{{PE}ixf)Rax$OCWHhcW>=l|Inz#o74KUV|lKbO7ym(3o3{P};j
z2JpvU{?FBb`p;!A|7EksAAkOztpWV;m;ZA$p#F2&%YWJI@yDP4XKMg|{N?{#4XFQI
z_VQmgd;Ia||JfSAAAk8jR|D!lm%aR#%^rXJ`G2+s@W)^N&((nX&t)(FWwXa0fBv7X
z0sQfo|8q5<{&U&Of7$Hu$DjXaYXE=z<^Nm_sQ+B{@?SQ4{PE}i*&4tffB8RG1L{AQ
zz5JKW9)JA#f3^nj$6x->)qwiXWiS6_v&SEQ{-3P@{PCCnb2Xs;bJ@#(+3fMhpZ{lT
z0Dt`D|6C2I|6KO+Up9OE@#p{98o(ca`9D_!>OYsg{FluhfBgA>wg&LWU;fY4fcnp6
zFaKq;#~*+GpRED>@t6N|HK6`;*~@>~?D5B+|7U9efBfbDTn(uIT=w!`HhcW>=l|In
zz#o74KUV|lKbO7ym(3o3{P};j2JpvU{?FBb`p;!A|7EksAAkOztpWV;m;ZA$p#F2&
z%YWJI@yGuI|1UNxUnk4Cv0O*5^y_8ahNZ0RTpw%u^^*{7~^uNM1
zApgie@{j(v{z{)hgD{&$uJis<=!gHbXrN^-
z|KUIM!+%;d&@z|*@E`i&KP?()nah9p5B>0;77et_t?N_Nw!~VmVzW;%zD1v6e(+~QpQ4*<{=e6%
N^`oDW)=#TRy#uiGjx7KH
literal 0
HcmV?d00001
diff --git a/template/public/index.html b/template/public/index.html
new file mode 100644
index 0000000..37b2daf
--- /dev/null
+++ b/template/public/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+ {{ name }}
+
+
+
+
+
+
+
diff --git a/template/settings/default.json b/template/settings/default.json
old mode 100644
new mode 100755
index 897bd4e..07a6ea9
--- a/template/settings/default.json
+++ b/template/settings/default.json
@@ -4,4 +4,4 @@
"max": 12
},
"lang": "en"
-}
+}
\ No newline at end of file
diff --git a/template/src/App.vue b/template/src/App.vue
index 6e8c4ad..c59a88f 100644
--- a/template/src/App.vue
+++ b/template/src/App.vue
@@ -7,23 +7,19 @@
-
-
-
+
+
diff --git a/template/src/components/LangSwitcher.vue b/template/src/components/LangSwitcher.vue
index 1b4da55..a9e929e 100644
--- a/template/src/components/LangSwitcher.vue
+++ b/template/src/components/LangSwitcher.vue
@@ -5,22 +5,19 @@
-
diff --git a/template/src/lib/locales/index.ts b/template/src/lib/locales/index.ts
new file mode 100644
index 0000000..b870414
--- /dev/null
+++ b/template/src/lib/locales/index.ts
@@ -0,0 +1,24 @@
+import Vue from 'vue';
+import VueI18n from 'vue-i18n';
+import store from '@/lib/store';
+
+import fr from 'locales/fr.json';
+import en from 'locales/en.json';
+
+Vue.use(VueI18n);
+
+const locales = {
+ fr,
+ en,
+};
+
+const i18n = new VueI18n({
+ locale: store.state.lang,
+ messages: locales,
+});
+
+store.subscribe((mutation, state) => {
+ i18n.locale = state.lang;
+});
+
+export default i18n;
diff --git a/template/src/lib/router/index.ts b/template/src/lib/router/index.ts
new file mode 100644
index 0000000..ec3df71
--- /dev/null
+++ b/template/src/lib/router/index.ts
@@ -0,0 +1,9 @@
+import Vue from 'vue';
+import Router from 'vue-router';
+import { routes } from './routes';
+
+Vue.use(Router);
+
+export default new Router({
+ routes,
+});
diff --git a/template/src/lib/router/routes.ts b/template/src/lib/router/routes.ts
new file mode 100644
index 0000000..296bddd
--- /dev/null
+++ b/template/src/lib/router/routes.ts
@@ -0,0 +1,25 @@
+import Home from '@/views/Home.vue';
+import Plant from '@/views/Plant.vue';
+import Garden from '@/views/Garden.vue';
+
+export const routes = [
+ {
+ path: '/',
+ name: 'Home',
+ component: Home,
+ },
+ {
+ path: '/home',
+ redirect: '/',
+ },
+ {
+ path: '/plant',
+ name: 'Plant',
+ component: Plant,
+ },
+ {
+ path: '/garden',
+ name: 'Garden',
+ component: Garden,
+ },
+];
diff --git a/template/src/lib/settings.js b/template/src/lib/settings.js
deleted file mode 100755
index 473c461..0000000
--- a/template/src/lib/settings.js
+++ /dev/null
@@ -1,52 +0,0 @@
-{{#electron}}
-// Try to load electron remote
-var remote = null
-try {
- remote = require('electron').remote
-} catch (e) {
- console.warn('app is not running in electron, loading default config')
-}
-
-{{/electron}}
-// List of settings to use
-let files = []
-try {
- // Load default settings
- files.push(require('./../../settings/default.json'))
-
- // Load more settings if you need
- // files.push(require('./../../settings/' + process.env.project + '.json'))
- {{#electron}}
-
- // If used in electron, load settings given as arg => ./myapp -- -s mySettings.json
- if (remote && remote.process.env['SETTINGS']) {
- console.log('loading custom settings')
- files.push(JSON.parse(remote.process.env['SETTINGS']))
- }
- {{/electron}}
-} catch (e) {
- console.warn('Unable to load settings', e)
-}
-
-// Override function
-function override (target, object) {
- for (var key of Object.keys(object)) {
- if (target[key] && typeof object[key] === 'object') {
- override(target[key], object[key])
- } else {
- target[key] = object[key]
- }
- }
-}
-
-// Load settings
-let settings = {}
-for (let f of files) {
- override(settings, f)
-}
-
-if (process.env['NODE_ENV'] === 'development') {
- console.log(settings)
-}
-
-module.exports = settings
diff --git a/template/src/lib/store/index.ts b/template/src/lib/store/index.ts
new file mode 100644
index 0000000..629a241
--- /dev/null
+++ b/template/src/lib/store/index.ts
@@ -0,0 +1,40 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import settings from 'settings/default.json';
+
+Vue.use(Vuex);
+
+const state = {
+ seed: settings.seed.default,
+ lang: settings.lang,
+};
+
+const mutations = {
+ PLANT(state: any, amount: number) {
+ state.seed = state.seed - amount;
+ },
+ PULL_UP(state: any, amount: number) {
+ state.seed = state.seed + amount;
+ },
+ TRANSLATE(state: any, lang: string) {
+ state.lang = lang;
+ },
+};
+
+const actions = {
+ plant({commit}: any) {
+ commit('PLANT', 1);
+ },
+ pullUp({commit}: any) {
+ commit('PULL_UP', 1);
+ },
+ translate({commit}: any, lang: string) {
+ commit('TRANSLATE', lang);
+ },
+};
+
+export default new Vuex.Store({
+ state,
+ mutations,
+ actions,
+});
diff --git a/template/src/main.js b/template/src/main.js
deleted file mode 100644
index f86f58d..0000000
--- a/template/src/main.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import Vue from 'vue'
-import App from 'src/App'
-
-// Import favicon
-import 'assets/images/favicon.png'
-
-// Global vue stuffs
-import 'gsap'
-import 'locales/index'
-
-// Routing
-import router from 'src/router'
-
-// Store
-import store from 'src/store'
-
-new Vue({
- el: '#app',
- router: router,
- store: store,
- render: h => h(App)
-})
diff --git a/template/src/main.ts b/template/src/main.ts
new file mode 100644
index 0000000..06ff386
--- /dev/null
+++ b/template/src/main.ts
@@ -0,0 +1,14 @@
+import Vue from 'vue';
+import App from './App.vue';
+import router from '@/lib/router';
+import store from '@/lib/store';
+import i18n from '@/lib/locales';
+
+Vue.config.productionTip = false;
+
+new Vue({
+ router,
+ store,
+ i18n,
+ render: (h) => h(App),
+}).$mount('#app');
diff --git a/template/src/router/index.js b/template/src/router/index.js
deleted file mode 100644
index 579b6a6..0000000
--- a/template/src/router/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import Vue from 'vue'
-import VueRouter from 'vue-router'
-import routes from './routes'
-
-Vue.use(VueRouter)
-
-export default new VueRouter({
- history: false,
- routes: routes
-})
diff --git a/template/src/router/routes.js b/template/src/router/routes.js
deleted file mode 100644
index 4294646..0000000
--- a/template/src/router/routes.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import Home from 'views/Home'
-import Plant from 'views/Plant'
-import Garden from 'views/Garden'
-
-module.exports = [
- {
- path: '/home',
- name: 'Home',
- component: Home,
- alias: '/'
- },
- {
- path: '/plant',
- name: 'Plant',
- component: Plant
- },
- {
- path: '/garden',
- name: 'Garden',
- component: Garden
- }
-]
diff --git a/template/src/shims-json.d.ts b/template/src/shims-json.d.ts
new file mode 100644
index 0000000..bbab69d
--- /dev/null
+++ b/template/src/shims-json.d.ts
@@ -0,0 +1,4 @@
+declare module '*.json' {
+ const value: any;
+ export default value;
+}
diff --git a/template/src/shims-tsx.d.ts b/template/src/shims-tsx.d.ts
new file mode 100644
index 0000000..3b88b58
--- /dev/null
+++ b/template/src/shims-tsx.d.ts
@@ -0,0 +1,13 @@
+import Vue, { VNode } from 'vue';
+
+declare global {
+ namespace JSX {
+ // tslint:disable no-empty-interface
+ interface Element extends VNode {}
+ // tslint:disable no-empty-interface
+ interface ElementClass extends Vue {}
+ interface IntrinsicElements {
+ [elem: string]: any;
+ }
+ }
+}
diff --git a/template/src/shims-vue.d.ts b/template/src/shims-vue.d.ts
new file mode 100644
index 0000000..8f6f410
--- /dev/null
+++ b/template/src/shims-vue.d.ts
@@ -0,0 +1,4 @@
+declare module '*.vue' {
+ import Vue from 'vue';
+ export default Vue;
+}
diff --git a/template/src/store/index.js b/template/src/store/index.js
deleted file mode 100644
index 7074b16..0000000
--- a/template/src/store/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import Vue from 'vue'
-import Vuex from 'vuex'
-
-import settings from 'lib/settings'
-
-Vue.use(Vuex)
-
-const state = {
- seed: settings.seed.default,
- lang: settings.lang
-}
-
-const mutations = {
- PLANT (state, amount) {
- state.seed = state.seed - amount
- },
- PULL_UP (state, amount) {
- state.seed = state.seed + amount
- },
- TRANSLATE (state, lang) {
- state.lang = lang
- }
-}
-
-const actions = {
- plant({commit}) {
- commit('PLANT', 1)
- },
- pullUp({commit}) {
- commit('PULL_UP', 1)
- },
- translate({commit}, lang) {
- commit('TRANSLATE', lang)
- }
-}
-
-const store = new Vuex.Store({
- state,
- mutations,
- actions
-})
-
-export default store
diff --git a/template/src/views/Garden.vue b/template/src/views/Garden.vue
index 9d77374..2a21466 100644
--- a/template/src/views/Garden.vue
+++ b/template/src/views/Garden.vue
@@ -1,19 +1,24 @@
-
![](~../assets/images/seed.svg)
+
-
diff --git a/template/src/views/Plant.vue b/template/src/views/Plant.vue
index 5fab42e..1822d3d 100644
--- a/template/src/views/Plant.vue
+++ b/template/src/views/Plant.vue
@@ -7,30 +7,27 @@
-
+