Skip to content

Commit

Permalink
Initial plugin setup
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Aug 21, 2018
1 parent 042bf34 commit b017904
Show file tree
Hide file tree
Showing 16 changed files with 3,181 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/express/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": [ "add-module-exports" ],
"presets": [ "es2015" ]
}
13 changes: 13 additions & 0 deletions packages/express/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
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
71 changes: 71 additions & 0 deletions packages/express/.github/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Contributing to Feathers

Thank you for contributing to Feathers! :heart: :tada:

This repo is the main core and where most issues are reported. Feathers embraces modularity and is broken up across many repos. To make this easier to manage we currently use [Zenhub](https://www.zenhub.com/) for issue triage and visibility. They have a free browser plugin you can install so that you can see what is in flight at any time, but of course you also always see current issues in Github.

## Report a bug

Before creating an issue please make sure you have checked out the docs, specifically the [FAQ](https://docs.feathersjs.com/help/faq.html) section. You might want to also try searching Github. It's pretty likely someone has already asked a similar question.

If you haven't found your answer please feel free to join our [slack channel](http://slack.feathersjs.com), create an issue on Github, or post on [Stackoverflow](http://stackoverflow.com) using the `feathers` or `feathersjs` tag. We try our best to monitor Stackoverflow but you're likely to get more immediate responses in Slack and Github.

Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.

## Report a Security Concern

We take security very seriously at Feathers. We welcome any peer review of our 100% open source code to ensure nobody's Feathers app is ever compromised or hacked. As a web application developer you are responsible for any security breaches. We do our very best to make sure Feathers is as secure as possible by default.

In order to give the community time to respond and upgrade we strongly urge you report all security issues to us. Send one of the core team members a PM in [Slack](http://slack.feathersjs.com) or email us at hello@feathersjs.com with details and we will respond ASAP.

For full details refer to our [Security docs](https://docs.feathersjs.com/SECURITY.html).

## Pull Requests

We :heart: pull requests and we're continually working to make it as easy as possible for people to contribute, including a [Plugin Generator](https://github.com/feathersjs/generator-feathers-plugin) and a [common test suite](https://github.com/feathersjs/feathers-service-tests) for database adapters.

We prefer small pull requests with minimal code changes. The smaller they are the easier they are to review and merge. A core team member will pick up your PR and review it as soon as they can. They may ask for changes or reject your pull request. This is not a reflection of you as an engineer or a person. Please accept feedback graciously as we will also try to be sensitive when providing it.

Although we generally accept many PRs they can be rejected for many reasons. We will be as transparent as possible but it may simply be that you do not have the same context or information regarding the roadmap that the core team members have. We value the time you take to put together any contributions so we pledge to always be respectful of that time and will try to be as open as possible so that you don't waste it. :smile:

**All PRs (except documentation) should be accompanied with tests and pass the linting rules.**

### Code style

Before running the tests from the `test/` folder `npm test` will run ESlint. You can check your code changes individually by running `npm run lint`.

### ES6 compilation

Feathers uses [Babel](https://babeljs.io/) to leverage the latest developments of the JavaScript language. All code and samples are currently written in ES2015. To transpile the code in this repository run

> npm run compile
__Note:__ `npm test` will run the compilation automatically before the tests.

### Tests

[Mocha](http://mochajs.org/) tests are located in the `test/` folder and can be run using the `npm run mocha` or `npm test` (with ESLint and code coverage) command.

### Documentation

Feathers documentation is contained in Markdown files in the [feathers-docs](https://github.com/feathersjs/feathers-docs) repository. To change the documentation submit a pull request to that repo, referencing any other PR if applicable, and the docs will be updated with the next release.

## External Modules

If you're written something awesome for Feathers, the Feathers ecosystem, or using Feathers please add it to the [showcase](https://docs.feathersjs.com/why/showcase.html). You also might want to check out the [Plugin Generator](https://github.com/feathersjs/generator-feathers-plugin) that can be used to scaffold plugins to be Feathers compliant from the start.

If you think it would be a good core module then please contact one of the Feathers core team members in [Slack](http://slack.feathersjs.com) and we can discuss whether it belongs in core and how to get it there. :beers:

## Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

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. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
29 changes: 29 additions & 0 deletions packages/express/.github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Steps to reproduce

(First please check that this issue is not already solved as [described
here](https://github.com/feathersjs/feathers/blob/master/.github/contributing.md#report-a-bug))

- [ ] Tell us what broke. The more detailed the better.
- [ ] If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

### Expected behavior
Tell us what should happen

### Actual behavior
Tell us what happens instead

### System configuration

Tell us about the applicable parts of your setup.

**Module versions** (especially the part that's not working):

**NodeJS version**:

**Operating System**:

**Browser Version**:

**React Native Version**:

**Module Loader**:
22 changes: 22 additions & 0 deletions packages/express/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Summary

(If you have not already please refer to the contributing guideline as [described
here](https://github.com/feathersjs/feathers/blob/master/.github/contributing.md#pull-requests))

- [ ] Tell us about the problem your pull request is solving.
- [ ] Are there any open issues that are related to this?
- [ ] Is this PR dependent on PRs in other repos?

If so, please mention them to keep the conversations linked together.

### Other Information

If there's anything else that's important and relevant to your pull
request, mention that information here. This could include
benchmarks, or other information.

Your PR will be reviewed by a core team member and they will work with you to get your changes merged in a timely manner. If merged your PR will automatically be added to the changelog in the next release.

If your changes involve documentation updates please mention that and link the appropriate PR in [feathers-docs](https://github.com/feathersjs/feathers-docs).

Thanks for contributing to Feathers! :heart:
33 changes: 33 additions & 0 deletions packages/express/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.DS_Store

# 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

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

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript

# The compiled/babelified modules
lib/
17 changes: 17 additions & 0 deletions packages/express/.istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
verbose: false
instrumentation:
root: ./src/
excludes:
- lib/
include-all-sources: true
reporting:
print: summary
reports:
- html
- text
- lcov
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
9 changes: 9 additions & 0 deletions packages/express/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.editorconfig
.jshintrc
.travis.yml
.istanbul.yml
.babelrc
.idea/
src/
test/
!lib/
14 changes: 14 additions & 0 deletions packages/express/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js
node_js:
- 'node'
- '6'
- '4'
addons:
code_climate:
repo_token: 'your repo token'
notifications:
email: false
before_script:
- npm install -g codeclimate-test-reporter
after_script:
- codeclimate-test-reporter < coverage/lcov.info
22 changes: 22 additions & 0 deletions packages/express/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2016 Feathers

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.

53 changes: 53 additions & 0 deletions packages/express/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# feathers-express

[![Build Status](https://travis-ci.org/feathersjs/feathers-express.png?branch=master)](https://travis-ci.org/feathersjs/feathers-express)
[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-express/badges/gpa.svg)](https://codeclimate.com/github/feathersjs/feathers-express)
[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-express/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-express/coverage)
[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-express.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-express)
[![Download Status](https://img.shields.io/npm/dm/feathers-express.svg?style=flat-square)](https://www.npmjs.com/package/feathers-express)

> Feathers Express framework bindings and REST provider
## Installation

```
npm install feathers-express --save
```

## Documentation

Please refer to the [feathers-express documentation](http://docs.feathersjs.com/) for more details.

## Complete Example

Here's an example of a Feathers server that uses `feathers-express`.

```js
const feathers = require('feathers');
const rest = require('feathers-rest');
const hooks = require('feathers-hooks');
const bodyParser = require('body-parser');
const errorHandler = require('feathers-errors/handler');
const plugin = require('feathers-express');

// Initialize the application
const app = feathers()
.configure(rest())
.configure(hooks())
// Needed for parsing bodies (login)
.use(bodyParser.json())
.use(bodyParser.urlencoded({ extended: true }))
// Initialize your feathers plugin
.use('/plugin', plugin())
.use(errorHandler());

app.listen(3030);

console.log('Feathers app started on 127.0.0.1:3030');
```

## License

Copyright (c) 2016

Licensed under the [MIT license](LICENSE).
2 changes: 2 additions & 0 deletions packages/express/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--recursive test/
--compilers js:babel-core/register
67 changes: 67 additions & 0 deletions packages/express/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "feathers-express",
"description": "Feathers Express framework bindings and REST provider",
"version": "0.0.0",
"homepage": "https://github.com/feathersjs/feathers-express",
"main": "lib/",
"keywords": [
"feathers",
"feathers-plugin"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/feathersjs/feathers-express.git"
},
"author": {
"name": "Feathers contributors",
"email": "hello@feathersjs.com",
"url": "https://feathersjs.com"
},
"contributors": [],
"bugs": {
"url": "https://github.com/feathersjs/feathers-express/issues"
},
"engines": {
"node": ">= 4.6.0"
},
"scripts": {
"prepublish": "npm run compile",
"publish": "git push origin --tags && npm run changelog && git push origin",
"release:patch": "npm version patch && npm publish",
"release:minor": "npm version minor && npm publish",
"release:major": "npm version major && npm publish",
"changelog": "github_changelog_generator && git add CHANGELOG.md && git commit -am \"Updating changelog\"",
"compile": "shx rm -rf lib/ && babel -d lib/ src/",
"watch": "babel --watch -d lib/ src/",
"lint": "semistandard src/**/*.js test/**/*.js --fix",
"mocha": "mocha --opts mocha.opts",
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --opts mocha.opts",
"test": "npm run compile && npm run lint && npm run coverage",
"start": "npm run compile && node example/app"
},
"semistandard": {
"sourceType": "module",
"env": [
"mocha"
]
},
"directories": {
"lib": "lib"
},
"dependencies": {
"debug": "^2.6.8",
"feathers-errors": "^2.8.1"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.24.1",
"chai": "^3.5.0",
"istanbul": "^1.1.0-alpha.1",
"mocha": "^3.4.2",
"semistandard": "^11.0.0",
"shx": "^0.2.2"
}
}
9 changes: 9 additions & 0 deletions packages/express/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// import errors from 'feathers-errors';
import makeDebug from 'debug';

const debug = makeDebug('feathers-express');

export default function init () {
debug('Initializing feathers-express plugin');
return 'feathers-express';
}
13 changes: 13 additions & 0 deletions packages/express/test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect } from 'chai';
import plugin from '../src';

describe('feathers-express', () => {
it('is CommonJS compatible', () => {
expect(typeof require('../lib')).to.equal('function');
});

it('basic functionality', () => {
expect(typeof plugin).to.equal('function', 'It worked');
expect(plugin()).to.equal('feathers-express');
});
});
Loading

0 comments on commit b017904

Please sign in to comment.