Skip to content

Commit

Permalink
📦⬆️💚📄 update all da deps, add CircleCI, add license
Browse files Browse the repository at this point in the history
  • Loading branch information
nem035 committed Mar 4, 2019
1 parent 0447e67 commit ab2d091
Show file tree
Hide file tree
Showing 12 changed files with 11,094 additions and 56 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

9 changes: 0 additions & 9 deletions .babelrc.js

This file was deleted.

2 changes: 2 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 0.25%
not dead
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
jobs:
build:
working_directory: ~/seapig
docker:
- image: circleci/node:8.10
steps:
- checkout
- run:
name: Install
command: npm install
- run:
name: Checks
command: npm run prepublish
9 changes: 2 additions & 7 deletions .eslintrc → .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"parser": "babel-eslint",
"extends": [
"airbnb",
"prettier"
],
"plugins": [
"prettier"
],
"extends": ["airbnb", "prettier"],
"plugins": ["flowtype", "jest", "prettier"],
"rules": {
"react/jsx-filename-extension": 0,
"no-use-before-define": 0,
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
es/*
dist/*
package-lock.json
.vscode
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Nemanja Stojanovic

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.
24 changes: 10 additions & 14 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals describe test expect */
import React, { Children } from 'react'
import React from 'react'
import seapig, { OPTIONAL, OPTIONALS, REQUIRED, REQUIREDS } from '../src/index'

// test data
Expand All @@ -12,11 +12,7 @@ const d = <div />
const children = [a, b, c, d]
const childrenWithProp = [a, b]
const childrenWithoutProp = [c, d]
const childrenReact = Children.toArray(children)
const childrenWithSingleChildWithProp = children.slice(1)
const childrenWithSingleChildWithPropReact = Children.toArray(
childrenWithSingleChildWithProp
)

// error messages
const ERROR_MSG_ENDING_REGEX = `\\d \`${PROP}\` element(?:s|$)?`
Expand All @@ -35,8 +31,8 @@ describe('seapig', () => {
[PROP]: OPTIONAL
})
).toEqual({
[SEAPIG_PROP]: [childrenWithSingleChildWithPropReact[0]],
rest: childrenWithSingleChildWithPropReact.slice(1)
[SEAPIG_PROP]: [childrenWithSingleChildWithProp[0]],
rest: childrenWithSingleChildWithProp.slice(1)
})
})
test('for OPTIONALS', () => {
Expand All @@ -45,8 +41,8 @@ describe('seapig', () => {
[PROP]: OPTIONALS
})
).toEqual({
[SEAPIG_PROP]: childrenReact.slice(0, 2),
rest: childrenReact.slice(2)
[SEAPIG_PROP]: children.slice(0, 2),
rest: children.slice(2)
})
})
test('for REQUIRED', () => {
Expand All @@ -55,8 +51,8 @@ describe('seapig', () => {
[PROP]: REQUIRED
})
).toEqual({
[SEAPIG_PROP]: [childrenWithSingleChildWithPropReact[0]],
rest: childrenWithSingleChildWithPropReact.slice(1)
[SEAPIG_PROP]: [childrenWithSingleChildWithProp[0]],
rest: childrenWithSingleChildWithProp.slice(1)
})
})
test('for REQUIREDS', () => {
Expand All @@ -65,8 +61,8 @@ describe('seapig', () => {
[PROP]: REQUIREDS
})
).toEqual({
[SEAPIG_PROP]: childrenReact.slice(0, 2),
rest: childrenReact.slice(2)
[SEAPIG_PROP]: children.slice(0, 2),
rest: children.slice(2)
})
})
})
Expand Down Expand Up @@ -97,7 +93,7 @@ describe('seapig', () => {
})
test('should return all children as `rest` object for no schema', () => {
expect(seapig(children)).toEqual({
rest: childrenReact
rest: children
})
})
test('should return empty array under `rest` for invalid children', () => {
Expand Down
18 changes: 18 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const modules = process.env.BABEL_ENV === 'cjs' || process.env.NODE_ENV === 'test' ? 'commonjs' : false

const presets = [
[
"@babel/preset-env",
{
debug: process.env.NODE_ENV !== "production",
loose: true,
modules
}
],
"@babel/preset-react",
"@babel/preset-flow"
];

module.exports = {
presets
};
Loading

0 comments on commit ab2d091

Please sign in to comment.