Skip to content

Commit

Permalink
Added promts for lodash, axios and ui librarys and conditionals for them
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkrai03 committed Aug 17, 2017
1 parent 9592b48 commit 3aa744b
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 22 deletions.
39 changes: 29 additions & 10 deletions meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ module.exports = {
"type": "list",
"message": "Pick an ESLint preset",
"choices": [
{
"name": "Standard (https://github.com/feross/standard)",
"value": "standard",
"short": "Standard"
},
{
"name": "Airbnb (https://github.com/airbnb/javascript)",
"value": "airbnb",
Expand All @@ -74,18 +69,42 @@ module.exports = {
"type": "confirm",
"message": "Setup unit tests with Karma + Mocha?"
},
"e2e": {
"lodash": {
"type": "confirm",
"message": "Install lodash into the project?"
},
"axios": {
"type": "confirm",
"message": "Setup e2e tests with Nightwatch?"
"message": "Install axios into the project?"
},
"ui": {
"type": "confirm",
"message": "Use a UI library to help with basic styles and components?"
},
"uiLibrary": {
"when": "ui",
"type": "list",
"message": "Pick a UI Library",
"choices": [
{
"name": "Element - A Vue based component library (http://element.eleme.io/#/en-US)",
"value": "element",
"short": "Element"
},
{
"name": "Foundation - Responsive front-end framework (http://foundation.zurb.com/)",
"value": "foundation",
"short": "Foundation"
}
]

}
},
"filters": {
".eslintrc.js": "lint",
".eslintignore": "lint",
"config/test.env.js": "unit || e2e",
"test/unit/**/*": "unit",
"build/webpack.test.conf.js": "unit",
"test/e2e/**/*": "e2e",
"build/webpack.testing.js": "unit",
"src/router/**/*": "router"
},
"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"
Expand Down
6 changes: 5 additions & 1 deletion template/.babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"presets": [
["env", { "modules": false }]
],
],
"plugins": [
{{#lodash}}
"lodash",
{{/lodash}}
{{#if_eq uiLibrary "element"}}
["component", [
{
"libraryName": "element-ui",
"styleLibraryName": "theme-default"
}
]]
{{/if_eq}}
]
}
6 changes: 6 additions & 0 deletions template/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ module.exports = {
env: {
browser: true,
},
{{#if_eq lintConfig "airbnb"}}
extends: 'airbnb-base',
{{/if_eq}}
// required to lint *.vue files
plugins: [
'html'
],
{{#if_eq lintConfig "airbnb"}}
// check if imports actually resolve
'settings': {
'import/resolver': {
Expand All @@ -22,8 +25,10 @@ module.exports = {
}
}
},
{{/if_eq}}
// add your custom rules here
'rules': {
{{#if_eq lintConfig "airbnb"}}
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
'js': 'never',
Expand All @@ -33,6 +38,7 @@ module.exports = {
'import/no-extraneous-dependencies': ['error', {
'optionalDependencies': ['test/unit/index.js']
}],
{{/if_eq}}
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
},
Expand Down
17 changes: 17 additions & 0 deletions template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.DS_Store
node_modules/
dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
{{#unit}}
test/unit/coverage
{{/unit}}


# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
9 changes: 9 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ npm run dev
# build for production with minification
npm run build
```
# build for production and view the bundle analyzer report
npm run build --report

{{#unit}}

# run unit tests
npm run unit
{{/unit}}


For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
=======
7 changes: 6 additions & 1 deletion template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>vue-starter</title>
<title>{{ name }}</title>
{{#ui}}
{{#if_eq uiLibrary "foundation"}}
<link rel="stylesheet" type="text/css" href="/node_modules/foundation-sites/dist/css/foundation.min.css">
{{/if_eq}}
{{/ui}}
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
53 changes: 43 additions & 10 deletions template/package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,65 @@
{
"name": "vue-starter",
"description": "A Vue.js starter kit that lets you focus on more programming and less configruation.",
"name": "{{ name }}",
"description": "{{ description }}",
"version": "1.0.0",
"author": "Rohit Rai <[email protected]>",
"author": "{{ author }}",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules --display-error-details",
{{#unit}}
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"test": "npm run unit",
{{/unit}}
{{#lint}}
"lint": "eslint --ext .js,.vue src test/unit/specs"
{{/lint}}
},
"dependencies": {
"vue": "^2.4.2",
{{#router}}
"vue-router": "^2.7.0"
{{/router}}
},
"devDependencies": {
{{#axios}}
"axios": "^0.16.2",
{{/axios}}
"babel-core": "^6.25.0",
{{#lint}}
"babel-eslint": "^7.2.3",
{{/lint}}
"babel-loader": "^7.1.1",
"babel-plugin-component": "^0.10.0",
"babel-plugin-lodash": "^3.2.11",
"babel-preset-env": "^1.6.0",
"compression-webpack-plugin": "^1.0.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"element-ui": "^1.4.2",
{{#lint}}
"eslint": "^4.4.1",
"eslint-config-airbnb-base": "^11.3.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-loader": "^1.9.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-plugin-html": "^3.2.0",
{{#if_eq lintConfig "airbnb"}}
"eslint-config-airbnb-base": "^11.3.1",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-import": "^2.7.0",
{{/if_eq}}
{{/lint}}
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
{{#ui}}
{{#if_eq uiLibrary "foundation"}}
"element-ui": "^1.4.2",
{{/if_eq}}
{{#if_eq uiLibrary "element"}}
"foundation-sites": "^6.4.2",
"babel-plugin-component": "^0.10.0",
{{/if_eq}}
{{/ui}}
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
{{#unit}}
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
Expand All @@ -57,8 +77,12 @@
"inject-loader": "^3.0.0",
"babel-plugin-istanbul": "^4.1.1",
"phantomjs-prebuilt": "^2.1.14",
{{/unit}}
{{#lodash}}
"lodash": "^4.17.4",
"babel-plugin-lodash": "^3.2.11",
"lodash-webpack-plugin": "^0.11.4",
{{/lodash}}
"node-sass": "^4.5.3",
"optimize-css-assets-webpack-plugin": "^3.0.0",
"sass-loader": "^6.0.6",
Expand All @@ -70,5 +94,14 @@
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.7.1",
"webpack-merge": "^4.1.0"
}
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
11 changes: 11 additions & 0 deletions template/src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{{#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}}

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"}}
template: '<App/>',
components: {
App,
},
{{/if_eq}}
});

0 comments on commit 3aa744b

Please sign in to comment.