Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luctst committed Jul 24, 2019
0 parents commit 8365bed
Show file tree
Hide file tree
Showing 17 changed files with 420 additions and 0 deletions.
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 = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends" : ["airbnb-base", "prettier"],
"env": {
"node": true,
"es6": true
},
"plugins": ["prettier"],
"rules": {
"prettier/prettier": 1,
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
76 changes: 76 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at lucas.tostee@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional information's**
Use a label and assign this issue to someone to get your issue done quickly -->
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea for this project
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional information's**
Use a label and assign this issue to someone to get your issue done quickly -->
21 changes: 21 additions & 0 deletions .github/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 lucas tostée

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!).
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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 (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/
package-lock.json

# 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

# next.js build output
.next

# vscode settings
.vscode
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./lib/build/
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semicolons": true,
"arrowFunctionsParentheses": "avoid",
"bracketSetting": true,
"printWidth": 90
}
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: node_js

node_js:
- "lts/*"

os:
- linux
- osx

cache:
directories:
- node_modules

before_install:
- npm i -g npm@latest

install:
- npm install

script:
- npm test
- npm run lint
- npm run style
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# repo-template
[![Build Status](https://travis-ci.com/luctst/repo-template.svg?branch=master)](https://travis-ci.com/luctst/repo-template)
[![Dependencies](https://img.shields.io/david/luctst/repo-template.svg?style=popout-square)](https://david-dm.org/luctst/repo-template)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Twitter](https://img.shields.io/twitter/follow/luctstt.svg?label=Follow&style=social)](https://twitter.com/luctstt)

Created for being reused.
Empty file added lib/index.js
Empty file.
95 changes: 95 additions & 0 deletions lib/scripts/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const readline = require("readline");
const replace = require("replace-in-file");

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
prompt: "-> "
});
const initProcess = {
steps: 0,
questions: [
"What is the name of your project ? Don't add space in the name. \n",
"Enter a description. \n",
"Enter the version of NodeJs that your project must use. \n",
"Enter the URL of your repo. \n"
],
answers: {
name: "",
description: "",
node: "",
url: ""
}
};

const replaceContent = (property, input) => {
const newAnswers = { ...initProcess.answers };
newAnswers[property] = input;
initProcess.answers = { ...newAnswers };

if (initProcess.steps !== initProcess.questions.length) {
initProcess.steps += 1;
return;
}
console.log("\x1b[35m%s\x1b[0m", "Your package.json file was configurated");

replace.sync({
files: "./package.json",
from: [/NAME/g, /DESCRIPTION/g, /VERSION/g, /REPO/g],
to: [
initProcess.answers.name,
initProcess.answers.description,
initProcess.answers.node,
initProcess.answers.url
],
countMatches: true,
allowEmptyPaths: true,
dry: true
});

process.exit(0);
};

console.log(
"\x1b[33m%s\x1b[0m",
"Before starting we need some informations to configurate your project. \n"
);
console.log("Press enter to start");

rl.on("line", input => {
if (input === "" && initProcess.steps !== 0) {
console.log("\x1b[35m%s\x1b[0m", "You should enter data !");
rl.prompt();
} else {
if (initProcess.steps !== initProcess.questions.length) {
console.log(`${initProcess.steps} - ${initProcess.questions[initProcess.steps]}`);
rl.prompt();
}

switch (initProcess.steps) {
case 0:
initProcess.steps += 1;
break;
case 1:
replaceContent("name", input);
break;
case 2:
replaceContent("description", input);
break;
case 3:
replaceContent("node", input);
break;
case 4:
replaceContent("url", input);
break;
default:
break;
}
}
}).on("close", () => {
initProcess.steps !== initProcess.questions.length &&
console.log(
"\x1b[33m%s\x1b[0m",
"You closed the program too earlier your package.json file is not completed"
);
});
Loading

0 comments on commit 8365bed

Please sign in to comment.