diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000000..97626ba454
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000..e5921a7e27
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000..94a25f7f4c
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/webpack.iml b/.idea/webpack.iml
new file mode 100644
index 0000000000..24643cc374
--- /dev/null
+++ b/.idea/webpack.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000000..74a4c14e9e
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,691 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1541488928687
+
+
+ 1541488928687
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 476c8224a2..6b4fea47e6 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,17 @@
> This template is Vue 2.0 compatible. For Vue 1.x use this command: `vue init webpack#1.0 my-project`
+
+# Vue-cli 3 is here, so this template is now considered deprecated.
+
+This template was the main template for vue-cli verison 2.*.
+
+Now that we have released a [stable version of vue-cli 3](https://cli.vuejs.org), which incorporates all features that this template offers (and much more), we think that this template doesn't have any significant use for the future, so we won't put much resource in developing it further.
+
+We will try and fix major issues should they arise, but not much more.
+
+Feel free to fork this template if you want to keep it alive.
+
## Documentation
- [For this template](http://vuejs-templates.github.io/webpack): common questions specific to this template are answered and each part is described in greater detail
diff --git a/docs/backend.md b/docs/backend.md
index e7acadf7c5..ecbc99592a 100644
--- a/docs/backend.md
+++ b/docs/backend.md
@@ -11,7 +11,7 @@ const path = require('path')
module.exports = {
dev: {
- / Paths
+ // Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
diff --git a/docs/env.md b/docs/env.md
index 600ddb94f6..076d2a0636 100644
--- a/docs/env.md
+++ b/docs/env.md
@@ -42,10 +42,10 @@ So, the environment variables are:
As we can see, `test.env` inherits the `dev.env` and the `dev.env` inherits the `prod.env`.
-### Usage
+### Usage
-It is simple to use the environment variables in your code. For example:
+It is simple to use the environment variables in your code. For example:
-```js
-Vue.config.productionTip = process.env.NODE_ENV === 'production'
+```js
+Vue.config.productionTip = process.env.NODE_ENV === 'production'
```
diff --git a/docs/linter.md b/docs/linter.md
index 478c1a111d..9bc51a1061 100644
--- a/docs/linter.md
+++ b/docs/linter.md
@@ -31,5 +31,6 @@ You can run the following command to let eslint fix any errors it finds (if it c
npm run lint -- --fix
```
-*(The `--` in the middle is necessary to ensure the `--fix` option is passdd to `eslint`, not to `npm`. It can be omitted whne using yarn)*
+*(The `--` in the middle is necessary to ensure the `--fix` option is passed to `eslint`, not to `npm`. It can be omitted when using yarn)*
+
diff --git a/docs/pre-processors.md b/docs/pre-processors.md
index fa58751e32..c99604e5a5 100644
--- a/docs/pre-processors.md
+++ b/docs/pre-processors.md
@@ -1,6 +1,6 @@
# Pre-Processors
-This boilerplate has pre-configured CSS extraction for most popular CSS pre-processors including LESS, SASS, Stylus, and PostCSS. To use a pre-processor, all you need to do is install the appropriate webpack loader for it. For example, to use SASS:
+This boilerplate has pre-configured CSS extraction for most popular CSS pre-processors including LESS, Sass, Stylus, and PostCSS. To use a pre-processor, all you need to do is install the appropriate webpack loader for it. For example, to use Sass:
``` bash
npm install sass-loader node-sass --save-dev
@@ -14,11 +14,11 @@ Once installed, you can use the pre-processors inside your `*.vue` components us
``` html
```
-### A note on SASS syntax
+### A note on Sass syntax
- `lang="scss"` corresponds to the CSS-superset syntax (with curly braces and semicolons).
- `lang="sass"` corresponds to the indentation-based syntax.
@@ -27,7 +27,7 @@ Once installed, you can use the pre-processors inside your `*.vue` components us
Styles in `*.vue` files and style files (`*.css`, `*.scss` etc) are piped through PostCSS by default, so you don't need to use a specific loader for it.
-You can simply add PostCSS plugins you want to use to the `.postcssrc.js`file in your project's root directory:
+You can simply add PostCSS plugins you want to use to the `.postcssrc.js` file in your project's root directory:
``` js
// https://github.com/michael-ciniawsky/postcss-load-config
diff --git a/docs/structure.md b/docs/structure.md
index 75c958a42f..341a51614b 100644
--- a/docs/structure.md
+++ b/docs/structure.md
@@ -21,8 +21,8 @@
│ │ ├── eslintrc # config file for eslint with extra settings only for unit tests
│ │ ├── index.js # test build entry file
│ │ ├── jest.conf.js # Config file when using Jest for unit tests
-│ │ └── karma.conf.js # test runner config file when using Karma for unit tests
-│ │ ├── setup.js # file that runs before Jest runs your unit tests
+│ │ ├── karma.conf.js # test runner config file when using Karma for unit tests
+│ │ └── setup.js # file that runs before Jest runs your unit tests
│ └── e2e/ # e2e tests
│ │ ├── specs/ # test spec files
│ │ ├── custom-assertions/ # custom assertions for e2e tests
diff --git a/meta.js b/meta.js
index a521f9bdd0..c100681c2a 100644
--- a/meta.js
+++ b/meta.js
@@ -50,126 +50,7 @@ module.exports = {
when: 'isNotTest',
type: 'string',
message: 'Author',
- },
- build: {
- when: 'isNotTest',
- type: 'list',
- message: 'Vue build',
- choices: [
- {
- name: 'Runtime + Compiler: recommended for most users',
- value: 'standalone',
- short: 'standalone',
- },
- {
- name:
- 'Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required elsewhere',
- value: 'runtime',
- short: 'runtime',
- },
- ],
- },
- router: {
- when: 'isNotTest',
- type: 'confirm',
- message: 'Install vue-router?',
- },
- lint: {
- when: 'isNotTest',
- type: 'confirm',
- message: 'Use ESLint to lint your code?',
- },
- lintConfig: {
- when: 'isNotTest && lint',
- type: 'list',
- message: 'Pick an ESLint preset',
- choices: [
- {
- name: 'Standard (https://github.com/standard/standard)',
- value: 'standard',
- short: 'Standard',
- },
- {
- name: 'Airbnb (https://github.com/airbnb/javascript)',
- value: 'airbnb',
- short: 'Airbnb',
- },
- {
- name: 'none (configure it yourself)',
- value: 'none',
- short: 'none',
- },
- ],
- },
- unit: {
- when: 'isNotTest',
- type: 'confirm',
- message: 'Set up unit tests',
- },
- runner: {
- when: 'isNotTest && unit',
- type: 'list',
- message: 'Pick a test runner',
- choices: [
- {
- name: 'Jest',
- value: 'jest',
- short: 'jest',
- },
- {
- name: 'Karma and Mocha',
- value: 'karma',
- short: 'karma',
- },
- {
- name: 'none (configure it yourself)',
- value: 'noTest',
- short: 'noTest',
- },
- ],
- },
- e2e: {
- when: 'isNotTest',
- type: 'confirm',
- message: 'Setup e2e tests with Nightwatch?',
- },
- autoInstall: {
- when: 'isNotTest',
- type: 'list',
- message:
- 'Should we run `npm install` for you after the project has been created? (recommended)',
- choices: [
- {
- name: 'Yes, use NPM',
- value: 'npm',
- short: 'npm',
- },
- {
- name: 'Yes, use Yarn',
- value: 'yarn',
- short: 'yarn',
- },
- {
- name: 'No, I will handle that myself',
- value: false,
- short: 'no',
- },
- ],
- },
- },
- filters: {
- '.eslintrc.js': 'lint',
- '.eslintignore': 'lint',
- 'config/test.env.js': 'unit || e2e',
- 'build/webpack.test.conf.js': "unit && runner === 'karma'",
- 'test/unit/**/*': 'unit',
- 'test/unit/index.js': "unit && runner === 'karma'",
- 'test/unit/jest.conf.js': "unit && runner === 'jest'",
- 'test/unit/karma.conf.js': "unit && runner === 'karma'",
- 'test/unit/specs/index.js': "unit && runner === 'karma'",
- 'test/unit/setup.js': "unit && runner === 'jest'",
- 'test/e2e/**/*': 'e2e',
- 'src/router/**/*': 'router',
+ }
},
complete: function(data, { chalk }) {
const green = chalk.green
diff --git a/scenarios/README.md b/scenarios/README.md
index 3ead3f9b8b..2fcacaf077 100644
--- a/scenarios/README.md
+++ b/scenarios/README.md
@@ -8,11 +8,11 @@ With the code from `index.js`, we insert those answers into the metalsmith metad
## The scenarios
-We currently have 3 scenrios set up:
+We currently have 3 scenarios set up:
-1. 'minimal': it basically answers "no" to ever choice, so no router, no elint, no tests
+1. 'minimal': it basically answers "no" to ever choice, so no router, no eslint, no tests
2. 'full': It answers "yes" to every choice. With router, with linting (standard), with full tests (jest & e2e)
-3. 'full-airbnb-karma': like 'full', but using airbnb eslint config instead od standard and karma instead of jest for unnit tests.
+3. 'full-airbnb-karma': like 'full', but using airbnb eslint config instead of standard and karma instead of jest for unit tests.
Other permutations might be worth testing to secure against edge cases, but this gives us a decent level of security over common combinations.
diff --git a/template/.babelrc b/template/.babelrc
index 6646ce7f96..3a280ba34b 100644
--- a/template/.babelrc
+++ b/template/.babelrc
@@ -8,12 +8,5 @@
}],
"stage-2"
],
- "plugins": ["transform-vue-jsx", "transform-runtime"]{{#if_or unit e2e}},
- "env": {
- "test": {
- "presets": ["env", "stage-2"]{{#if_eq runner "karma"}},
- "plugins": ["transform-vue-jsx", "istanbul"]{{/if_eq}}{{#if_eq runner "jest"}},
- "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]{{/if_eq}}
- }
- }{{/if_or}}
+ "plugins": ["transform-vue-jsx", "transform-runtime"]
}
diff --git a/template/.eslintignore b/template/.eslintignore
index ef5bd37d05..e1fcc9c45f 100644
--- a/template/.eslintignore
+++ b/template/.eslintignore
@@ -2,6 +2,3 @@
/config/
/dist/
/*.js
-{{#unit}}
-/test/unit/coverage/
-{{/unit}}
diff --git a/template/.eslintrc.js b/template/.eslintrc.js
index 30593179e2..22fdce865a 100644
--- a/template/.eslintrc.js
+++ b/template/.eslintrc.js
@@ -8,7 +8,6 @@ module.exports = {
env: {
browser: true,
},
- {{#if_eq lintConfig "standard"}}
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
@@ -16,58 +15,14 @@ module.exports = {
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
- {{/if_eq}}
- {{#if_eq lintConfig "airbnb"}}
- // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
- // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
- extends: ['plugin:vue/essential', 'airbnb-base'],
- {{/if_eq}}
- {{#if_eq lintConfig "none"}}
- // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
- // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
- extends: ['plugin:vue/essential'],
- {{/if_eq}}
// required to lint *.vue files
plugins: [
'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 async-await
'generator-star-spacing': 'off',
- {{/if_eq}}
- {{#if_eq lintConfig "airbnb"}}
- // don't require .vue extension when importing
- 'import/extensions': ['error', 'always', {
- js: 'never',
- vue: 'never'
- }],
- // disallow reassignment of function parameters
- // disallow parameter object manipulation except for specific exclusions
- 'no-param-reassign': ['error', {
- props: true,
- ignorePropertyModificationsFor: [
- 'state', // for vuex state
- 'acc', // for reduce accumulators
- 'e' // for e.returnvalue
- ]
- }],
- // allow optionalDependencies
- 'import/no-extraneous-dependencies': ['error', {
- optionalDependencies: ['test/unit/index.js']
- }],
- {{/if_eq}}
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
diff --git a/template/.gitignore b/template/.gitignore
index c80b682e18..541a820f6c 100644
--- a/template/.gitignore
+++ b/template/.gitignore
@@ -4,13 +4,6 @@ node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
-{{#unit}}
-/test/unit/coverage/
-{{/unit}}
-{{#e2e}}
-/test/e2e/reports/
-selenium-debug.log
-{{/e2e}}
# Editor directories and files
.idea
diff --git a/template/README.md b/template/README.md
index 4b0258a35b..331cd1783e 100644
--- a/template/README.md
+++ b/template/README.md
@@ -1,6 +1,6 @@
-# {{ name }}
+# pagoda-template-1
-> {{ description }}
+> A Vue.js project
## Build Setup
@@ -16,21 +16,6 @@ npm run build
# build for production and view the bundle analyzer report
npm run build --report
-{{#unit}}
-
-# run unit tests
-npm run unit
-{{/unit}}
-{{#e2e}}
-
-# run e2e tests
-npm run e2e
-{{/e2e}}
-{{#if_or unit e2e}}
-
-# run all tests
-npm test
-{{/if_or}}
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
diff --git a/template/build/webpack.base.conf.js b/template/build/webpack.base.conf.js
index 391160c571..de41339274 100644
--- a/template/build/webpack.base.conf.js
+++ b/template/build/webpack.base.conf.js
@@ -3,12 +3,18 @@ const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
+// 此处为添加的配置
+const fs = require('fs')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
-{{#lint}}const createLintingRule = () => ({
+//此处为添加的配置
+let pagodaUiDirsName = fs.readdirSync(resolve('node_modules')).filter(dirName => /pagoda-ui/.test(dirName) || /pagoda-ui-test/.test(dirName))
+const includesDir = pagodaUiDirsName.map(dir => resolve(`node_modules/${dir}/src`))
+
+const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
@@ -17,7 +23,7 @@ function resolve (dir) {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
-}){{/lint}}
+})
module.exports = {
context: path.resolve(__dirname, '../'),
@@ -34,17 +40,13 @@ module.exports = {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
- {{#if_eq build "standalone"}}
'vue$': 'vue/dist/vue.esm.js',
- {{/if_eq}}
'@': resolve('src'),
}
},
module: {
rules: [
- {{#lint}}
...(config.dev.useEslint ? [createLintingRule()] : []),
- {{/lint}}
{
test: /\.vue$/,
loader: 'vue-loader',
@@ -53,7 +55,7 @@ module.exports = {
{
test: /\.js$/,
loader: 'babel-loader',
- include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
+ include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client'), ...includesDir]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js
index fc5d53fa3d..d9f99f65a5 100644
--- a/template/build/webpack.prod.conf.js
+++ b/template/build/webpack.prod.conf.js
@@ -11,9 +11,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
-const env = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'
- ? require('../config/test.env')
- : {{/if_or}}require('../config/prod.env')
+const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
@@ -63,9 +61,7 @@ const webpackConfig = merge(baseWebpackConfig, {
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
- filename: {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'
- ? 'index.html'
- : {{/if_or}}config.build.index,
+ filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
diff --git a/template/build/webpack.test.conf.js b/template/build/webpack.test.conf.js
deleted file mode 100644
index 0d658d9ebe..0000000000
--- a/template/build/webpack.test.conf.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict'
-// This is the webpack config used for unit tests.
-
-const utils = require('./utils')
-const webpack = require('webpack')
-const merge = require('webpack-merge')
-const baseWebpackConfig = require('./webpack.base.conf')
-
-const webpackConfig = merge(baseWebpackConfig, {
- // use inline sourcemap for karma-sourcemap-loader
- module: {
- rules: utils.styleLoaders()
- },
- devtool: '#inline-source-map',
- resolveLoader: {
- alias: {
- // necessary to to make lang="scss" work in test when using vue-loader's ?inject option
- // see discussion at https://github.com/vuejs/vue-loader/issues/724
- 'scss-loader': 'sass-loader'
- }
- },
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': require('../config/test.env')
- })
- ]
-})
-
-// no need for app entry during tests
-delete webpackConfig.entry
-
-module.exports = webpackConfig
diff --git a/template/config/index.js b/template/config/index.js
index 820109957f..c143e62af8 100644
--- a/template/config/index.js
+++ b/template/config/index.js
@@ -1,5 +1,5 @@
'use strict'
-// Template version: {{ template_version }}
+// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
@@ -13,21 +13,20 @@ module.exports = {
proxyTable: {},
// Various Dev Server settings
- host: 'localhost', // can be overwritten by process.env.HOST
+ host: '0.0.0.0', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
- autoOpenBrowser: false,
+ autoOpenBrowser: true,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
- {{#lint}}// Use Eslint Loader?
+ // Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
- {{/lint}}
/**
* Source Maps
diff --git a/template/config/test.env.js b/template/config/test.env.js
deleted file mode 100644
index c2824a307a..0000000000
--- a/template/config/test.env.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-const merge = require('webpack-merge')
-const devEnv = require('./dev.env')
-
-module.exports = merge(devEnv, {
- NODE_ENV: '"testing"'
-})
diff --git a/template/index.html b/template/index.html
index 6cfaafc7a8..73b4f1a787 100644
--- a/template/index.html
+++ b/template/index.html
@@ -3,7 +3,9 @@
- {{ name }}
+
+
+ pagoda-template-1
diff --git a/template/package.json b/template/package.json
index 60b5ee202a..a6d1196b01 100644
--- a/template/package.json
+++ b/template/package.json
@@ -1,89 +1,25 @@
{
- "name": "{{ name }}",
+ "name": "pagoda-template-1",
"version": "1.0.0",
- "description": "{{ description }}",
- "author": "{{ author }}",
+ "description": "A Vue.js project",
+ "author": "陈康 <672247608@qq.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
- {{#if_eq runner "jest"}}
- "unit": "jest --config test/unit/jest.conf.js --coverage",
- {{/if_eq}}
- {{#if_eq runner "karma"}}
- "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
- {{/if_eq}}
- {{#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{{/unit}}{{#e2e}} test/e2e/specs{{/e2e}}",
- {{/lint}}
+ "lint": "eslint --ext .js,.vue src",
"build": "node build/build.js"
},
"dependencies": {
- "vue": "^2.5.2"{{#router}},
- "vue-router": "^3.0.1"{{/router}}
+ "element-ui": "2.3.9",
+ "pagoda-ui": "^1.3.11",
+ "vue": "2.5.9",
+ "vue-router": "^3.0.1"
},
"devDependencies": {
- {{#lint}}
- "babel-eslint": "^8.2.1",
- "eslint": "^4.15.0",
- "eslint-friendly-formatter": "^3.0.0",
- "eslint-loader": "^1.7.1",
- "eslint-plugin-vue": "^4.0.0",
- {{#if_eq lintConfig "standard"}}
- "eslint-config-standard": "^10.2.1",
- "eslint-plugin-promise": "^3.4.0",
- "eslint-plugin-standard": "^3.0.1",
- "eslint-plugin-import": "^2.7.0",
- "eslint-plugin-node": "^5.2.0",
- {{/if_eq}}
- {{#if_eq lintConfig "airbnb"}}
- "eslint-config-airbnb-base": "^11.3.0",
- "eslint-import-resolver-webpack": "^0.8.3",
- "eslint-plugin-import": "^2.7.0",
- {{/if_eq}}
- {{/lint}}
- {{#if_eq runner "jest"}}
- "babel-jest": "^21.0.2",
- "babel-plugin-dynamic-import-node": "^1.2.0",
- "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
- "jest": "^22.0.4",
- "jest-serializer-vue": "^0.3.0",
- "vue-jest": "^1.0.2",
- {{/if_eq}}
- {{#if_eq runner "karma"}}
- "cross-env": "^5.0.1",
- "karma": "^1.4.1",
- "karma-coverage": "^1.1.1",
- "karma-mocha": "^1.3.0",
- "karma-phantomjs-launcher": "^1.0.2",
- "karma-phantomjs-shim": "^1.4.0",
- "karma-sinon-chai": "^1.3.1",
- "karma-sourcemap-loader": "^0.3.7",
- "karma-spec-reporter": "0.0.31",
- "karma-webpack": "^2.0.2",
- "mocha": "^3.2.0",
- "chai": "^4.1.2",
- "sinon": "^4.0.0",
- "sinon-chai": "^2.8.0",
- "inject-loader": "^3.0.0",
- "babel-plugin-istanbul": "^4.1.1",
- "phantomjs-prebuilt": "^2.1.14",
- {{/if_eq}}
- {{#e2e}}
- "babel-register": "^6.22.0",
- "chromedriver": "^2.27.2",
- "cross-spawn": "^5.0.1",
- "nightwatch": "^0.9.12",
- "selenium-server": "^3.0.1",
- {{/e2e}}
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
+ "babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
@@ -94,27 +30,36 @@
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
+ "eslint": "^4.15.0",
+ "eslint-config-standard": "^10.2.1",
+ "eslint-friendly-formatter": "^3.0.0",
+ "eslint-loader": "^1.7.1",
+ "eslint-plugin-import": "^2.7.0",
+ "eslint-plugin-node": "^5.2.0",
+ "eslint-plugin-promise": "^3.4.0",
+ "eslint-plugin-standard": "^3.0.1",
+ "eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
- "webpack-bundle-analyzer": "^2.9.0",
"node-notifier": "^5.1.2",
+ "optimize-css-assets-webpack-plugin": "^3.2.0",
+ "ora": "^1.2.0",
+ "portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
+ "rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
- "optimize-css-assets-webpack-plugin": "^3.2.0",
- "ora": "^1.2.0",
- "rimraf": "^2.6.0",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
- "vue-template-compiler": "^2.5.2",
- "portfinder": "^1.0.13",
+ "vue-template-compiler": "2.5.9",
"webpack": "^3.6.0",
+ "webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
diff --git a/template/src/App.vue b/template/src/App.vue
index 0156030e49..7df151ed93 100644
--- a/template/src/App.vue
+++ b/template/src/App.vue
@@ -1,34 +1,79 @@
-
-

- {{#router}}
-
- {{else}}
-
- {{/router}}
-
+
+
+

+
百果园
+
+
+
+
+
用户名称
+
+
+ 菜单1
+ 菜单2
+ 退出登录
+
+
+
+
+
-
diff --git a/template/src/components/HelloWorld.vue b/template/src/components/HelloWorld.vue
deleted file mode 100644
index ce0edd8ac1..0000000000
--- a/template/src/components/HelloWorld.vue
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
\{{ msg }}
-
Essential Links
-
-
Ecosystem
-
-
-
-
-
-
-
-
diff --git a/template/src/main.js b/template/src/main.js
index 48833b5ab7..4b1b0c76a8 100644
--- a/template/src/main.js
+++ b/template/src/main.js
@@ -1,26 +1,39 @@
-{{#if_eq build "standalone"}}
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
-{{/if_eq}}
import Vue from 'vue'
import App from './App'
-{{#router}}
import router from './router'
-{{/router}}
+
+// 引入element-ui 作为依赖
+import ElementUi from 'element-ui'
+
+import pagodaComponents from 'pagoda-ui'
+
+import 'pagoda-ui/src/theme/theme1.scss'
+import 'pagoda-ui/src/theme/ui-reset.scss'
+
+ElementUi.Button.setDefaults({
+ default: {
+ type: 'info',
+ plain: true
+ },
+ '查询': {
+ type: 'primary'
+ },
+ '保存': {
+ type: 'primary'
+ }
+})
+
+Vue.use(pagodaComponents)
+Vue.use(ElementUi, {size: 'mini'})
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
- {{#router}}
router,
- {{/router}}
- {{#if_eq build "runtime"}}
- render: h => h(App)
- {{/if_eq}}
- {{#if_eq build "standalone"}}
components: { App },
template: ''
- {{/if_eq}}
})
diff --git a/template/src/router/index.js b/template/src/router/index.js
index 5fa7f9d319..0305274969 100644
--- a/template/src/router/index.js
+++ b/template/src/router/index.js
@@ -1,15 +1,35 @@
import Vue from 'vue'
import Router from 'vue-router'
-import HelloWorld from '@/components/HelloWorld'
Vue.use(Router)
-export default new Router({
- routes: [
- {
- path: '/',
- name: 'HelloWorld',
- component: HelloWorld
+const routes = [
+ {
+ path: '/',
+ component: () => import('../views/home')
+ },
+ {
+ path: '/main',
+ component: () => import('../views/main')
+ },
+ {
+ path: '/main/detail1',
+ component: () => import('../views/detail1')
+ },
+ {
+ path: '/detail2',
+ component: () => import('../views/detail2'),
+ meta: {
+ // 标志当前路由跳转需要打开新的标签页
+ tabConfig: {
+ tabName (to, from) {
+ return `查看详情-${to.query.index}`
+ }
+ }
}
- ]
+ }
+]
+
+export default new Router({
+ routes
})
diff --git a/template/src/views/detail1.vue b/template/src/views/detail1.vue
new file mode 100644
index 0000000000..47a2dfea38
--- /dev/null
+++ b/template/src/views/detail1.vue
@@ -0,0 +1,143 @@
+
+
+
+ 编辑
+
+ 取消
+ 保存
+
+
+
+
+
+
+ \{{form.value1}}
+
+
+
+ \{{form.value2}}
+
+
+
+ \{{form.value3}}
+
+
+
+ \{{form.value4}}
+
+
+
+ \{{form.value5}}
+
+
+
+ \{{form.value6}}
+
+
+
+ \{{form.value7}}
+
+
+
+ \{{form.value8}}
+
+
+
+ \{{form.value9}}
+
+
+
+ \{{form.value0}}
+
+
+
+
+
+
这里是栏目标题
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/template/src/views/detail2.vue b/template/src/views/detail2.vue
new file mode 100644
index 0000000000..bcb19d8f02
--- /dev/null
+++ b/template/src/views/detail2.vue
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+ 保存按钮
+ 提交按钮
+ 计算
+ 确认
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 主要内容区
+
+
+
+
+
+
+
+
+ 取消
+ 保存
+
+
+
+
+
+
+
+ \{{form.value1}}
+
+
+
+ \{{form.value2}}
+
+
+
+ \{{form.value3}}
+
+
+
+ \{{form.value4}}
+
+
+
+ \{{form.value5}}
+
+
+
+ \{{form.value6}}
+
+
+
+ \{{form.value7}}
+
+
+
+ \{{form.value8}}
+
+
+
+ \{{form.value9}}
+
+
+
+ \{{form.value0}}
+
+
+
+ \{{form.value11}}
+
+
+
+
+
+
+
diff --git a/template/src/views/home.vue b/template/src/views/home.vue
new file mode 100644
index 0000000000..f9db97c7c0
--- /dev/null
+++ b/template/src/views/home.vue
@@ -0,0 +1,3 @@
+
+ Home
+
diff --git a/template/src/views/main.vue b/template/src/views/main.vue
new file mode 100644
index 0000000000..8a1b14e184
--- /dev/null
+++ b/template/src/views/main.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+ 操作按钮
+ 操作按钮
+
+
+
+
+
+
+
+
+
+
+
+
+ 当前标签查看详情
+ 新增标签查看详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/template/test/e2e/custom-assertions/elementCount.js b/template/test/e2e/custom-assertions/elementCount.js
deleted file mode 100644
index 818e602091..0000000000
--- a/template/test/e2e/custom-assertions/elementCount.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// A custom Nightwatch assertion.
-// The assertion name is the filename.
-// Example usage:
-//
-// browser.assert.elementCount(selector, count)
-//
-// For more information on custom assertions see:
-// http://nightwatchjs.org/guide#writing-custom-assertions
-
-exports.assertion = function (selector, count) {
- this.message = 'Testing if element <' + selector + '> has count: ' + count
- this.expected = count
- this.pass = function (val) {
- return val === this.expected
- }
- this.value = function (res) {
- return res.value
- }
- this.command = function (cb) {
- var self = this
- return this.api.execute(function (selector) {
- return document.querySelectorAll(selector).length
- }, [selector], function (res) {
- cb.call(self, res)
- })
- }
-}
diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js
deleted file mode 100644
index f019c0ac44..0000000000
--- a/template/test/e2e/nightwatch.conf.js
+++ /dev/null
@@ -1,46 +0,0 @@
-require('babel-register')
-var config = require('../../config')
-
-// http://nightwatchjs.org/gettingstarted#settings-file
-module.exports = {
- src_folders: ['test/e2e/specs'],
- output_folder: 'test/e2e/reports',
- custom_assertions_path: ['test/e2e/custom-assertions'],
-
- selenium: {
- start_process: true,
- server_path: require('selenium-server').path,
- host: '127.0.0.1',
- port: 4444,
- cli_args: {
- 'webdriver.chrome.driver': require('chromedriver').path
- }
- },
-
- test_settings: {
- default: {
- selenium_port: 4444,
- selenium_host: 'localhost',
- silent: true,
- globals: {
- devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
- }
- },
-
- chrome: {
- desiredCapabilities: {
- browserName: 'chrome',
- javascriptEnabled: true,
- acceptSslCerts: true
- }
- },
-
- firefox: {
- desiredCapabilities: {
- browserName: 'firefox',
- javascriptEnabled: true,
- acceptSslCerts: true
- }
- }
- }
-}
diff --git a/template/test/e2e/runner.js b/template/test/e2e/runner.js
deleted file mode 100644
index 27220329fe..0000000000
--- a/template/test/e2e/runner.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// 1. start the dev server using production config
-process.env.NODE_ENV = 'testing'
-
-const webpack = require('webpack')
-const DevServer = require('webpack-dev-server')
-
-const webpackConfig = require('../../build/webpack.prod.conf')
-const devConfigPromise = require('../../build/webpack.dev.conf')
-
-let server
-
-devConfigPromise.then(devConfig => {
- const devServerOptions = devConfig.devServer
- const compiler = webpack(webpackConfig)
- server = new DevServer(compiler, devServerOptions)
- const port = devServerOptions.port
- const host = devServerOptions.host
- return server.listen(port, host)
-})
-.then(() => {
- // 2. run the nightwatch test suite against it
- // to run in additional browsers:
- // 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
- // 2. add it to the --env flag below
- // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
- // For more information on Nightwatch's config file, see
- // http://nightwatchjs.org/guide#settings-file
- let opts = process.argv.slice(2)
- if (opts.indexOf('--config') === -1) {
- opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
- }
- if (opts.indexOf('--env') === -1) {
- opts = opts.concat(['--env', 'chrome'])
- }
-
- const spawn = require('cross-spawn')
- const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
-
- runner.on('exit', function (code) {
- server.close()
- process.exit(code)
- })
-
- runner.on('error', function (err) {
- server.close()
- throw err
- })
-})
diff --git a/template/test/e2e/specs/test.js b/template/test/e2e/specs/test.js
deleted file mode 100644
index 92ecc1216d..0000000000
--- a/template/test/e2e/specs/test.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// For authoring Nightwatch tests, see
-// http://nightwatchjs.org/guide#usage
-
-module.exports = {
- 'default e2e tests': function {{#if_eq lintConfig "airbnb"}}test{{/if_eq}}(browser) {
- // automatically uses dev Server port from /config.index.js
- // default: http://localhost:8080
- // see nightwatch.conf.js
- const devServer = browser.globals.devServerURL
-
- browser
- .url(devServer)
- .waitForElementVisible('#app', 5000)
- .assert.elementPresent('.hello')
- .assert.containsText('h1', 'Welcome to Your Vue.js App')
- .assert.elementCount('img', 1)
- .end()
- }
-}
diff --git a/template/test/unit/.eslintrc b/template/test/unit/.eslintrc
deleted file mode 100644
index 74061c48b8..0000000000
--- a/template/test/unit/.eslintrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "env": { {{#if_eq runner "karma"}}
- "mocha": true{{/if_eq}}{{#if_eq runner "jest"}}
- "jest": true{{/if_eq}}
- },
- "globals": { {{#if_eq runner "karma"}}
- "expect": true,
- "sinon": true{{/if_eq}}
- }
-}
diff --git a/template/test/unit/index.js b/template/test/unit/index.js
deleted file mode 100644
index c69f33fd8a..0000000000
--- a/template/test/unit/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import Vue from 'vue'
-
-Vue.config.productionTip = false
-
-// require all test files (files that ends with .spec.js)
-const testsContext = require.context('./specs', true, /\.spec$/)
-testsContext.keys().forEach(testsContext)
-
-// require all src files except main.js for coverage.
-// you can also change this to match only the subset of files that
-// you want coverage for.
-const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/)
-srcContext.keys().forEach(srcContext)
diff --git a/template/test/unit/jest.conf.js b/template/test/unit/jest.conf.js
deleted file mode 100644
index c524e9d7bd..0000000000
--- a/template/test/unit/jest.conf.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const path = require('path')
-
-module.exports = {
- rootDir: path.resolve(__dirname, '../../'),
- moduleFileExtensions: [
- 'js',
- 'json',
- 'vue'
- ],
- moduleNameMapper: {
- '^@/(.*)$': '/src/$1'
- },
- transform: {
- '^.+\\.js$': '/node_modules/babel-jest',
- '.*\\.(vue)$': '/node_modules/vue-jest'
- },{{#e2e}}
- testPathIgnorePatterns: [
- '/test/e2e'
- ],{{/e2e}}
- snapshotSerializers: ['/node_modules/jest-serializer-vue'],
- setupFiles: ['/test/unit/setup'],
- mapCoverage: true,
- coverageDirectory: '/test/unit/coverage',
- collectCoverageFrom: [
- 'src/**/*.{js,vue}',
- '!src/main.js',
- {{#router}}
- '!src/router/index.js',
- {{/router}}
- '!**/node_modules/**'
- ]
-}
diff --git a/template/test/unit/karma.conf.js b/template/test/unit/karma.conf.js
deleted file mode 100644
index 5d3966d23e..0000000000
--- a/template/test/unit/karma.conf.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// This is a karma config file. For more details see
-// http://karma-runner.github.io/0.13/config/configuration-file.html
-// we are also using it with karma-webpack
-// https://github.com/webpack/karma-webpack
-
-var webpackConfig = require('../../build/webpack.test.conf')
-
-module.exports = function karmaConfig (config) {
- config.set({
- // to run in additional browsers:
- // 1. install corresponding karma launcher
- // http://karma-runner.github.io/0.13/config/browsers.html
- // 2. add it to the `browsers` array below.
- browsers: ['PhantomJS'],
- frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'],
- reporters: ['spec', 'coverage'],
- files: ['./index.js'],
- preprocessors: {
- './index.js': ['webpack', 'sourcemap']
- },
- webpack: webpackConfig,
- webpackMiddleware: {
- noInfo: true
- },
- coverageReporter: {
- dir: './coverage',
- reporters: [
- { type: 'lcov', subdir: '.' },
- { type: 'text-summary' }
- ]
- }
- })
-}
diff --git a/template/test/unit/setup.js b/template/test/unit/setup.js
deleted file mode 100644
index edbdbae81e..0000000000
--- a/template/test/unit/setup.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Vue from 'vue'
-
-Vue.config.productionTip = false
diff --git a/template/test/unit/specs/HelloWorld.spec.js b/template/test/unit/specs/HelloWorld.spec.js
deleted file mode 100644
index 1c75ca64cd..0000000000
--- a/template/test/unit/specs/HelloWorld.spec.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import Vue from 'vue'
-import HelloWorld from '@/components/HelloWorld'
-
-describe('HelloWorld.vue', () => {
- it('should render correct contents', () => {
- const Constructor = Vue.extend(HelloWorld)
- const vm = new Constructor().$mount()
- expect(vm.$el.querySelector('.hello h1').textContent)
- {{#if_eq runner "karma"}}.to.equal('Welcome to Your Vue.js App'){{/if_eq}}{{#if_eq runner "jest"}}.toEqual('Welcome to Your Vue.js App'){{/if_eq}}
- })
-})