Skip to content

Commit

Permalink
Merge pull request #31 from feathersjs-ecosystem/refactor-package-rename
Browse files Browse the repository at this point in the history
refactor: npm package rename and general project cleanup
  • Loading branch information
toddbluhm committed Dec 22, 2020
2 parents c87a218 + 3664d70 commit dff0533
Show file tree
Hide file tree
Showing 14 changed files with 281 additions and 3,411 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [feathersjs-ecosystem]
71 changes: 71 additions & 0 deletions .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/)
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# For more information see: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'

- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
29 changes: 29 additions & 0 deletions .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 .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:
24 changes: 24 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 84
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- dependencies
- bug
- security
- enhancement
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.
Apologies if the issue could not be resolved. FeathersJS ecosystem
modules are community maintained so there may be a chance that there isn't anybody
available to address the issue at the moment.
For other ways to get help [see here](https://docs.feathersjs.com/help/readme.html).
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
# Only close stale issues
only: issues
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: ci

on: [push]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]

steps:
- name: Checkout project
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm ci

- name: Lint Files
run: npm run lint:ci

- name: Run Tests and Coverage
env:
CI: true
run: npm run cover

- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
path-to-lcov: ./coverage/lcov.info

- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Changelog

## 4.0.0

**Breaking**: Changed core dependency from `@hapi/joi` -> `joi`
**Change**: Migrate to `nyc` from `istanbul`
**Change**: Migrate to `github-actions` from `travis` (future proofing)
**Change**: Added dependabot config (future proofing)

### Consistency Changes

**Breaking**: NPM package name changed from `@featherjs-plus/validate-joi` -> `feathers-validate-joi`
**Change**: Removed yarn lockfile
**Change**: Added .github templates

## New in Version 3.2.0

Version 3.2 adds the `validateProvidedData` hook, which can be very useful in validating patch requests.

## New in Version 3.1.0

- 🙌 Updated to work with latest `joi`.
- 🎁 Support for asynchronous validations.
- 🚀 Support for FeathersJS V4.
- 😎 Validate anything in the hook `context`.
- 🤷‍♂️ It might still support FeathersJS V3, because the callback syntax is still supported.

Since `Joi.validate()` has been removed, all validations now use `schema.validateAsync()`, which means this package now supports asynchronous validations.

If you're using MongoDB, be sure to take a look at [@feathers-plus/validate-joi-mongodb](https://github.com/feathers-plus/validate-joi-mongodb) for some time-saving utilities.

## < 3.1.0

No change log was kept, please review the releases or commits to learn what was changed.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Eddyystop
Copyright (c) FeathersJS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
45 changes: 15 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
# @feathers-plus/validate-joi
# feathers-validate-joi

Feathers hook utility for schema validation and sanitization using Joi.
Joi error messages are converted to web/mobile friendly formats,
and optionally translated for clarity or internationalization.

[![Build Status](https://travis-ci.org/feathers-plus/validate-joi.svg?branch=master)](https://travis-ci.org/feathers-plus/validate-joi)
[![Coverage Status](https://coveralls.io/repos/github/feathers-plus/validate-joi/badge.svg?branch=master)](https://coveralls.io/github/feathers-plus/validate-joi?branch=master)

## New in Version 3.2

Version 3.2 adds the `validateProvidedData` hook, which can be very useful in validating patch requests.

## New in Version 3.1

- 🙌 Updated to work with latest `joi`.
- 🎁 Support for asynchronous validations.
- 🚀 Support for FeathersJS V4.
- 😎 Validate anything in the hook `context`.
- 🤷‍♂️ It might still support FeathersJS V3, because the callback syntax is still supported.

Since `Joi.validate()` has been removed, all validations now use `schema.validateAsync()`, which means this package now supports asynchronous validations.

If you're using MongoDB, be sure to take a look at [@feathers-plus/validate-joi-mongodb](https://github.com/feathers-plus/validate-joi-mongodb) for some time-saving utilities.
[![Build Status](https://github.com/feathersjs-ecosystem/validate-joi/workflows/ci/badge.svg)](https://github.com/feathersjs-ecosystem/validate-joi/actions?query=workflow%3A%22ci%22)
[![Coverage Status](https://coveralls.io/repos/github/feathersjs-ecosystem/validate-joi/badge.svg?branch=master)](https://coveralls.io/github/feathersjs-ecosystem/validate-joi?branch=master)

## Installation

```
npm install @feathers-plus/validate-joi --save
```sh
npm install feathers-validate-joi --save

yarn add @feathers-plus/validate-joi
yarn add feathers-validate-joi
```

## Usage Example

```js
const Joi = require('joi');
const validate = require('@feathers-plus/validate-joi');
const validate = require('feathers-validate-joi');

const name = Joi.string().trim().min(5).max(30)
.regex(/^[\sa-zA-Z0-9]*$/, 'letters, numbers and spaces').required();
Expand All @@ -47,8 +32,8 @@ const schema = Joi.object().keys({
const joiOptions = { convert: true, abortEarly: false };
```

(1) Validate sanitize data. The client receives any errors in a
[format suitable for forms](https://github.com/feathers-plus/joi-errors-for-forms#code-examples)
(1) Validate sanitize data. The client receives any errors in a
[format suitable for forms](https://github.com/eddyystop/joi-errors-for-forms#code-examples)
which also seems to be
[recommend by Feathers](http://docs.feathersjs.com/middleware/error-handling.html#featherserror-api).

Expand All @@ -61,7 +46,7 @@ export.before = {
```

(2) Errors are returned in a
[Mongoose format.](https://github.com/feathers-plus/joi-errors-for-forms#code-examples)
[Mongoose format.](https://github.com/eddyystop/joi-errors-for-forms#code-examples)

```js
export.before = {
Expand Down Expand Up @@ -94,7 +79,7 @@ export.before = {
```

Note: Data values in the `$set` operator are not validated.
You could use `joi-errors-for-forms` for that.
You could use `joi-errors-for-forms` for that.

## Validate Anything in the Hook Context

Expand Down Expand Up @@ -168,7 +153,7 @@ This repo helps implement this in [Feathers](http://feathersjs.com/) CRUD

## API Reference

The `joiOptions` object is passed directly to the schema, internally. You can see all of the available options and defaults [in the joi documentation](https://hapi.dev/family/joi/api/?v=17.1.0#anyvalidatevalue-options). Here is a summary of the defaults:
The `joiOptions` object is passed directly to the schema, internally. You can see all of the available options and defaults [in the joi documentation](https://joi.dev/api/?v=17.3.0#anyvalidatevalue-options). Here is a summary of the defaults:

```js
const joiDefaults = {
Expand Down Expand Up @@ -197,9 +182,9 @@ const joiDefaults = {
## A Note on Internationalization

The `options` in `Joi.validate(value, schema, options, cb)`supports a
[`language` option](https://github.com/hapijs/joi/blob/v9.0.0/API.md#validatevalue-schema-options-callback)
[`language` option](https://joi.dev/api/?v=17.3.0#anyvalidatevalue-options)
with which you can change
[Joi error messages](https://github.com/hapijs/joi/blob/v9.0.0/lib/language.js)
[Joi error messages](https://joi.dev/api/?v=17.3.0#list-of-errors)
in bulk.

You can then internationalize your field names and regex descriptions in the schema, e.g.
Expand Down

0 comments on commit dff0533

Please sign in to comment.