├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── example ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .npmignore ├── .npmrc ├── LICENSE ├── README.md ├── build │ ├── utils.js │ ├── webpack.build.js │ ├── webpack.build.min.js │ └── webpack.config.js ├── circle.yml ├── dist │ ├── example.js │ ├── example.js.map │ └── min │ │ └── example.min.js ├── docs │ ├── App.vue │ ├── build │ │ ├── docs.js │ │ └── docs.js.map │ └── main.js ├── favicon.ico ├── img │ └── vue.png ├── index.html ├── karma.conf.js ├── package.json ├── src │ ├── HelloWorld.vue │ └── index.js └── test │ ├── index.js │ └── specs │ └── index.spec.js ├── generators └── app │ ├── index.js │ └── templates │ ├── LICENSE │ ├── _README.md │ ├── _package.json │ ├── babelrc │ ├── docs │ ├── App.vue │ └── main.js │ ├── editorconfig │ ├── eslintignore │ ├── eslintrc │ ├── favicon.ico │ ├── gitignore │ ├── index.html │ ├── npmignore │ ├── src │ ├── HelloWorld.vue │ ├── assets │ │ └── vue.png │ └── index.js │ └── webpack.config.js ├── gulpfile.js ├── package.json └── test └── app.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | lib 4 | example/ 5 | generators/app/templates/ 6 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | *.log 4 | .DS_Store 5 | demo 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example 2 | test 3 | img 4 | .eslintrc 5 | .eslintignore 6 | .editorconfig 7 | circle.yml 8 | gulpfile.js 9 | 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Ignacio Anaya 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-vue-component 2 | 3 | > 📦 Yeoman generator to build your own [Vue.js](http://vuejs.org/) components 4 | 5 | [![bitHound Overall Score](https://www.bithound.io/github/ianaya89/generator-vue-component/badges/score.svg)](https://www.bithound.io/github/ianaya89/generator-vue-component) 6 | [![bitHound Dependencies](https://www.bithound.io/github/ianaya89/generator-vue-component/badges/dependencies.svg)](https://www.bithound.io/github/ianaya89/generator-vue-component/master/dependencies/npm) 7 | [![bitHound Dev Dependencies](https://www.bithound.io/github/ianaya89/generator-vue-component/badges/devDependencies.svg)](https://www.bithound.io/github/ianaya89/generator-vue-component/master/dependencies/npm) 8 | [![bitHound Code](https://www.bithound.io/github/ianaya89/generator-vue-component/badges/code.svg)](https://www.bithound.io/github/ianaya89/generator-vue-component) 9 | 10 |

11 | yo 12 |

13 | 14 | ## Support 15 | - Vue.js 2 => `generator-vue-component@>=2.0.0` [master] 16 | - Vue.js 1 => `generator-vue-component@1.0.0` 17 | 18 | 19 | ## Installation 20 | 21 | 1. First, install [Yeoman](http://yeoman.io) and generator-vue-component using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). 22 | 23 | ```bash 24 | $ npm install -g yo 25 | $ npm install -g generator-vue-component 26 | ``` 27 | 28 | 2. Create your project directory and access it. 29 | 30 | ```bash 31 | $ mkdir my-awesome-component 32 | $ cd my-awesome-component 33 | ``` 34 | 35 | 3. Then generate your new project: 36 | 37 | ```bash 38 | yo vue-component 39 | ``` 40 | 41 | ## Scaffolding 42 | 43 | ``` 44 | └───docs/ 45 | ├───App.vue 46 | ├───main.js 47 | └───src/ 48 | ├───assets/ 49 | └───vue.png 50 | ├───HelloWorld.vue 51 | ├───index.js 52 | ├───.babelrc 53 | ├───.editorconfig 54 | ├───.eslintignore 55 | ├───.eslintrc. 56 | ├───.gitignore 57 | ├───.npmignore 58 | ├───LICENSE 59 | ├───package.json 60 | ├───README.md 61 | ├───webpack.config.js 62 | ``` 63 | 64 | ## Development Setup 65 | 66 | ```bash 67 | # install dependencies 68 | $ npm install 69 | 70 | # dev mode 71 | $ npm run dev 72 | 73 | # build component and get production release 74 | $ npm run build 75 | ``` 76 | 77 | ## TODO 78 | 1. Jest Integration [help wanted 🙏] 79 | 2. Docs production build 80 | 81 | ## License 82 | [MIT License](https://github.com/ndelvalle/vue-esc/blob/master/LICENSE) 83 | 84 | ## Style 85 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](http://standardjs.com) 86 | 87 | **⌨️ with ❤️ by [@ianaya89](https://twitter.com/ianaya89)** 88 | -------------------------------------------------------------------------------- /example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": ["transform-runtime"], 4 | "comments": false 5 | } 6 | -------------------------------------------------------------------------------- /example/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /example/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | dist 4 | -------------------------------------------------------------------------------- /example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root : true, 3 | extends : 'airbnb-base', 4 | plugins : [ 'html' ], 5 | rules : { 6 | 'no-multi-spaces' : 0, 7 | 'no-underscore-dangle' : [0], 8 | 'consistent-return' : 0, 9 | 'no-unused-expressions' : [2, { 'allowShortCircuit': true }], 10 | 'no-param-reassign' : 0, 11 | 'func-names' : 0, 12 | 'space-before-function-paren' : [2, 'never'], 13 | 'comma-dangle' : [2, 'never'], 14 | 'no-shadow' : 0, 15 | 'guard-for-in' : 0, 16 | 'no-restricted-syntax' : [2, 'WithStatement'], 17 | 'newline-per-chained-call' : [2, { 'ignoreChainWithDepth': 5 }], 18 | 'space-in-parens' : 0, 19 | 'key-spacing' : 0, 20 | 'no-unused-vars' : [2, { 'vars': 'all', 'args': 'none' }], 21 | 'max-len' : 1, 22 | 'padded-blocks' : 0, 23 | 'no-console' : 0, 24 | 'no-continue' : 0, 25 | 'no-extra-boolean-cast' : 0, 26 | 'import/no-extraneous-dependencies': 0, 27 | 'import/newline-after-import' : 0, 28 | 'no-mixed-operators' : 0, 29 | 'import/no-unresolved' : 0, 30 | 'no-prototype-builtins' : 0, 31 | 'no-bitwise' : ['error', { 'allow': ['~'] }], 32 | 'no-new' : 0 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | lib 4 | *.log 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /example/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | test 3 | build 4 | docs 5 | test 6 | .babelrc 7 | .eslintignore 8 | .eslintrc 9 | karma.conf.js 10 | circle.yml 11 | -------------------------------------------------------------------------------- /example/.npmrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianaya89/generator-vue-component/73f476f8796da62521d9038d0fab98d0748b054f/example/.npmrc -------------------------------------------------------------------------------- /example/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 <%= authorName %> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | > example 4 | 5 |

6 | vue 7 |

8 | 9 | ### Development Setup 10 | 11 | ```bash 12 | # install dependencies 13 | $ npm install 14 | 15 | # dev mode 16 | $ npm run dev 17 | 18 | # test 19 | $ npm run test 20 | 21 | # build 22 | $ npm run build 23 | ``` 24 | 25 | 26 | **This project was built with [yeoman](http://yeoman.io/) and [generator-vue-component](https://github.com/ianaya89/generator-vue-component) :heart:** 27 | -------------------------------------------------------------------------------- /example/build/utils.js: -------------------------------------------------------------------------------- 1 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 2 | 3 | exports.cssLoaders = function(options) { 4 | options = options || {}; 5 | 6 | function generateLoaders(loaders) { 7 | const sourceLoader = loaders.map((loader) => { 8 | let extraParamChar; 9 | 10 | if (/\?/.test(loader)) { 11 | loader = loader.replace(/\?/, '-loader?'); 12 | extraParamChar = '&'; 13 | } else { 14 | loader += '-loader'; 15 | extraParamChar = '?'; 16 | } 17 | 18 | return loader + (options.sourceMap ? `${extraParamChar}sourceMap` : ''); 19 | }).join('!'); 20 | 21 | if (options.extract) { 22 | return ExtractTextPlugin.extract('vue-style-loader', sourceLoader); 23 | } 24 | 25 | return ['vue-style-loader', sourceLoader].join('!'); 26 | } 27 | 28 | return { 29 | css : generateLoaders(['css']), 30 | postcss: generateLoaders(['css']), 31 | less : generateLoaders(['css', 'less']), 32 | sass : generateLoaders(['css', 'sass?indentedSyntax']), 33 | scss : generateLoaders(['css', 'sass']), 34 | stylus : generateLoaders(['css', 'stylus']), 35 | styl : generateLoaders(['css', 'stylus']) 36 | }; 37 | }; 38 | 39 | exports.styleLoaders = function(options) { 40 | const output = []; 41 | const loaders = exports.cssLoaders(options); 42 | 43 | for (const extension in loaders) { 44 | const loader = loaders[extension]; 45 | output.push({ 46 | test : new RegExp(`\\.${extension}$`), 47 | loader 48 | }); 49 | } 50 | 51 | return output; 52 | }; 53 | -------------------------------------------------------------------------------- /example/build/webpack.build.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const config = require('./webpack.config'); 3 | 4 | config.entry = { 'example': './src/index.js' }; 5 | 6 | config.output = { 7 | filename :'example.js', 8 | path : path.join(__dirname, '../dist'), 9 | library : 'example', 10 | libraryTarget: 'umd' 11 | }; 12 | 13 | 14 | module.exports = config; 15 | -------------------------------------------------------------------------------- /example/build/webpack.build.min.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpack = require('webpack'); 3 | const config = require('./webpack.build.js'); 4 | 5 | delete config.devtool; 6 | 7 | config.output.filename = 'example.min.js'; 8 | config.output.path = path.join(__dirname, '../dist/min'); 9 | 10 | config.plugins = [ 11 | new webpack.optimize.UglifyJsPlugin({ 12 | sourceMap : false, 13 | drop_console: true, 14 | compress : { warnings: false } 15 | }) 16 | ]; 17 | 18 | module.exports = config; 19 | -------------------------------------------------------------------------------- /example/build/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const path = require('path'); 3 | const utils = require('./utils'); 4 | 5 | const projectRoot = path.resolve(__dirname, '../'); 6 | 7 | module.exports = { 8 | entry: './docs/main.js', 9 | 10 | output: { 11 | path: './docs/build', 12 | publicPath: 'docs/build/', 13 | filename: 'docs.js' 14 | }, 15 | 16 | devtool: 'source-map', 17 | 18 | resolve: { root: path.resolve('./') }, 19 | 20 | module: { 21 | preLoaders: [ 22 | { 23 | test : /\.vue$/, 24 | loader : 'eslint', 25 | include: projectRoot, 26 | exclude: /node_modules/ 27 | }, 28 | { 29 | test : /\.js$/, 30 | loader : 'eslint', 31 | include: projectRoot, 32 | exclude: /node_modules/ 33 | } 34 | ], 35 | loaders: [ 36 | { 37 | test: /\.(woff|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, 38 | loader: 'url?limit=64000' 39 | }, 40 | { 41 | test: /\.(png|jpg)$/, 42 | loader: 'url?limit=64000' 43 | }, 44 | { 45 | test : /\.vue$/, 46 | loader: 'vue' 47 | }, 48 | { 49 | test : /\.js$/, 50 | exclude: /node_modules|vue\/src|vue-router\/|vue-loader\/|vue-hot-reload-api\//, 51 | loader : 'babel' 52 | }, 53 | { 54 | test : /\.css$/, 55 | loader: 'style-loader!css-loader?root=./docs/' 56 | }, 57 | { 58 | test : /\.scss$/, 59 | loader: 'style!css!sass' 60 | } 61 | ] 62 | }, 63 | 64 | vue: { 65 | loaders: utils.cssLoaders() 66 | } 67 | }; 68 | 69 | 70 | if (process.env.NODE_ENV === 'production') { 71 | delete module.exports.devtool; 72 | 73 | module.exports.plugins = [ 74 | new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), 75 | new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) 76 | ]; 77 | } 78 | -------------------------------------------------------------------------------- /example/circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | timezone: 3 | America/Vancouver 4 | node: 5 | version: 6 6 | 7 | dependencies: 8 | override: 9 | - npm install 10 | - npm install coveralls 11 | - npm install bithound 12 | 13 | test: 14 | override: 15 | - npm test 16 | - COVERALLS_SERVICE_NAME="circleci" COVERALLS_SERVICE_JOB_ID="$CIRCLE_BUILD_NUM" ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info 17 | - ./node_modules/.bin/bithound check BITHOUND_TOKEN 18 | post: 19 | - cp -R ./test/unit/coverage/* $CIRCLE_ARTIFACTS/ 20 | -------------------------------------------------------------------------------- /example/dist/example.js: -------------------------------------------------------------------------------- 1 | (function webpackUniversalModuleDefinition(root, factory) { 2 | if(typeof exports === 'object' && typeof module === 'object') 3 | module.exports = factory(); 4 | else if(typeof define === 'function' && define.amd) 5 | define([], factory); 6 | else if(typeof exports === 'object') 7 | exports["example"] = factory(); 8 | else 9 | root["example"] = factory(); 10 | })(this, function() { 11 | return /******/ (function(modules) { // webpackBootstrap 12 | /******/ // The module cache 13 | /******/ var installedModules = {}; 14 | /******/ 15 | /******/ // The require function 16 | /******/ function __webpack_require__(moduleId) { 17 | /******/ 18 | /******/ // Check if module is in cache 19 | /******/ if(installedModules[moduleId]) 20 | /******/ return installedModules[moduleId].exports; 21 | /******/ 22 | /******/ // Create a new module (and put it into the cache) 23 | /******/ var module = installedModules[moduleId] = { 24 | /******/ exports: {}, 25 | /******/ id: moduleId, 26 | /******/ loaded: false 27 | /******/ }; 28 | /******/ 29 | /******/ // Execute the module function 30 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 31 | /******/ 32 | /******/ // Flag the module as loaded 33 | /******/ module.loaded = true; 34 | /******/ 35 | /******/ // Return the exports of the module 36 | /******/ return module.exports; 37 | /******/ } 38 | /******/ 39 | /******/ 40 | /******/ // expose the modules object (__webpack_modules__) 41 | /******/ __webpack_require__.m = modules; 42 | /******/ 43 | /******/ // expose the module cache 44 | /******/ __webpack_require__.c = installedModules; 45 | /******/ 46 | /******/ // __webpack_public_path__ 47 | /******/ __webpack_require__.p = ""; 48 | /******/ 49 | /******/ // Load entry module and return exports 50 | /******/ return __webpack_require__(0); 51 | /******/ }) 52 | /************************************************************************/ 53 | /******/ ([ 54 | /* 0 */ 55 | /***/ function(module, exports, __webpack_require__) { 56 | 57 | 'use strict'; 58 | 59 | Object.defineProperty(exports, "__esModule", { 60 | value: true 61 | }); 62 | 63 | var _HelloWorld = __webpack_require__(1); 64 | 65 | var _HelloWorld2 = _interopRequireDefault(_HelloWorld); 66 | 67 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 68 | 69 | exports.default = { 70 | HelloWorld: _HelloWorld2.default 71 | }; 72 | 73 | /***/ }, 74 | /* 1 */ 75 | /***/ function(module, exports, __webpack_require__) { 76 | 77 | var __vue_script__, __vue_template__ 78 | __webpack_require__(2) 79 | __vue_script__ = __webpack_require__(6) 80 | if (__vue_script__ && 81 | __vue_script__.__esModule && 82 | Object.keys(__vue_script__).length > 1) { 83 | console.warn("[vue-loader] src/HelloWorld.vue: named exports in *.vue files are ignored.")} 84 | __vue_template__ = __webpack_require__(7) 85 | module.exports = __vue_script__ || {} 86 | if (module.exports.__esModule) module.exports = module.exports.default 87 | if (__vue_template__) { 88 | (typeof module.exports === "function" ? (module.exports.options || (module.exports.options = {})) : module.exports).template = __vue_template__ 89 | } 90 | if (false) {(function () { module.hot.accept() 91 | var hotAPI = require("vue-hot-reload-api") 92 | hotAPI.install(require("vue"), false) 93 | if (!hotAPI.compatible) return 94 | var id = "_v-18b485e6/HelloWorld.vue" 95 | if (!module.hot.data) { 96 | hotAPI.createRecord(id, module.exports) 97 | } else { 98 | hotAPI.update(id, module.exports, __vue_template__) 99 | } 100 | })()} 101 | 102 | /***/ }, 103 | /* 2 */ 104 | /***/ function(module, exports, __webpack_require__) { 105 | 106 | // style-loader: Adds some css to the DOM by adding a \n\n\n\n// WEBPACK FOOTER //\n// HelloWorld.vue?5695d460","module.exports = \"

Hello World

\";\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/vue-html-loader!./~/vue-loader/lib/template-rewriter.js?id=_v-18b485e6!./~/vue-loader/lib/template-loader.js?raw&engine=pug!./~/vue-loader/lib/selector.js?type=template&index=0!./src/HelloWorld.vue\n// module id = 7\n// module chunks = 0"],"sourceRoot":""} -------------------------------------------------------------------------------- /example/dist/min/example.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.example=t():e.example=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o);t.default={HelloWorld:i.default}},function(e,t,n){var r,o;n(2),r=n(6),o=n(7),e.exports=r||{},e.exports.__esModule&&(e.exports=e.exports.default),o&&(("function"==typeof e.exports?e.exports.options||(e.exports.options={}):e.exports).template=o)},function(e,t,n){var r=n(3);"string"==typeof r&&(r=[[e.id,r,""]]);n(5)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){t=e.exports=n(4)(),t.push([e.id,"h1[_v-18b485e6]{color:tomato}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t=0&&x.splice(t,1)}function a(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function u(e,t){var n,r,o;if(t.singleton){var i=m++;n=v||(v=a(t)),r=f.bind(null,n,i,!1),o=f.bind(null,n,i,!0)}else n=a(t),r=l.bind(null,n),o=function(){s(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}function f(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=g(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function l(e,t){var n=t.css,r=t.media,o=t.sourceMap;if(r&&e.setAttribute("media",r),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var p={},d=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},c=d(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),h=d(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,m=0,x=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=c()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return r(n,t),function(e){for(var i=[],s=0;sHello World'}])}); -------------------------------------------------------------------------------- /example/docs/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 13 | -------------------------------------------------------------------------------- /example/docs/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import App from './App.vue'; 3 | 4 | new Vue({ 5 | el: 'body', 6 | components: { App } 7 | }); 8 | -------------------------------------------------------------------------------- /example/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianaya89/generator-vue-component/73f476f8796da62521d9038d0fab98d0748b054f/example/favicon.ico -------------------------------------------------------------------------------- /example/img/vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianaya89/generator-vue-component/73f476f8796da62521d9038d0fab98d0748b054f/example/img/vue.png -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Docs | example 7 | 8 | 9 | 10 |

example

11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /example/karma.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const merge = require('webpack-merge'); 3 | 4 | const baseConfig = require('./webpack.config'); 5 | 6 | const webpackConfig = merge(baseConfig, { 7 | devtool: '#inline-source-map' 8 | }); 9 | 10 | delete webpackConfig.entry; 11 | 12 | webpackConfig.module.preLoaders = webpackConfig.module.preLoaders || []; 13 | 14 | webpackConfig.module.preLoaders.unshift({ 15 | test : /\.js$/, 16 | loader : 'isparta', 17 | include: path.resolve('src/') 18 | }); 19 | 20 | webpackConfig.module.loaders.some((loader, i) => { 21 | if (loader.loader === 'babel') { 22 | loader.include = path.resolve('test/'); 23 | return true; 24 | } 25 | 26 | return false; 27 | }); 28 | 29 | module.exports = function(config) { 30 | config.set({ 31 | browsers: ['PhantomJS'], 32 | frameworks: ['mocha'], 33 | reporters: ['spec', 'coverage'], 34 | files: ['test/index.js'], 35 | preprocessors: { 36 | 'test/index.js': ['webpack', 'sourcemap'] 37 | }, 38 | webpack: webpackConfig, 39 | webpackMiddleware: { noInfo: true }, 40 | colors: true, 41 | logLevel: config.LOG_DISABLE, 42 | coverageReporter: { 43 | dir : './coverage', 44 | reporters: [ 45 | { type: 'lcov', subdir: '.' }, 46 | { type: 'text-summary' } 47 | ] 48 | } 49 | }); 50 | }; 51 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "version": "0.0.1", 4 | "description": "example", 5 | "main": "dist/example.min.js", 6 | "author": { 7 | "name": "Ignacio Anaya", 8 | "email": "ignacio.anaya89@gmail.com" 9 | }, 10 | "license": "MIT", 11 | "scripts": { 12 | "dev": "webpack-dev-server --inline --hot --quiet --port 8080 --open --config build/webpack.config.js", 13 | "build-all": "npm run build && npm run build-docs", 14 | "build-docs": "webpack --progress --hide-modules --config build/webpack.config.js && set NODE_ENV=production webpack --progress --hide-modules", 15 | "build": "webpack --progress --hide-modules --config build/webpack.build.min.js && webpack --progress --hide-modules --config build/webpack.build.js", 16 | "prepublish": "npm run build-all", 17 | "preinstall": "npm run build-all", 18 | "eslint": "eslint --ext .js,.vue src" 19 | }, 20 | "devDependencies": { 21 | "babel-core": "^6.1.21", 22 | "babel-loader": "^6.1.0", 23 | "babel-plugin-transform-runtime": "^6.1.18", 24 | "babel-preset-es2015": "^6.1.18", 25 | "babel-runtime": "^6.3.19", 26 | "css-loader": "^0.21.0", 27 | "eslint": "^3.5.0", 28 | "eslint-config-airbnb": "^11.1.0", 29 | "eslint-loader": "^1.5.0", 30 | "eslint-plugin-html": "^1.5.2", 31 | "eslint-plugin-import": "^1.15.0", 32 | "eslint-plugin-jsx-a11y": "^2.2.2", 33 | "eslint-plugin-react": "^6.2.1", 34 | "extract-text-webpack-plugin": "^1.0.1", 35 | "less": "^2.5.3", 36 | "less-loader": "^2.2.1", 37 | "node-sass": "^3.4.1", 38 | "prismjs": "^1.5.1", 39 | "pug": "^2.0.0-beta6", 40 | "sass-loader": "^3.1.1", 41 | "style-loader": "^0.13.0", 42 | "url-loader": "^0.5.7", 43 | "vue": "^1.0.26", 44 | "vue-hot-reload-api": "^1.2.0", 45 | "vue-html-loader": "^1.2.3", 46 | "vue-loader": "8.5.3", 47 | "vue-style-loader": "^1.0.0", 48 | "webpack": "^1.12.2", 49 | "webpack-dev-server": "^1.12.0" 50 | }, 51 | "pre-commit": [ 52 | "eslint" 53 | ] 54 | } 55 | -------------------------------------------------------------------------------- /example/src/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 17 | -------------------------------------------------------------------------------- /example/src/index.js: -------------------------------------------------------------------------------- 1 | import HelloWorld from './HelloWorld.vue'; 2 | 3 | export default { 4 | HelloWorld 5 | }; 6 | -------------------------------------------------------------------------------- /example/test/index.js: -------------------------------------------------------------------------------- 1 | /* global */ 2 | 3 | // require all test files (files that ends with .spec.js) 4 | const testsContext = require.context('./specs/', true, /\.spec$/); 5 | testsContext.keys().forEach(testsContext); 6 | 7 | 8 | // require all src files except main.js for coverage. 9 | // you can also change this to match only the subset of files that 10 | // you want coverage for. 11 | const srcContext = require.context('../src', true, /\.js$/); 12 | srcContext.keys().forEach(srcContext); 13 | -------------------------------------------------------------------------------- /example/test/specs/index.spec.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianaya89/generator-vue-component/73f476f8796da62521d9038d0fab98d0748b054f/example/test/specs/index.spec.js -------------------------------------------------------------------------------- /generators/app/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const yosay = require('yosay') 3 | const to = require('to-case') 4 | const generators = require('yeoman-generator') 5 | 6 | const libraryGenerator = generators.Base.extend({ 7 | prompting: { 8 | welcome () { 9 | this.log(yosay( 10 | '\'Allo \'allo! Out of the box I include Babel, Webpack and Karma, as well as a' + 11 | 'few other goodies, to build your own reusable Vue.js Component.' 12 | )) 13 | }, 14 | 15 | ask () { 16 | return this.prompt([{ 17 | name: 'libraryName', 18 | type: 'input', 19 | message: 'Library name:', 20 | filter: answer => to.slug(answer), 21 | default: path.basename(this.destinationPath()) 22 | }, { 23 | name: 'libraryDescription', 24 | type: 'input', 25 | message: 'Library description:' 26 | }, { 27 | name: 'libraryVersion', 28 | type: 'input', 29 | message: 'Library version:', 30 | default: '1.0.0' 31 | }, { 32 | name: 'authorName', 33 | type: 'input', 34 | message: 'Author name:', 35 | store: true 36 | }, { 37 | name: 'authorEmail', 38 | type: 'input', 39 | message: 'Author email:', 40 | store: true 41 | }]).then((answers) => { 42 | this.libraryName = answers.libraryName 43 | this.libraryDescription = answers.libraryDescription 44 | this.libraryVersion = answers.libraryVersion 45 | this.authorName = answers.authorName 46 | this.authorEmail = answers.authorEmail 47 | }) 48 | } 49 | }, 50 | 51 | writing: { 52 | 53 | src () { 54 | this.directory('src', 'src') 55 | }, 56 | 57 | test () { 58 | this.directory('test', 'test') 59 | }, 60 | 61 | docs () { 62 | this.directory('docs', 'docs', { libraryName: this.libraryName }) 63 | }, 64 | 65 | favicon () { 66 | this.fs.copy( 67 | this.templatePath('favicon.ico'), 68 | this.destinationPath('favicon.ico') 69 | ) 70 | }, 71 | 72 | gitignore () { 73 | this.fs.copy( 74 | this.templatePath('gitignore'), 75 | this.destinationPath('.gitignore') 76 | ) 77 | }, 78 | 79 | eslintrc () { 80 | this.fs.copy( 81 | this.templatePath('eslintrc'), 82 | this.destinationPath('.eslintrc') 83 | ) 84 | }, 85 | 86 | eslintignore () { 87 | this.fs.copy( 88 | this.templatePath('eslintignore'), 89 | this.destinationPath('.eslintignore') 90 | ) 91 | }, 92 | 93 | babel () { 94 | this.fs.copy( 95 | this.templatePath('babelrc'), 96 | this.destinationPath('.babelrc') 97 | ) 98 | }, 99 | 100 | index () { 101 | this.fs.copyTpl( 102 | this.templatePath('index.html'), 103 | this.destinationPath('index.html'), 104 | { libraryName: this.libraryName } 105 | ) 106 | }, 107 | 108 | webpack () { 109 | this.fs.copyTpl( 110 | this.templatePath('webpack.config.js'), 111 | this.destinationPath('webpack.config.js'), 112 | { libraryName: this.libraryName } 113 | ) 114 | }, 115 | 116 | readme () { 117 | this.fs.copyTpl( 118 | this.templatePath('_README.md'), 119 | this.destinationPath('README.md'), { 120 | libraryName: this.libraryName, 121 | libraryDescription: this.libraryDescription 122 | } 123 | ) 124 | }, 125 | 126 | license () { 127 | this.fs.copyTpl( 128 | this.templatePath('LICENSE'), 129 | this.destinationPath('LICENSE'), 130 | { 131 | authorName: this.authorName, 132 | year: new Date().getFullYear() 133 | } 134 | ) 135 | }, 136 | 137 | npmignore () { 138 | this.fs.copy( 139 | this.templatePath('npmignore'), 140 | this.destinationPath('.npmignore') 141 | ) 142 | }, 143 | 144 | editorconfig () { 145 | this.fs.copy( 146 | this.templatePath('editorconfig'), 147 | this.destinationPath('.editorconfig') 148 | ) 149 | }, 150 | 151 | packageJSON () { 152 | this.fs.copyTpl( 153 | this.templatePath('_package.json'), 154 | this.destinationPath('package.json'), { 155 | libraryName: this.libraryName, 156 | libraryDescription: this.libraryDescription, 157 | libraryVersion: this.libraryVersion, 158 | authorName: this.authorName, 159 | authorEmail: this.authorEmail 160 | } 161 | ) 162 | } 163 | }, 164 | 165 | install () { 166 | this.npmInstall() 167 | } 168 | }) 169 | 170 | module.exports = libraryGenerator 171 | -------------------------------------------------------------------------------- /generators/app/templates/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) <%= year %> <%= authorName %> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /generators/app/templates/_README.md: -------------------------------------------------------------------------------- 1 | # <%= libraryName %> 2 | 3 | > <%= libraryDescription %> 4 | 5 |
6 | vue 7 |
8 | 9 | ### Development Setup 10 | 11 | ```bash 12 | # install dependencies 13 | $ npm install 14 | 15 | # dev mode 16 | $ npm run dev 17 | 18 | # test 19 | $ npm run test 20 | 21 | # build 22 | $ npm run build 23 | ``` 24 | 25 | 26 | **This project was generated with [yeoman](http://yeoman.io/) and [generator-vue-component](https://github.com/ianaya89/generator-vue-component) :heart:** 27 | -------------------------------------------------------------------------------- /generators/app/templates/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= libraryName %>", 3 | "version": "<%= libraryVersion %>", 4 | "description": "<%= libraryDescription %>", 5 | "main": "dist/<%= libraryName %>.min.js", 6 | "author": { 7 | "name": "<%= authorName %>", 8 | "email": "<%= authorEmail %>" 9 | }, 10 | "license": "MIT", 11 | "scripts": { 12 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", 13 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules", 14 | "start": "serve --single", 15 | "prepublish": "npm run build" 16 | }, 17 | "devDependencies": { 18 | "babel-core": "^6.1.21", 19 | "babel-loader": "^6.1.0", 20 | "babel-preset-env": "^1.6.0", 21 | "cross-env": "^3.0.0", 22 | "css-loader": "^0.25.0", 23 | "eslint": "^4.2.0", 24 | "eslint-config-standard": "^10.2.1", 25 | "eslint-loader": "^1.9.0", 26 | "eslint-plugin-html": "^3.0.0", 27 | "eslint-plugin-import": "^2.7.0", 28 | "eslint-plugin-node": "^5.1.0", 29 | "eslint-plugin-promise": "^3.5.0", 30 | "eslint-plugin-standard": "^3.0.1", 31 | "file-loader": "^0.9.0", 32 | "node-sass": "^3.4.1", 33 | "pug": "^2.0.0-beta6", 34 | "sass-loader": "^3.1.1", 35 | "vue": "^2.4.0", 36 | "vue-loader": "^12.1.0", 37 | "vue-template-compiler": "^2.3.3", 38 | "webpack": "^2.7.0", 39 | "webpack-dev-server": "^2.4.5" 40 | }, 41 | "pre-commit": [ 42 | "eslint" 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /generators/app/templates/babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"] 3 | } 4 | -------------------------------------------------------------------------------- /generators/app/templates/docs/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | 22 | 37 | -------------------------------------------------------------------------------- /generators/app/templates/docs/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | new Vue({ // eslint-disable-line no-new 5 | el: '#app', 6 | render: h => h(App) 7 | }) 8 | -------------------------------------------------------------------------------- /generators/app/templates/editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /generators/app/templates/eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | dist 4 | -------------------------------------------------------------------------------- /generators/app/templates/eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "plugins": [ "html" ] 4 | } 5 | -------------------------------------------------------------------------------- /generators/app/templates/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianaya89/generator-vue-component/73f476f8796da62521d9038d0fab98d0748b054f/generators/app/templates/favicon.ico -------------------------------------------------------------------------------- /generators/app/templates/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | lib 4 | *.log 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /generators/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 📄 Docs | <%= libraryName %> 7 | 8 | 16 | 17 | 18 |

<%= libraryName %>

19 |
20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /generators/app/templates/npmignore: -------------------------------------------------------------------------------- 1 | src 2 | test 3 | build 4 | docs 5 | test 6 | .babelrc 7 | .eslintignore 8 | .eslintrc 9 | -------------------------------------------------------------------------------- /generators/app/templates/src/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 18 | -------------------------------------------------------------------------------- /generators/app/templates/src/assets/vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianaya89/generator-vue-component/73f476f8796da62521d9038d0fab98d0748b054f/generators/app/templates/src/assets/vue.png -------------------------------------------------------------------------------- /generators/app/templates/src/index.js: -------------------------------------------------------------------------------- 1 | import HelloWorld from './HelloWorld.vue' 2 | 3 | export { HelloWorld } 4 | 5 | export default HelloWorld 6 | -------------------------------------------------------------------------------- /generators/app/templates/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const webpack = require('webpack') 3 | 4 | module.exports = { 5 | entry: './docs/main.js', 6 | 7 | output: { 8 | path: path.resolve(__dirname, './docs/build'), 9 | publicPath: 'docs/build/', 10 | filename: 'docs.js' 11 | }, 12 | 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.(js|vue)$/, 17 | loader: 'eslint-loader', 18 | enforce: 'pre', 19 | include: [path.resolve(__dirname, './src')] 20 | }, 21 | { 22 | test: /\.vue$/, 23 | loader: 'vue-loader', 24 | options: { 25 | loaders: { 26 | 'scss': 'vue-style-loader!css-loader!sass-loader', 27 | 'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax' 28 | } 29 | } 30 | }, 31 | { 32 | test: /\.js$/, 33 | loader: 'babel-loader', 34 | exclude: /node_modules/ 35 | }, 36 | { 37 | test: /\.(png|jpg|gif|svg)$/, 38 | loader: 'file-loader', 39 | options: { 40 | name: '[name].[ext]?[hash]' 41 | } 42 | } 43 | ] 44 | }, 45 | resolve: { 46 | alias: { 47 | 'vue$': 'vue/dist/vue.esm.js' 48 | } 49 | }, 50 | devServer: { 51 | historyApiFallback: true, 52 | noInfo: false 53 | }, 54 | performance: { 55 | hints: false 56 | }, 57 | devtool: '#eval-source-map' 58 | } 59 | 60 | if (process.env.NODE_ENV === 'production') { 61 | module.exports.entry = './src/index.js' 62 | 63 | module.exports.output = { 64 | path: path.resolve(__dirname, './dist'), 65 | publicPath: 'dist/', 66 | filename: '<%= libraryName %>.min.js', 67 | libraryTarget: 'umd' 68 | } 69 | 70 | module.exports.devtool = '#source-map' 71 | module.exports.plugins = (module.exports.plugins || []).concat([ 72 | new webpack.DefinePlugin({ 73 | 'process.env': { 74 | NODE_ENV: '"production"' 75 | } 76 | }), 77 | new webpack.optimize.UglifyJsPlugin({ 78 | sourceMap: true, 79 | compress: { 80 | warnings: false 81 | } 82 | }), 83 | new webpack.LoaderOptionsPlugin({ 84 | minimize: true 85 | }) 86 | ]) 87 | } 88 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const gulp = require('gulp') 3 | const nsp = require('gulp-nsp') 4 | const mocha = require('gulp-mocha') 5 | const plumber = require('gulp-plumber') 6 | const istanbul = require('gulp-istanbul') 7 | const coveralls = require('gulp-coveralls') 8 | const excludeGitignore = require('gulp-exclude-gitignore') 9 | 10 | gulp.task('static', () => 11 | gulp.src('**/*.js') 12 | .pipe(excludeGitignore()) 13 | ) 14 | 15 | gulp.task('nsp', (cb) => { 16 | nsp({ package: path.resolve('package.json') }, cb) 17 | }) 18 | 19 | gulp.task('pre-test', () => 20 | gulp.src('generators/index.js') 21 | .pipe(excludeGitignore()) 22 | .pipe(istanbul({ 23 | includeUntested: true 24 | })) 25 | .pipe(istanbul.hookRequire()) 26 | ) 27 | 28 | gulp.task('test', ['pre-test'], (cb) => { 29 | let mochaErr 30 | 31 | gulp.src('test/**/*.js') 32 | .pipe(plumber()) 33 | .pipe(mocha({ reporter: 'spec' })) 34 | .on('error', (err) => { 35 | mochaErr = err 36 | }) 37 | .pipe(istanbul.writeReports()) 38 | .on('end', () => { 39 | cb(mochaErr) 40 | }) 41 | }) 42 | 43 | gulp.task('watch', () => { 44 | gulp.watch(['generators/**/*.js', 'test/**'], ['test']) 45 | }) 46 | 47 | gulp.task('coveralls', ['test'], () => { 48 | if (!process.env.CI) { 49 | return 50 | } 51 | 52 | return gulp.src(path.join(__dirname, 'coverage/lcov.info')) 53 | .pipe(coveralls()) 54 | }) 55 | 56 | gulp.task('prepublish', ['nsp']) 57 | gulp.task('default', ['static', 'test', 'coveralls']) 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-vue-component", 3 | "version": "2.0.1", 4 | "description": "Yeoman generator to build custom Vue.js components", 5 | "author": { 6 | "name": "Ignacio Anaya", 7 | "email": "ignacio.anaya89@gmail.com" 8 | }, 9 | "scripts": { 10 | "prepublish": "gulp prepublish", 11 | "test": "gulp", 12 | "eslint": "eslint --fix ." 13 | }, 14 | "files": [ 15 | "generators" 16 | ], 17 | "main": "generators/index.js", 18 | "keywords": [ 19 | "babel", 20 | "yeoman", 21 | "generator", 22 | "karma", 23 | "webpack", 24 | "npm", 25 | "vue", 26 | "components", 27 | "vuejs", 28 | "lib", 29 | "yeoman-generator" 30 | ], 31 | "dependencies": { 32 | "to-case": "^2.0.0", 33 | "yeoman-generator": "^0.24.1", 34 | "yosay": "^1.2.0" 35 | }, 36 | "devDependencies": { 37 | "yeoman-test": "^1.0.0", 38 | "yeoman-assert": "^2.0.0", 39 | "eslint": "^4.2.0", 40 | "eslint-config-standard": "^10.2.1", 41 | "eslint-loader": "^1.9.0", 42 | "eslint-plugin-import": "^2.7.0", 43 | "eslint-plugin-node": "^5.1.0", 44 | "eslint-plugin-promise": "^3.5.0", 45 | "eslint-plugin-standard": "^3.0.1", 46 | "gulp": "^3.9.1", 47 | "gulp-exclude-gitignore": "^1.0.0", 48 | "gulp-line-ending-corrector": "^1.0.1", 49 | "gulp-istanbul": "^1.0.0", 50 | "gulp-mocha": "^3.0.1", 51 | "gulp-plumber": "^1.0.0", 52 | "gulp-nsp": "^2.1.0", 53 | "gulp-coveralls": "^0.1.0" 54 | }, 55 | "repository": "ianaya89/generator-vue-component", 56 | "license": "MIT" 57 | } 58 | -------------------------------------------------------------------------------- /test/app.js: -------------------------------------------------------------------------------- 1 | /* global describe before it */ 2 | 3 | const path = require('path') 4 | const assert = require('yeoman-assert') 5 | const helpers = require('yeoman-test') 6 | 7 | describe('generator-vue-component:app', () => { 8 | before(() => 9 | helpers.run(path.join(__dirname, '../generators/app')) 10 | .withPrompts({ someAnswer: true }).toPromise() 11 | ) 12 | 13 | it('creates files', () => { 14 | assert.file([ 15 | 'src/HelloWorld.vue', 16 | 'src/index.js', 17 | 'src/assets/vue.png', 18 | '.babelrc', 19 | '.editorconfig', 20 | '.eslintignore', 21 | '.eslintrc', 22 | '.gitignore', 23 | '.npmignore', 24 | 'LICENSE', 25 | 'index.html', 26 | 'favicon.ico', 27 | 'package.json', 28 | 'README.md', 29 | 'docs/App.vue', 30 | 'docs/main.js', 31 | 'webpack.config.js' 32 | ]) 33 | }) 34 | }) 35 | --------------------------------------------------------------------------------