├── template ├── src │ ├── index.js │ └── MyComponent.vue ├── dev │ ├── main.js │ └── App.vue ├── bili.config.js ├── README.md └── package.json ├── README.md └── meta.js /template/src/index.js: -------------------------------------------------------------------------------- 1 | import MyComponent from './MyComponent.vue' 2 | 3 | export default MyComponent 4 | -------------------------------------------------------------------------------- /template/dev/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | new Vue({ 5 | el: '#app', 6 | render: h => h(App) 7 | }) -------------------------------------------------------------------------------- /template/bili.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | format: 'umd,cjs,es', 3 | // true means compress for umd, cjs, iife 4 | compress: 'umd', 5 | plugins: ['vue', 'babel'] 6 | } -------------------------------------------------------------------------------- /template/README.md: -------------------------------------------------------------------------------- 1 | # {{ name }} 2 | 3 | > {{ description }} 4 | 5 | ## Usage 6 | 7 | ``` bash 8 | npm install {{name}} 9 | 10 | import Vue from 'vue' 11 | import {{name}} from '{{name}}' 12 | Vue.component({{name}}) 13 | ``` 14 | 15 | This README was generated using [vue-npm-template](https://github.com/cristijora/vue-npm-template) -------------------------------------------------------------------------------- /template/dev/App.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /template/src/MyComponent.vue: -------------------------------------------------------------------------------- 1 | 10 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-npm-template 2 | 3 | > Scaffold a pre-configured template which will let you publish vue components to npm very fast/ 4 | 5 | > This template is Vue 2.0 compatible. 6 | 7 | For Sao version please check [vue-npm](https://github.com/cristijora/vue-npm) 8 | 9 | ### Before You Start... 10 | 11 | This boilerplate is targeted at intermediate users who have knowledge of vue and npm modules. 12 | This template makes use of [POI](https://poi.js.org/#/) , [Bili](https://egoist.moe/bili/#/) to bundle the vue component. 13 | 14 | ## Notes 15 | This template has makes use of `babel-preset-stage-2` which means you can use latest ES6 features without worries 16 | ## Usage 17 | 18 | This is a project template for [vue-cli](https://github.com/vuejs/vue-cli). 19 | 20 | ``` bash 21 | $ npm install -g vue-cli # Install vue-cli if you haven't already 22 | $ vue init cristijora/vue-npm-template # Create a new project based on this template 23 | $ cd my-project # Navigate into your new project folder 24 | 25 | $ npm install # Install dependencies 26 | $ npm run dev # Run development server on port 5000 27 | $ npm run build # Build your component for production 28 | 29 | ``` 30 | -------------------------------------------------------------------------------- /template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{ name }}", 3 | "version": "1.0.0", 4 | "description": "{{ description }}", 5 | {{#repostory}} 6 | "repository": { 7 | "url": "{{ repositoryConfig }}", 8 | "type": "git" 9 | }, 10 | {{/repostory}} 11 | "main": "dist/{{ name }}.common.js", 12 | "unpkg": "dist/{{ name }}", 13 | "poi": { 14 | "entry": "dev/main.js", 15 | "dist": "dev/dist", 16 | "homepage": "/{{ name }}/" 17 | }, 18 | "files": [ 19 | "dist" 20 | ], 21 | "scripts": { 22 | "test": "echo 'no tests!' && npm run lint", 23 | "prepublish": "npm run build", 24 | "lint": "xo", 25 | "build": "bili", 26 | "build:example": "poi build", 27 | "dev": "poi --port 5000" 28 | }, 29 | "author": "{{ author }}", 30 | "license": "MIT", 31 | "dependencies": {}, 32 | "devDependencies": { 33 | "babel-preset-stage-2": "^6.24.1", 34 | "bili": "^0.16.0-rc.2", 35 | "eslint-config-rem": "^3.0.0", 36 | "poi": "^9.1.0", 37 | "rollup-plugin-babel": "^2.7.1", 38 | "rollup-plugin-vue": "^2.4.2", 39 | "node-sass": "^4.5.3", 40 | "sass-loader": "^6.0.6", 41 | "vue": "^2.4.2", 42 | "xo": "^0.18.0" 43 | }, 44 | "xo": { 45 | "extends": "rem/prettier", 46 | "ignores": [ 47 | "dev/**" 48 | ] 49 | }, 50 | "babel": { 51 | "presets": [ 52 | [ 53 | "vue-app", 54 | { 55 | "useBuiltIns": true 56 | } 57 | ] 58 | ] 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /meta.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "helpers": { 3 | "if_or": function (v1, v2, options) { 4 | if (v1 || v2) { 5 | return options.fn(this); 6 | } 7 | 8 | return options.inverse(this); 9 | } 10 | }, 11 | "prompts": { 12 | "name": { 13 | "type": "string", 14 | "required": true, 15 | "message": "Enter your component name. It should be the same as the npm module name" 16 | }, 17 | "description": { 18 | "type": "string", 19 | "required": false, 20 | "message": "Project/component description", 21 | "default": "My vue component" 22 | }, 23 | "author": { 24 | "type": "string", 25 | "required": true, 26 | "message": "Author" 27 | }, 28 | "repository": { 29 | "type": "confirm", 30 | "message": "Do you want to add a github repository ?" 31 | }, 32 | "repositoryConfig": { 33 | "when": "repository", 34 | "type": "string", 35 | "message": "Type your github repository `{username}/{repository-name}`" 36 | }, 37 | "sass": { 38 | "type": "confirm", 39 | "message": "Shall we add sass support?" 40 | } 41 | }, 42 | "completeMessage": "To get started:\n\n {{^inPlace}}cd {{destDirName}}\n {{/inPlace}}npm install\n npm run dev\n\n" 43 | } 44 | --------------------------------------------------------------------------------