diff --git a/README.md b/README.md index ea4c750559..dd7b3a08fd 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This is a project template for [vue-cli](https://github.com/vuejs/vue-cli). **It ``` bash $ npm install -g vue-cli -$ vue init webpack my-project +$ vue init Seigiard/vue-webpack-eaht my-project $ cd my-project $ npm install $ npm run dev diff --git a/docs/README.md b/docs/README.md index dd31c1696f..e869e5df3c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,7 +10,7 @@ To use this template, scaffold a project with [vue-cli](https://github.com/vuejs ``` bash $ npm install -g vue-cli -$ vue init webpack my-project +$ vue init Seigiard/vue-webpack-eaht my-project $ cd my-project $ npm install $ npm run dev diff --git a/docs/structure.md b/docs/structure.md index 8daf54301b..9c49004e7d 100644 --- a/docs/structure.md +++ b/docs/structure.md @@ -8,7 +8,7 @@ │   ├── index.js # main project config │ └── ... ├── src/ -│   ├── main.js # app entry file +│   ├── index.js # app entry file │   ├── App.vue # main app component │   ├── components/ # ui components │   │   └── ... diff --git a/meta.js b/meta.js index e2e2fdffa1..f96bd259f3 100644 --- a/meta.js +++ b/meta.js @@ -40,10 +40,19 @@ module.exports = { } ] }, + "port": { + "type": "string", + "message": "What port for localhost (http://localhost:8080) do you want to use? ", + "default": 8080 + }, "router": { "type": "confirm", "message": "Install vue-router?" }, + "vuex": { + "type": "confirm", + "message": "Install vuex?" + }, "lint": { "type": "confirm", "message": "Use ESLint to lint your code?" @@ -54,15 +63,10 @@ module.exports = { "message": "Pick an ESLint preset", "choices": [ { - "name": "Standard (https://github.com/feross/standard)", + "name": "EAHT Standard", "value": "standard", "short": "Standard" }, - { - "name": "Airbnb (https://github.com/airbnb/javascript)", - "value": "airbnb", - "short": "Airbnb" - }, { "name": "none (configure it yourself)", "value": "none", @@ -86,7 +90,9 @@ module.exports = { "test/unit/**/*": "unit", "build/webpack.test.conf.js": "unit", "test/e2e/**/*": "e2e", - "src/router/**/*": "router" + "src/router/**/*": "router", + "src/store/**/*": "vuex", + "test/e2e/**/*": "e2e" }, "completeMessage": "To get started:\n\n {{^inPlace}}cd {{destDirName}}\n {{/inPlace}}npm install\n npm run dev\n\nDocumentation can be found at https://vuejs-templates.github.io/webpack" }; diff --git a/package.json b/package.json index 0d0a591880..410933b83a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "vue-cli-template-webpack", + "name": "vue-cli-template-eaht", "version": "2.0.0", "license": "MIT", "description": "A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.", diff --git a/template/.babelrc b/template/.babelrc index 13f0e47164..871bee763a 100644 --- a/template/.babelrc +++ b/template/.babelrc @@ -1,13 +1,13 @@ { "presets": [ ["env", { "modules": false }], - "stage-2" + "stage-3" ], "plugins": ["transform-runtime"], "comments": false, "env": { "test": { - "presets": ["env", "stage-2"], + "presets": ["env", "stage-3"], "plugins": [ "istanbul" ] } } diff --git a/template/.eslintrc.js b/template/.eslintrc.js index 00b5b5717a..1d83823804 100644 --- a/template/.eslintrc.js +++ b/template/.eslintrc.js @@ -4,51 +4,26 @@ module.exports = { root: true, parser: 'babel-eslint', parserOptions: { + ecmaVersion: 2016, sourceType: 'module' }, env: { + es6: true, browser: true, }, {{#if_eq lintConfig "standard"}} - // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style - extends: 'standard', - {{/if_eq}} - {{#if_eq lintConfig "airbnb"}} - extends: 'airbnb-base', + extends: [ + 'eaht' + ], {{/if_eq}} // required to lint *.vue files plugins: [ - 'html' + 'html', + 'vue' ], - {{#if_eq lintConfig "airbnb"}} - // check if imports actually resolve - 'settings': { - 'import/resolver': { - 'webpack': { - 'config': 'build/webpack.base.conf.js' - } - } - }, - {{/if_eq}} // add your custom rules here 'rules': { - {{#if_eq lintConfig "standard"}} - // allow paren-less arrow functions - 'arrow-parens': 0, - // allow async-await - 'generator-star-spacing': 0, - {{/if_eq}} - {{#if_eq lintConfig "airbnb"}} - // don't require .vue extension when importing - 'import/extensions': ['error', 'always', { - 'js': 'never', - 'vue': 'never' - }], - // allow optionalDependencies - 'import/no-extraneous-dependencies': ['error', { - 'optionalDependencies': ['test/unit/index.js'] - }], - {{/if_eq}} + 'vue/jsx-uses-vars': 2, // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 } diff --git a/template/.gitignore b/template/.gitignore index 1ecac1d283..894766dd44 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.idea/ node_modules/ dist/ npm-debug.log* diff --git a/template/.postcssrc.js b/template/.postcssrc.js index ea9a5ab875..5e88c064b0 100644 --- a/template/.postcssrc.js +++ b/template/.postcssrc.js @@ -3,6 +3,14 @@ module.exports = { "plugins": { // to edit target browsers: use "browserlist" field in package.json - "autoprefixer": {} + "postcss-import": { + path: ['src/assets/css/'] + }, + "postcss-cssnext": { + features: { + colorRgba: false, + rem: false + } + } } } diff --git a/template/build/webpack.base.conf.js b/template/build/webpack.base.conf.js index 0f161198d4..7e94ffe846 100644 --- a/template/build/webpack.base.conf.js +++ b/template/build/webpack.base.conf.js @@ -9,7 +9,7 @@ function resolve (dir) { module.exports = { entry: { - app: './src/main.js' + app: './src/index.js' }, output: { path: config.build.assetsRoot, @@ -32,12 +32,14 @@ module.exports = { {{#lint}} { test: /\.(js|vue)$/, - loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], - options: { - formatter: require('eslint-friendly-formatter') - } + use: [{ + loader: 'eslint-loader', + options: { + formatter: require('eslint-friendly-formatter') + } + }] }, {{/lint}} { @@ -47,24 +49,30 @@ module.exports = { }, { test: /\.js$/, - loader: 'babel-loader', - include: [resolve('src'), resolve('test')] + include: [resolve('src'), resolve('test')], + use: [{ + loader: 'babel-loader' + }] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, - loader: 'url-loader', - options: { - limit: 10000, - name: utils.assetsPath('img/[name].[hash:7].[ext]') - } + use: [{ + loader: 'url-loader', + options: { + limit: 10000, + name: utils.assetsPath('img/[name].[hash:7].[ext]') + } + }] }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, - loader: 'url-loader', - options: { - limit: 10000, - name: utils.assetsPath('fonts/[name].[hash:7].[ext]') - } + use: [{ + loader: 'url-loader', + options: { + limit: 10000, + name: utils.assetsPath('fonts/[name].[hash:7].[ext]') + } + }] } ] } diff --git a/template/config/index.js b/template/config/index.js index 196da1fa7d..d974cfb1f1 100644 --- a/template/config/index.js +++ b/template/config/index.js @@ -23,7 +23,7 @@ module.exports = { }, dev: { env: require('./dev.env'), - port: 8080, + port: {{ port }}, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', @@ -33,6 +33,6 @@ module.exports = { // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. - cssSourceMap: false + cssSourceMap: true } } diff --git a/template/package.json b/template/package.json index ae104e7928..570c6e58ae 100644 --- a/template/package.json +++ b/template/package.json @@ -11,14 +11,18 @@ "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run"{{/unit}}{{#e2e}}, "e2e": "node test/e2e/runner.js"{{/e2e}}{{#if_or unit e2e}}, "test": "{{#unit}}npm run unit{{/unit}}{{#unit}}{{#e2e}} && {{/e2e}}{{/unit}}{{#e2e}}npm run e2e{{/e2e}}"{{/if_or}}{{#lint}}, - "lint": "eslint --ext .js,.vue src{{#unit}} test/unit/specs{{/unit}}{{#e2e}} test/e2e/specs{{/e2e}}"{{/lint}} + "lint": "eslint --ext .js,.vue src{{#unit}} test/unit/specs{{/unit}}{{#e2e}} test/e2e/specs{{/e2e}}", + "fixJs": "eslint --fix --ext .js,.vue src{{#unit}} test/unit/specs{{/unit}}{{#e2e}} test/e2e/specs{{/e2e}}"{{/lint}} }, "dependencies": { - "vue": "^2.2.6"{{#router}}, - "vue-router": "^2.3.1"{{/router}} + "vue": "^2.3.3"{{#router}}, + "vue-router": "^2.3.1"{{/router}}{{#vuex}}, + "vuex": "^2.3.1", + "vuex-persistedstate": "^1.1.0", + "vuex-router-sync": "^4.1.2"{{/vuex}} }, "devDependencies": { - "autoprefixer": "^6.7.2", + "autoprefixer": "^7.0.0", "babel-core": "^6.22.1", {{#lint}} "babel-eslint": "^7.1.1", @@ -26,26 +30,22 @@ "babel-loader": "^6.2.10", "babel-plugin-transform-runtime": "^6.22.0", "babel-preset-env": "^1.3.2", - "babel-preset-stage-2": "^6.22.0", + "babel-preset-stage-3": "^6.22.0", "babel-register": "^6.22.0", "chalk": "^1.1.3", "connect-history-api-fallback": "^1.3.0", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.28.0", + "postcss-cssnext": "^2.11.0", + "postcss-import": "^10.0.0", {{#lint}} "eslint": "^3.19.0", "eslint-friendly-formatter": "^2.0.7", "eslint-loader": "^1.7.1", "eslint-plugin-html": "^2.0.0", + "eslint-plugin-vue": "^2.0.1", {{#if_eq lintConfig "standard"}} - "eslint-config-standard": "^6.2.1", - "eslint-plugin-promise": "^3.4.0", - "eslint-plugin-standard": "^2.0.1", - {{/if_eq}} - {{#if_eq lintConfig "airbnb"}} - "eslint-config-airbnb-base": "^11.1.3", - "eslint-import-resolver-webpack": "^0.8.1", - "eslint-plugin-import": "^2.2.0", + "eslint-config-eaht": "git+https://github.com/Seigiard/eslint-config-eaht.git", {{/if_eq}} {{/lint}} "eventsource-polyfill": "^0.9.6", @@ -57,7 +57,10 @@ "http-proxy-middleware": "^0.17.3", "webpack-bundle-analyzer": "^2.2.1", {{#unit}} + "babel-plugin-istanbul": "^4.1.1", + "chai": "^3.5.0", "cross-env": "^4.0.0", + "inject-loader": "^3.0.0", "karma": "^1.4.1", "karma-coverage": "^1.1.1", "karma-mocha": "^1.3.0", @@ -69,12 +72,9 @@ "karma-webpack": "^2.0.2", "lolex": "^1.5.2", "mocha": "^3.2.0", - "chai": "^3.5.0", + "phantomjs-prebuilt": "^2.1.14", "sinon": "^2.1.0", "sinon-chai": "^2.8.0", - "inject-loader": "^3.0.0", - "babel-plugin-istanbul": "^4.1.1", - "phantomjs-prebuilt": "^2.1.14", {{/unit}} {{#e2e}} "chromedriver": "^2.27.2", diff --git a/template/src/App.vue b/template/src/App.vue index 74a25d1dfa..aecff930d2 100644 --- a/template/src/App.vue +++ b/template/src/App.vue @@ -11,15 +11,14 @@