Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luftywiranda13 committed Aug 15, 2017
0 parents commit 6a0c864
Show file tree
Hide file tree
Showing 35 changed files with 1,198 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"projectName": "generator-node-oss",
"projectOwner": "luftywiranda13",
"files": [
"readme.md"
],
"imageSize": 100,
"commit": false,
"contributors": [
{
"login": "luftywiranda13",
"name": "Lufty Wiranda",
"avatar_url": "https://avatars0.githubusercontent.com/u/22868432?v=4",
"profile": "http://instagram.com/luftywiranda13",
"contributions": [
"code",
"doc",
"infra"
]
}
]
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
app/templates/**
coverage
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf
39 changes: 39 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--- Provide a general summary of the issue in the Title above -->

## I'm submitting a…
<!-- Check one of the following options with "x" -->
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
- [ ] Feature request
- [ ] Documentation issue or request
- [ ] Support request

## Expected Behavior
<!--- If you‘re describing a bug, tell us what should happen -->
<!--- If you‘re suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code or screenshot if relevant -->
1.
2.
3.
4.

## Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
- generator-node-oss version: <!-- run `npm ls -g generator-node-oss` -->
- yo version: <!-- run `npm ls -g yo` -->
- Node version: <!-- run `node -v` -->
- NPM version: <!-- run `npm -v` -->
- Yarn version (if you use Yarn):
- Operating system: <!-- Mac, Linux, Windows -->
- Link to your project:
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--- Provide a general summary of your changes in the Title above -->

## PR Type
<!--- What types of changes does your code introduce? -->
<!-- Put an `x` in all the boxes that apply: -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (whitespace, formatting, missing semicolons, etc.)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other… Please describe:

## Description
<!--- Describe your changes in detail -->
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Does this PR introduce a breaking change?
<!-- If this PR contains a breaking change, -->
<!-- please also describe the impact and migration path for existing applications -->
- [ ] Yes
- [ ] No

## Checklist:
<!--- Put an `x` in all the boxes that apply. -->
<!--- If you‘re unsure about any of these, don‘t hesitate to ask. We‘re here to help! -->
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the [`contributing.md`](https://github.com/luftywiranda13/generator-node-oss/blob/master/contributing.md).
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Logs
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 (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# temporary directory
/temp
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
notifications:
email: false
node_js:
- 'node'
- '6'
- '4'
after_script:
- npm install -g codecov
- codecov
branches:
only: master
126 changes: 126 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
'use strict';

const path = require('path');

const Generator = require('yeoman-generator');
const camelCase = require('lodash.camelcase');
const kebabCase = require('lodash.kebabcase');
const findUp = require('find-up');
const mkdirp = require('mkdirp');

module.exports = class extends Generator {
initializing() {
this.props = {};
}

prompting() {
return this.prompt([
{
name: 'projectName',
message: 'Project name',
default: this.appname,
},
{
name: 'description',
message: 'Description',
default: 'as cute as bunny',
store: true,
},
{
name: 'esnext',
message: 'Need ES2015+',
type: 'confirm',
default: false,
},
{
name: 'coverage',
message: 'Need code coverage',
type: 'confirm',
default: false,
},
{
name: 'name',
message: "Author's name",
default: this.user.git.name(),
store: true,
},
{
name: 'email',
message: "Author's email",
default: this.user.git.email(),
store: true,
},
{
name: 'website',
message: "Author's website",
store: true,
},
{
name: 'githubUsername',
message: 'GitHub username',
store: true,
},
]).then(answers => {
this.props = {
projectName: kebabCase(answers.projectName),
camelProject: camelCase(answers.projectName),
description: answers.description,
esnext: answers.esnext,
coverage: answers.coverage,
name: answers.name,
email: answers.email,
website: answers.website,
githubUsername: answers.githubUsername,
};
});
}

configuring() {
if (path.basename(this.destinationPath()) !== this.props.projectName) {
mkdirp(this.props.projectName);
this.destinationRoot(this.destinationPath(this.props.projectName));
}
}

default() {
this.spawnCommandSync('git', ['init'], { stdio: false });
}

writing() {
this.fs.copyTpl(
[`${this.templatePath()}/**`, '!**/_babelrc'],
this.destinationPath(),
this.props
);

const mv = (from, to) => {
this.fs.move(this.destinationPath(from), this.destinationPath(to));
};

mv('_editorconfig', '.editorconfig');
mv('_eslintignore', '.eslintignore');
mv('_eslintrc.json', '.eslintrc.json');
mv('_gitattributes', '.gitattributes');
mv('_github/issue_template.md', '.github/issue_template.md');
mv('_github/pull_request_template.md', '.github/pull_request_template.md');
mv('_gitignore', '.gitignore');
mv('_package.json', 'package.json');
mv('_test.js', 'test.js');
mv('_travis.yml', '.travis.yml');

if (this.props.esnext) {
mv('index.js', 'src/index.js');
mv('test.js', 'src/__tests__/index.test.js');
this.fs.copy(
this.templatePath('_babelrc'),
this.destinationPath('.babelrc')
);
}
}
install() {
this.installDependencies({ bower: false });
}
end() {
this.fs.delete(findUp.sync('.yo-rc.json'));
}
};
10 changes: 10 additions & 0 deletions app/templates/_babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
["env", {
"targets": { "node": 4 }
}]
],
"plugins": [
"add-module-exports"
]
}
12 changes: 12 additions & 0 deletions app/templates/_editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions app/templates/_eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage<% if (esnext) { %>
dist<% } %>
6 changes: 6 additions & 0 deletions app/templates/_eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"bunny",
"bunny/recommended"
]
}
2 changes: 2 additions & 0 deletions app/templates/_gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf
38 changes: 38 additions & 0 deletions app/templates/_github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--- Provide a general summary of the issue in the Title above -->

## I'm submitting a…
<!-- Check one of the following options with "x" -->
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
- [ ] Feature request
- [ ] Documentation issue or request
- [ ] Support request

## Expected Behavior
<!--- If you‘re describing a bug, tell us what should happen -->
<!--- If you‘re suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code or screenshot if relevant -->
1.
2.
3.
4.

## Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
- <%= projectName %> version: <!-- run `npm ls <%= projectName %>` -->
- Node version: <!-- run `node -v` -->
- NPM version: <!-- run `npm -v` -->
- Yarn version (if you use Yarn):
- Operating system: <!-- Mac, Linux, Windows -->
- Link to your project:
Loading

0 comments on commit 6a0c864

Please sign in to comment.