Skip to content

Commit

Permalink
feat: Create npm package for global creation
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed May 18, 2018
1 parent 743817f commit 93e4332
Show file tree
Hide file tree
Showing 13 changed files with 4,616 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- "node"
- '8'
- '10'
before_install:
- npm install -g npm@5
- npm install -g greenkeeper-lockfile@1
before_script: greenkeeper-lockfile-update
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 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, gender identity and expression, level of experience,
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 [email protected]. 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

8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Contribute

Please contribute! Here are some things that would be great:
- Open an issue!
- Open a pull request!
- Say hi! 👋

Please abide by the [code of conduct](CODE_OF_CONDUCT.md).
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The MIT License (MIT)

Copyright (c) 2018 Burnt Fen Creative LLC

All rights reserved.

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.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,29 @@
This is where we store our auditing templates.

## Install

```sh
$ npm i -g audit-templates
```

## Usage

```sh
$ audit-templates mntnr/audit-templates
Replacing repo name and description...
Done! Created file audit-templates-audit.md.
$ audit-templates mntnr/audit-templates overthere/yeahhh.md
```

## Contribute

If you'd like to contribute, edit, or copy them, feel free to do so!

Questions? Open an issue!

Please adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).

## License

CC-BY-SA-NC © 2018 Burnt Fen Creative LLC.
[MIT](LICENSE) © 2018 Burnt Fen Creative LLC.
6 changes: 3 additions & 3 deletions audit-template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
:wave: Hey there! This is the developer experience audit from @mntnr for this repository. I've added in my thoughts below, in the form of a checklist. Looking forward to seeing what you think; let's see if we can resolve all of the open issues and make this repository shine ✨ 💖 ✨
:wave: Hey there! This is the developer experience audit from @mntnr for this repository. I've added in my thoughts below, in the form of a checklist. Looking forward to seeing what you think; let's see if we can resolve all of the open issues and make this repository shine ✨ 💖 ✨

# Repository Review: REPONAME
# Repository Review: [INSERT REPONAME]

> DESCRIPTION
> [INSERT DESCRIPTION]
_For notes on anything crossed out, look below. Note: I use `[ ]` to mean that I have proposed a fix in a PR. I know it doesn't render properly in Markdown, but it works pretty well otherwise for that purpose. If I think that something is fine, even if it isn't valid according to this checklist, I've checked it off and included a note._

Expand Down
35 changes: 35 additions & 0 deletions auditing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const fs = require('mz/fs')
const ghDescription = require('gh-description')
const mkdirp = require('mkdirp-promise')
const getDirName = require('path').dirname

module.exports = async function download (repoName, dest) {
if (!repoName) {
throw new Error('A GitHub repository directory must be provided! Format: probot/probot')
}

dest = dest || `${repoName.split('/')[1]}-audit.md`

await fs.readFile('audit-template.md').then(async res => {
console.log('Replacing repo name and description...')

let description = await ghDescription(repoName).then(async res => {
return res.description
}).catch((err) => {
console.log('Unable to get repository description', err)
})

var newContent = res.toString().replace('[INSERT REPONAME]', repoName)
.replace('[INSERT DESCRIPTION]', description)

await mkdirp(getDirName(dest)).then(async () => {
fs.writeFile(dest, newContent, 'utf8')
.catch((err) => console.log('Error writing file:', err))
.then(() => console.log(`Done! Created file ${dest}.`))
}).catch(err => {
console.log('Unable to creat directory for path.', err)
})
}).catch(error => {
console.log('Error getting file:', error)
})
}
14 changes: 14 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node
const fn = require('./')

if (process.argv.length < 3 || !process.argv.every(val => val.match(/(--help|-h)/) === null)) {
console.log('Usage: node ' + process.argv[1] + ' mntnr/audit-templates')
console.log('Or: audit-templates mntnr/audit-templates [destination: there/here.md] (if installed globally)')
process.exit(1)
}

if (process.argv[0] === 'audit-templates') {
fn(process.argv[1], process.arg[2])
} else {
fn(process.argv[2], process.argv[3])
}
Loading

0 comments on commit 93e4332

Please sign in to comment.