Skip to content

Commit

Permalink
Merge pull request #11 from robertoachar/generator
Browse files Browse the repository at this point in the history
Update Generator to v2.0.0
  • Loading branch information
robertoachar authored Dec 19, 2017
2 parents 0f2e62a + 4fab604 commit 2934597
Show file tree
Hide file tree
Showing 27 changed files with 194 additions and 3,322 deletions.
24 changes: 4 additions & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
{
"extends": ["prettier"],
"plugins": ["prettier"],
"env": {
"es6": true,
"mocha": true,
"node": true
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
"prettier/prettier": "error"
}
}
37 changes: 35 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,42 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm
Expand All @@ -21,5 +48,11 @@ node_modules/
# Optional REPL history
.node_repl_history

# Demo Project
awesome-project
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
package-lock = false
progress = false
save-exact = true
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"arrowParens": "always",
"singleQuote": true
}
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
language: node_js

node_js:
- "6"
- "9"

install:
- npm install

script:
- npm test

after_script:
- npm run coveralls

notifications:
email:
on_success: never
Expand Down
35 changes: 31 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,47 @@
# Changelog

## 2.0.0

### Template Updates

* **build**: update `package.json` (update keywords, remove `nodemon`, move dependencies to Generator, format using Prettier)
* **ci**: update node version on Travis, AppVeyor and CircleCI config files
* **fix**: rename `.eslintrc` to `.eslintrc.json`
* **performance**: update `.npmrc` (add `package-lock=false` and `progress=false`)
* **refactor**: update `.gitignore`
* **style**: format README using Prettier
* **style**: change eslint extends from `eslint:recommended` to `prettier`
* **style**: add prettier config file
* **test**: format using Prettier

### Generator Updates

* **build**: move dependencies from `package.json` to Generator
* **build**: remove yarn.lock
* **build**: update keywords
* **build**: update yeoman package version
* **ci**: update node version
* **docs**: update README
* **performance**: update .npmrc
* **refactor**: update .gitignore
* **style**: add prettier
* **test**: change testing tool from mocha to jest

## 1.0.10

* **Fix**: .gitattributes template
* **fix**: .gitattributes template

## 1.0.3-9

* **Fix**: npm publish
* **fix**: npm publish

## 1.0.2

* **Fix**: Installation instructions
* **fix**: Installation instructions

## 1.0.1

* **Improvement**: Updating README
* **docs**: Updating README

## 1.0.0

Expand Down
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ This generator provides the following features:
* **src** and **test** folder as a starter point to build your project.
* **EditorConfig** to help you define and maintain consistent coding styles between different editors.
* **ESLint** to provide a pluggable linting utility for JavaScript.
* **Prettier** as an opinionated code formatter.
* **Jest** as a complete and easy to set-up JavaScript testing solution used by Facebook.
* **Travis** and **CircleCI** as a continuous integration and delivery platform.
* **Appveyor** as a continuous delivery service for Windows.
* **Coveralls** to help you track your code coverage over time, and ensure that all your new code is fully covered.
* **README.md** and **CHANGELOG.md** with information about the project, installation, usage, development, author and license.
* **Badges** for Travis, Appveyor, CircleCI, Coveralls, NPM and License.
* **Badges** for Travis, Appveyor, CircleCI, Coveralls, npm and License.

## Project files
# Project files

```text
.
Expand All @@ -31,10 +32,11 @@ This generator provides the following features:
| |--- test.js
|--- .editorconfig
|--- .eslintignore
|--- .eslintrc
|--- .eslintrc.json
|--- .gitattributes
|--- .gitignore
|--- .npmrc
|--- .prettierrc
|--- .travis.yml
|--- appveyor.yml
|--- CHANGELOG.md
Expand All @@ -44,7 +46,7 @@ This generator provides the following features:
|--- README.md
```

## Installation
# Installation

* Install Yeoman

Expand All @@ -58,7 +60,7 @@ $ npm install -g yo
$ npm install -g generator-oss-project
```

## Usage
# Usage

* Creating a project

Expand All @@ -75,16 +77,16 @@ $ yo oss-project

* Running project

Action | Usage
--- | ---
Starting development mode | `npm start`
Linting code | `npm run lint`
Running unit tests | `npm run jest`
Running code coverage | `npm run coverage`
Running lint + tests | `npm test`
Sending coverage results to Coveralls.io | `npm run coveralls`
| Action | Usage |
| ---------------------------------------- | ------------------- |
| Starting development mode | `npm start` |
| Linting code | `npm run lint` |
| Running unit tests | `npm run jest` |
| Running code coverage | `npm run coverage` |
| Running lint + tests | `npm test` |
| Sending coverage results to Coveralls.io | `npm run coveralls` |

## Development
# Development

### Prerequisites

Expand Down Expand Up @@ -115,26 +117,23 @@ $ npm link
$ yo oss-project
```

