diff --git a/generators/app/index.js b/generators/app/index.js deleted file mode 100644 index 61135dd..0000000 --- a/generators/app/index.js +++ /dev/null @@ -1,126 +0,0 @@ -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _https = require('https'); - -var _https2 = _interopRequireDefault(_https); - -var _yeomanGenerator = require('yeoman-generator'); - -var _yosay = require('yosay'); - -var _yosay2 = _interopRequireDefault(_yosay); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var QUESTIONS = [{ - type: 'input', - name: 'module:name', - message: 'Module name' -}, { - type: 'input', - name: 'module:description', - message: 'Module description' -}, { - type: 'input', - name: 'module:author:nickname', - message: 'Your GitHub username' -}, { - type: 'input', - name: 'module:author:fullName', - message: 'Your full name' -}, { - 'type': 'list', - 'name': 'module:license', - 'message': 'Choose a license', - 'default': 'MIT', - 'choices': ['Apache-2.0', 'Artistic-2.0', 'BSD-2-Clause', 'BSD-3-Clause', 'EPL-1.0', 'GPL-2.0', 'GPL-3.0', 'ISC', 'LGPL-2.1', 'LGPL-3.0', 'MIT', 'MPL-2.0', 'Unlicense'] -}]; - -var LICENSE_TEMPLATE_URL = 'https://raw.githubusercontent.com/github/choosealicense.com/gh-pages/_licenses/'; - -/** - * Fetch license text from choosealicense.com - * - * @param {string} license License ID - * @param {Function} cb Callback function with license content as argument - */ -function fetchLicense(license, cb) { - var licenseURL = '' + LICENSE_TEMPLATE_URL + license.toLowerCase() + '.txt'; - _https2.default.get(licenseURL, function (res) { - var tpl = ''; - res.on('data', function (chunk) { - return tpl += chunk; - }); - res.on('end', function () { - return cb(tpl); - }); - }); -} - -module.exports = function (_Base) { - _inherits(AppGenerator, _Base); - - function AppGenerator() { - _classCallCheck(this, AppGenerator); - - return _possibleConstructorReturn(this, (AppGenerator.__proto__ || Object.getPrototypeOf(AppGenerator)).apply(this, arguments)); - } - - _createClass(AppGenerator, [{ - key: 'prompting', - value: function prompting() { - var _this2 = this; - - var done = this.async(); - - this.log((0, _yosay2.default)('Welcome to the extraordinary es2017 npm module generator!')); - this.prompt(QUESTIONS).then(function (answers) { - _this2.answers = answers; - done(); - }); - } - }, { - key: 'writing', - value: function writing() { - var _this3 = this; - - this.directory('src', 'src'); - this.directory('test', 'test'); - this.copy('babelrc', '.babelrc'); - this.copy('editorconfig', '.editorconfig'); - this.copy('gitignore', '.gitignore'); - this.copy('npmignore', '.npmignore'); - this.copy('package.json', 'package.json'); - this.copy('README.md', 'README.md'); - this.copy('travis.yml', '.travis.yml'); - - var done = this.async(); - fetchLicense.call(this, this.answers['module:license'], function (tpl) { - var content = tpl.replace(/-+[\d\D]*?-+\n\n/, '').replace(/\[year\]/g, new Date().getFullYear()).replace(/\[fullname\]/g, _this3.answers['module:author:fullName']); - _this3.write('LICENSE', content); - done(); - }); - } - }, { - key: 'install', - value: function install() { - this.npmInstall(); - } - }, { - key: 'end', - value: function end() { - this.log('Runing git init'); - this.spawnCommandSync('git', ['init', '--quiet']); - } - }]); - - return AppGenerator; -}(_yeomanGenerator.Base); diff --git a/generators/app/templates/README.md b/generators/app/templates/README.md deleted file mode 100644 index 7eaf572..0000000 --- a/generators/app/templates/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# <%= answers['module:name'] %> - -![Build Status](https://img.shields.io/travis/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) -![Coverage](https://img.shields.io/coveralls/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) -![Downloads](https://img.shields.io/npm/dm/<%= answers['module:name'] %>.svg) -![Downloads](https://img.shields.io/npm/dt/<%= answers['module:name'] %>.svg) -![npm version](https://img.shields.io/npm/v/<%= answers['module:name'] %>.svg) -![dependencies](https://img.shields.io/david/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) -![dev dependencies](https://img.shields.io/david/dev/<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>.svg) -![License](https://img.shields.io/npm/l/<%= answers['module:name'] %>.svg) - -<%= answers['module:description'] %> - -## Getting Started - -Install it via npm: - -```shell -npm install <%= answers['module:name'] %> -``` - -And include in your project: - -```javascript -import <%= answers['module:name'] %> from '<%= answers['module:name'] %>'; -``` - -## License - -<%= answers['module:license'] %> diff --git a/generators/app/templates/babelrc b/generators/app/templates/babelrc deleted file mode 100644 index 809d674..0000000 --- a/generators/app/templates/babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015", "es2016", "es2017"] -} diff --git a/generators/app/templates/editorconfig b/generators/app/templates/editorconfig deleted file mode 100644 index bc44238..0000000 --- a/generators/app/templates/editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 4 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/generators/app/templates/gitignore b/generators/app/templates/gitignore deleted file mode 100644 index 641def5..0000000 --- a/generators/app/templates/gitignore +++ /dev/null @@ -1,38 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -node_modules - -# Babel compiled sources -lib - -# Miscellaneous -*~ -*# -.DS_STORE -.netbeans -nbproject -.idea -.node_history diff --git a/generators/app/templates/npmignore b/generators/app/templates/npmignore deleted file mode 100644 index c4d0a18..0000000 --- a/generators/app/templates/npmignore +++ /dev/null @@ -1,50 +0,0 @@ -# Automatically ignored per: -# https://www.npmjs.org/doc/developers.html#Keeping-files-out-of-your-package -# -# .*.swp -# ._* -# .DS_Store -# .git -# .hg -# .lock-wscript -# .svn -# .wafpickle-* -# CVS -# npm-debug.log -# node_modules - -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz -*.orig - -work -build -src -test -pids -logs -results -coverage -lib-cov -html-report -xunit.xml - -.project -.idea -.settings -.iml -*.sublime-workspace -*.sublime-project - -ehthumbs.db -Icon? -Thumbs.db -.AppleDouble -.LSOverride -.Spotlight-V100 -.Trashes diff --git a/generators/app/templates/package.json b/generators/app/templates/package.json deleted file mode 100644 index 4fed613..0000000 --- a/generators/app/templates/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "<%= answers['module:name'] %>", - "description": "<%= answers['module:description'] %>", - "version": "0.1.0", - "main": "lib/index.js", - "author": "<%= answers['module:author:nickname'] %>", - "repository": "<%= answers['module:author:nickname'] %>/<%= answers['module:name'] %>", - "license": "<%= answers['module:license'] %>", - "scripts": { - "compile": "babel src --out-dir lib", - "coveralls": "cat ./coverage/lcov.info | coveralls", - "prepublish": "npm run compile", - "test": "babel-node ./node_modules/.bin/isparta cover _mocha" - }, - "devDependencies": { - "babel-cli": "*", - "babel-preset-es2017": "6.x", - "babel-preset-es2016": "6.x", - "babel-preset-es2015": "6.x", - "coveralls": "*", - "chai": "*", - "isparta": "*", - "mocha": "*", - "sinon": "*" - } -} diff --git a/generators/app/templates/src/index.js b/generators/app/templates/src/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/generators/app/templates/test/mocha.opts b/generators/app/templates/test/mocha.opts deleted file mode 100644 index 916505e..0000000 --- a/generators/app/templates/test/mocha.opts +++ /dev/null @@ -1,3 +0,0 @@ -./test/unit/**/*.test.js ---reporter spec ---recursive diff --git a/generators/app/templates/test/unit/index.test.js b/generators/app/templates/test/unit/index.test.js deleted file mode 100644 index e69fded..0000000 --- a/generators/app/templates/test/unit/index.test.js +++ /dev/null @@ -1 +0,0 @@ -import { assert } from 'chai'; diff --git a/generators/app/templates/travis.yml b/generators/app/templates/travis.yml deleted file mode 100644 index e988672..0000000 --- a/generators/app/templates/travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -sudo: false -node_js: - - stable - - 4