├── .gitattributes ├── generators └── app │ ├── templates │ ├── src │ │ └── index.js │ ├── babelrc │ ├── test │ │ ├── unit │ │ │ └── index.test.js │ │ └── mocha.opts │ ├── travis.yml │ ├── editorconfig │ ├── gitignore │ ├── npmignore │ ├── package.json │ └── README.md │ └── index.js ├── .npmignore ├── test ├── mocha.opts └── unit │ └── app.test.js ├── .editorconfig ├── .travis.yml ├── .gitignore ├── LICENSE ├── package.json ├── .snyk └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /generators/app/templates/src/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /coverage 2 | /test 3 | /.idea 4 | -------------------------------------------------------------------------------- /generators/app/templates/babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015-node4"] 3 | } 4 | -------------------------------------------------------------------------------- /generators/app/templates/test/unit/index.test.js: -------------------------------------------------------------------------------- 1 | import { assert } from 'chai'; 2 | -------------------------------------------------------------------------------- /test/mocha.opts: -------------------------------------------------------------------------------- 1 | ./test/unit/**/*.test.js 2 | --timeout 20000 3 | --reporter nyan 4 | --recursive 5 | -------------------------------------------------------------------------------- /generators/app/templates/test/mocha.opts: -------------------------------------------------------------------------------- 1 | ./test/unit/**/*.test.js 2 | --reporter spec 3 | --recursive 4 | -------------------------------------------------------------------------------- /generators/app/templates/travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - stable 5 | - 4 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /generators/app/templates/editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | cache: 4 | directories: 5 | - node_modules 6 | notifications: 7 | email: true 8 | node_js: 9 | - stable 10 | - 5 11 | - 4 12 | before_script: 13 | - npm prune 14 | after_success: 15 | - 'curl -Lo travis_after_all.py https://git.io/travis_after_all' 16 | - python travis_after_all.py 17 | - 'export $(cat .to_export_back) &> /dev/null' 18 | - npm run coveralls 19 | - npm run semantic-release 20 | branches: 21 | except: 22 | - "/^v\\d+\\.\\d+\\.\\d+$/" 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | node_modules 27 | 28 | # Miscellaneous 29 | *~ 30 | *# 31 | .DS_STORE 32 | .netbeans 33 | nbproject 34 | .idea 35 | .node_history 36 | -------------------------------------------------------------------------------- /generators/app/templates/gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | node_modules 27 | 28 | # Babel compiled sources 29 | lib 30 | 31 | # Miscellaneous 32 | *~ 33 | *# 34 | .DS_STORE 35 | .netbeans 36 | nbproject 37 | .idea 38 | .node_history 39 | -------------------------------------------------------------------------------- /generators/app/templates/npmignore: -------------------------------------------------------------------------------- 1 | # Automatically ignored per: 2 | # https://www.npmjs.org/doc/developers.html#Keeping-files-out-of-your-package 3 | # 4 | # .*.swp 5 | # ._* 6 | # .DS_Store 7 | # .git 8 | # .hg 9 | # .lock-wscript 10 | # .svn 11 | # .wafpickle-* 12 | # CVS 13 | # npm-debug.log 14 | # node_modules 15 | 16 | *.seed 17 | *.log 18 | *.csv 19 | *.dat 20 | *.out 21 | *.pid 22 | *.gz 23 | *.orig 24 | 25 | work 26 | build 27 | src 28 | test 29 | pids 30 | logs 31 | results 32 | coverage 33 | lib-cov 34 | html-report 35 | xunit.xml 36 | 37 | .project 38 | .idea 39 | .settings 40 | .iml 41 | *.sublime-workspace 42 | *.sublime-project 43 | 44 | ehthumbs.db 45 | Icon? 46 | Thumbs.db 47 | .AppleDouble 48 | .LSOverride 49 | .Spotlight-V100 50 | .Trashes 51 | -------------------------------------------------------------------------------- /test/unit/app.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require('path'); 4 | const assert = require('yeoman-assert'); 5 | const test = require('yeoman-test'); 6 | 7 | describe('app', () => { 8 | before(done => { 9 | test 10 | .run(path.join(__dirname, '../../generators/app')) 11 | .withPrompts({'module:license': 'MIT'}) 12 | .on('end', done); 13 | }); 14 | 15 | it('Should create files', () => { 16 | assert.file([ 17 | 'src/index.js', 18 | 'test/unit/index.test.js', 19 | 'test/mocha.opts', 20 | '.babelrc', 21 | '.editorconfig', 22 | '.gitignore', 23 | '.npmignore', 24 | 'package.json', 25 | 'README.md', 26 | '.travis.yml', 27 | 'LICENSE' 28 | ]); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /generators/app/templates/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= answers['module:name'] %>", 3 | "description": "<%= answers['module:description'] %>", 4 | "version": "0.1.0", 5 | "main": "lib/index.js", 6 | "author": "<%= answers['module:author:nickname'] %>", 7 | "repository": "<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>", 8 | "license": "<%= answers['module:license'] %>", 9 | "scripts": { 10 | "compile": "babel src --out-dir lib", 11 | "coveralls": "cat ./coverage/lcov.info | coveralls", 12 | "prepublish": "npm run compile", 13 | "test": "babel-node ./node_modules/.bin/isparta cover _mocha" 14 | }, 15 | "devDependencies": { 16 | "babel-cli": "*", 17 | "babel-preset-es2015-node4": "*", 18 | "coveralls": "*", 19 | "chai": "*", 20 | "isparta": "*", 21 | "mocha": "*", 22 | "sinon": "*" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2015 Eugene Obrezkov 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 | # <%= answers['module:name'] %> 2 | 3 | ![Build Status](https://img.shields.io/travis/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) 4 | ![Coverage](https://img.shields.io/coveralls/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) 5 | ![Downloads](https://img.shields.io/npm/dm/<%= answers['module:name'] %>.svg) 6 | ![Downloads](https://img.shields.io/npm/dt/<%= answers['module:name'] %>.svg) 7 | ![npm version](https://img.shields.io/npm/v/<%= answers['module:name'] %>.svg) 8 | ![dependencies](https://img.shields.io/david/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) 9 | ![dev dependencies](https://img.shields.io/david/dev/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) 10 | ![License](https://img.shields.io/npm/l/<%= answers['module:name'] %>.svg) 11 | 12 | <%= answers['module:description'] %> 13 | 14 | ## Getting Started 15 | 16 | Install it via npm: 17 | 18 | ```shell 19 | npm install <%= answers['module:name'] %> 20 | ``` 21 | 22 | And include in your project: 23 | 24 | ```javascript 25 | import <%= answers['module:name'] %> from '<%= answers['module:name'] %>'; 26 | ``` 27 | 28 | ## License 29 | 30 | <%= answers['module:license'] %> 31 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-es6-npm-module", 3 | "version": "0.0.0-semantic-release", 4 | "description": "Yeoman generator for starting ES6 npm module with Mocha, Istanbul, Travis, Coveralls", 5 | "license": "MIT", 6 | "main": "generators/app/index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/ghaiklor/generator-es6-npm-module.git" 10 | }, 11 | "author": { 12 | "name": "Eugene Obrezkov", 13 | "email": "ghaiklor@gmail.com", 14 | "url": "https://github.com/ghaiklor" 15 | }, 16 | "scripts": { 17 | "coveralls": "cat coverage/lcov.info | coveralls", 18 | "semantic-release": "semantic-release pre && npm publish && semantic-release post", 19 | "test": "istanbul cover _mocha", 20 | "snyk-protect": "snyk protect", 21 | "prepublish": "npm run snyk-protect" 22 | }, 23 | "keywords": [ 24 | "yeoman-generator", 25 | "boilerplate", 26 | "scaffolder", 27 | "npm", 28 | "module", 29 | "ES6" 30 | ], 31 | "dependencies": { 32 | "yeoman-generator": "5.0.1", 33 | "yosay": "2.0.2", 34 | "snyk": "^1.336.0" 35 | }, 36 | "devDependencies": { 37 | "coveralls": "3.0.8", 38 | "cz-conventional-changelog": "3.1.0", 39 | "istanbul": "0.4.5", 40 | "mocha": "7.0.1", 41 | "semantic-release": "17.0.2", 42 | "yeoman-assert": "3.1.1", 43 | "yeoman-test": "2.2.0" 44 | }, 45 | "config": { 46 | "commitizen": { 47 | "path": "./node_modules/cz-conventional-changelog" 48 | } 49 | }, 50 | "publishConfig": { 51 | "tag": "latest" 52 | }, 53 | "release": { 54 | "branch": "master" 55 | }, 56 | "snyk": true 57 | } 58 | -------------------------------------------------------------------------------- /.snyk: -------------------------------------------------------------------------------- 1 | # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. 2 | version: v1.14.1 3 | ignore: {} 4 | # patches apply the minimum changes required to fix a vulnerability 5 | patch: 6 | SNYK-JS-LODASH-567746: 7 | - yeoman-generator > lodash: 8 | patched: '2020-05-01T03:03:08.333Z' 9 | - yeoman-generator > async > lodash: 10 | patched: '2020-05-01T03:03:08.333Z' 11 | - yeoman-generator > yeoman-environment > lodash: 12 | patched: '2020-05-01T03:03:08.333Z' 13 | - yeoman-generator > yeoman-environment > grouped-queue > lodash: 14 | patched: '2020-05-01T03:03:08.333Z' 15 | - yeoman-generator > yeoman-environment > inquirer > lodash: 16 | patched: '2020-05-01T03:03:08.333Z' 17 | - yeoman-generator > yeoman-environment > yeoman-generator > lodash: 18 | patched: '2020-05-01T03:03:08.333Z' 19 | - yeoman-generator > yeoman-environment > yeoman-generator > async > lodash: 20 | patched: '2020-05-01T03:03:08.333Z' 21 | - yeoman-generator > yeoman-environment > yeoman-generator > grouped-queue > lodash: 22 | patched: '2020-05-01T03:03:08.333Z' 23 | - yeoman-generator > yeoman-environment > yeoman-generator > yeoman-environment > lodash: 24 | patched: '2020-05-01T03:03:08.333Z' 25 | - yeoman-generator > yeoman-environment > yeoman-generator > yeoman-environment > grouped-queue > lodash: 26 | patched: '2020-05-01T03:03:08.333Z' 27 | - yeoman-generator > yeoman-environment > yeoman-generator > yeoman-environment > inquirer > lodash: 28 | patched: '2020-05-01T03:03:08.333Z' 29 | - yeoman-generator > grouped-queue > lodash: 30 | patched: '2020-06-09T07:48:52.107Z' 31 | -------------------------------------------------------------------------------- /generators/app/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const Base = require('yeoman-generator').Base; 4 | const path = require('path'); 5 | const yosay = require('yosay'); 6 | 7 | const QUESTIONS = [{ 8 | type: 'input', 9 | name: 'module:name', 10 | message: 'Module name' 11 | }, { 12 | type: 'input', 13 | name: 'module:description', 14 | message: 'Module description' 15 | }, { 16 | type: 'input', 17 | name: 'module:author:nickname', 18 | message: 'Your GitHub username' 19 | }, { 20 | type: 'input', 21 | name: 'module:author:fullName', 22 | message: 'Your full name' 23 | }, { 24 | type: 'list', 25 | name: 'module:license', 26 | message: 'Choose a license', 27 | default: 'MIT', 28 | choices: [ 29 | 'Apache-2.0', 30 | 'Artistic-2.0', 31 | 'BSD-2-Clause', 32 | 'BSD-3-Clause', 33 | 'EPL-1.0', 34 | 'GPL-2.0', 35 | 'GPL-3.0', 36 | 'ISC', 37 | 'LGPL-2.1', 38 | 'LGPL-3.0', 39 | 'MIT', 40 | 'MPL-2.0', 41 | 'Unlicense' 42 | ] 43 | }]; 44 | 45 | /** 46 | * Fetch license text from choosealicense.com 47 | * @param {String} license License ID 48 | * @param {Function} cb Callback function with license content as argument 49 | */ 50 | function fetchLicense(license, cb) { 51 | const username = 'github'; 52 | const repository = 'choosealicense.com'; 53 | const branch = 'gh-pages'; 54 | const cacheRoot = this.cacheRoot(); 55 | const sourceRoot = this.sourceRoot(); 56 | 57 | this.remote(username, repository, branch, (error, remote) => { 58 | this.sourceRoot(path.join(cacheRoot, username, repository, branch)); 59 | 60 | const content = this 61 | .read(['_licenses/', license.toLowerCase(), '.txt'].join('')) 62 | .replace(/-+[\d\D]*?-+\n\n/, '') 63 | .replace(/\[year\]/g, new Date().getFullYear()) 64 | .replace(/\[fullname\]/g, this.answers['module:author:fullName']); 65 | 66 | this.sourceRoot(sourceRoot); 67 | 68 | cb(content); 69 | }); 70 | } 71 | 72 | module.exports = class AppGenerator extends Base { 73 | prompting() { 74 | const done = this.async(); 75 | 76 | this.log(yosay('Welcome to the extraordinary ES6 npm module generator!')); 77 | this.prompt(QUESTIONS, answers => { 78 | this.answers = answers; 79 | 80 | fetchLicense.call(this, this.answers['module:license'], content => { 81 | this.write('LICENSE', content); 82 | done(); 83 | }); 84 | }); 85 | } 86 | 87 | writing() { 88 | this.directory('src', 'src'); 89 | this.directory('test', 'test'); 90 | this.copy('babelrc', '.babelrc'); 91 | this.copy('editorconfig', '.editorconfig'); 92 | this.copy('gitignore', '.gitignore'); 93 | this.copy('npmignore', '.npmignore'); 94 | this.copy('package.json', 'package.json'); 95 | this.copy('README.md', 'README.md'); 96 | this.copy('travis.yml', '.travis.yml'); 97 | } 98 | 99 | install() { 100 | this.npmInstall(); 101 | } 102 | }; 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-es6-npm-module 2 | 3 | ![Build Status](https://img.shields.io/travis/ghaiklor/generator-es6-npm-module.svg) 4 | ![Coverage](https://img.shields.io/coveralls/ghaiklor/generator-es6-npm-module.svg) 5 | 6 | ![Downloads](https://img.shields.io/npm/dm/generator-es6-npm-module.svg) 7 | ![Downloads](https://img.shields.io/npm/dt/generator-es6-npm-module.svg) 8 | ![npm version](https://img.shields.io/npm/v/generator-es6-npm-module.svg) 9 | ![License](https://img.shields.io/npm/l/generator-es6-npm-module.svg) 10 | 11 | [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) 12 | [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) 13 | ![dependencies](https://img.shields.io/david/ghaiklor/generator-es6-npm-module.svg) 14 | ![dev dependencies](https://img.shields.io/david/dev/ghaiklor/generator-es6-npm-module.svg) 15 | 16 | This generator creates empty npm module with ES6 support and integrated Travis and Coveralls services. 17 | 18 | ## Getting Started 19 | 20 | ```bash 21 | npm install -g yo generator-es6-npm-module 22 | mkdir my-project && cd my-project 23 | yo es6-npm-module 24 | ``` 25 | 26 | Or you can create folder with your project and just copy\paste this code to terminal (you should be located under your project folder) 27 | 28 | ```bash 29 | npm install -g yo generator-es6-npm-module && yo es6-npm-module 30 | ``` 31 | 32 | ## Project structure 33 | 34 | When project is generated you will get project with that structure: 35 | 36 | ``` 37 | |-- my-project 38 | |-- src 39 | | |-- index.js 40 | |-- test 41 | | |-- unit 42 | | | |-- index.test.js 43 | | |-- mocha.opts 44 | |-- .babelrc 45 | |-- .editorconfig 46 | |-- .gitignore 47 | |-- .npmignore 48 | |-- .travis.yml 49 | |-- package.json 50 | |-- LICENSE 51 | |-- README.md 52 | ``` 53 | 54 | ## License 55 | 56 | The MIT License (MIT) 57 | 58 | Copyright © 2015 Eugene Obrezkov 59 | 60 | Permission is hereby granted, free of charge, to any person obtaining a copy 61 | of this software and associated documentation files (the "Software"), to deal 62 | in the Software without restriction, including without limitation the rights 63 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 64 | copies of the Software, and to permit persons to whom the Software is 65 | furnished to do so, subject to the following conditions: 66 | 67 | The above copyright notice and this permission notice shall be included in all 68 | copies or substantial portions of the Software. 69 | 70 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 71 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 72 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 73 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 74 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 75 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 76 | SOFTWARE. 77 | --------------------------------------------------------------------------------