## Author
# Author

[Roberto Achar](https://twitter.com/robertoachar)

## License
# License

[MIT](https://github.com/robertoachar/generator-oss-project/blob/master/LICENSE)

[travis-badge]: https://travis-ci.org/robertoachar/generator-oss-project.svg?branch=master
[travis-url]: https://travis-ci.org/robertoachar/generator-oss-project

[appveyor-badge]: https://ci.appveyor.com/api/projects/status/github/robertoachar/generator-oss-project?branch=master&svg=true
[appveyor-url]: https://ci.appveyor.com/project/robertoachar/generator-oss-project

[circleci-badge]: https://circleci.com/gh/robertoachar/generator-oss-project/tree/master.svg?style=shield
[circleci-url]: https://circleci.com/gh/robertoachar/generator-oss-project

[coveralls-badge]: https://coveralls.io/repos/github/robertoachar/generator-oss-project/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/robertoachar/generator-oss-project?branch=master

[npm-badge]: https://img.shields.io/npm/v/generator-oss-project.svg
[npm-url]: https://www.npmjs.com/package/generator-oss-project

[license-badge]: https://img.shields.io/github/license/robertoachar/generator-oss-project.svg
[license-url]: https://opensource.org/licenses/MIT
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environment:
nodejs_version: "6"
nodejs_version: "9"

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
node:
version: 6.10.3
version: 9.3.0

dependencies:
override:
Expand Down
3 changes: 2 additions & 1 deletion generators/app/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ module.exports = [
{ template: 'circle.yml.template', destination: 'circle.yml' },
{ template: 'editorconfig.template', destination: '.editorconfig' },
{ template: 'eslintignore.template', destination: '.eslintignore' },
{ template: 'eslintrc.template', destination: '.eslintrc' },
{ template: 'eslintrc.json.template', destination: '.eslintrc.json' },
{ template: 'gitattributes.template', destination: '.gitattributes' },
{ template: 'gitignore.template', destination: '.gitignore' },
{ template: 'LICENSE.template', destination: 'LICENSE' },
{ template: 'npmrc.template', destination: '.npmrc' },
{ template: 'package.json.template', destination: 'package.json' },
{ template: 'prettierrc.template', destination: '.prettierrc' },
{ template: 'README.md.template', destination: 'README.md' },
{ template: 'travis.yml.template', destination: '.travis.yml' }
];
34 changes: 25 additions & 9 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Generator = require('yeoman-generator');

const validate = require('./validate');

module.exports = class extends Generator {

initializing() {
this.log('OSS Project Generator');
this.log();
Expand All @@ -16,33 +16,33 @@ module.exports = class extends Generator {
{
type: 'input',
name: 'project',
message: 'What is the name of your project',
message: 'What is the name of your project?',
default: 'awesome-project'
},
{
type: 'input',
name: 'description',
message: 'What is the description of your project',
message: 'What is the description of your project?',
default: 'An awesome project'
},
{
type: 'input',
name: 'name',
message: 'What is your name',
message: 'What is your name?',
validate: validate.validateName,
store: store
},
{
type: 'input',
name: 'email',
message: 'What is your email',
message: 'What is your email?',
validate: validate.validateEmail,
store: store
},
{
type: 'input',
name: 'username',
message: 'What is your GitHub username',
message: 'What is your GitHub username?',
validate: validate.validateUsername,
store: store
}
Expand All @@ -55,7 +55,8 @@ module.exports = class extends Generator {
}

writing() {
this.log('Generating project...');
this.log();
this.log('🚀 Generating project...');
this.log();

const files = require('./files');
Expand All @@ -79,11 +80,26 @@ module.exports = class extends Generator {
}

install() {
this.installDependencies({ bower: false });
this.log();
this.log('📦 Installing dependencies...');
this.log();

this.npmInstall(
[
'@types/jest',
'coveralls',
'eslint',
'eslint-config-prettier',
'eslint-plugin-prettier',
'jest',
'prettier'
],
{ 'save-dev': true }
);
}

end() {
this.log();
this.log('Successfully generated!');
this.log('🎉 Successfully generated!');
}
};
Loading

0 comments on commit 2934597

Please sign in to comment.