Skip to content

Commit

Permalink
Merge pull request #198 from robsontenorio/dev
Browse files Browse the repository at this point in the history
Release v1.9.1
  • Loading branch information
JoaoPedroAS51 authored May 25, 2021
2 parents 53d0768 + 4c778aa commit 2d1d887
Show file tree
Hide file tree
Showing 29 changed files with 1,209 additions and 573 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
build
coverage
docs
8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

45 changes: 45 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
root: true,
env: {
es6: true,
browser: true,
node: true,
jest: true
},
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:jest/recommended',
'plugin:jest/style'
],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
allowImportExportEverywhere: false,
codeFrame: true
},
plugins: ['prettier', 'import', 'simple-import-sort', 'jest'],
ignorePatterns: ['build'],
rules: {
'prettier/prettier': 'error',
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',

/* Import */
'import/no-named-as-default': 'off',

/* Others */
'no-console': 'error'
},
overrides: [
{
files: ['tests/*.js'],
rules: {
'no-console': 'off'
}
}
]
}
44 changes: 39 additions & 5 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,49 @@ name: Test and Release

on:
push:
branches: [ master, dev ]
branches: [
master,
dev,
alpha,
beta,
next,
next-major
]

pull_request:
branches: [ master, dev ]
branches: [
master,
dev,
alpha,
beta,
next,
next-major
]

jobs:
pre_job:
name: Pre Job

runs-on: ubuntu-latest

outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}

steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths_ignore: '["**/*.md", ".releaserc", ".editorconfig", ".gitignore", ".eslintignore", ".prettierignore", "docs/**", ".github/**"]'
do_not_skip: '["workflow_dispatch", "schedule"]'

test:
name: Test

needs: pre_job

if: needs.pre_job.outputs.should_skip != 'true' || (github.ref != 'refs/heads/dev' && github.head_ref != 'dev' && github.base_ref != 'dev')

runs-on: ${{ matrix.os }}

strategy:
Expand Down Expand Up @@ -55,7 +89,7 @@ jobs:

runs-on: ${{ matrix.os }}

if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'push'

strategy:
matrix:
Expand All @@ -80,8 +114,8 @@ jobs:
- name: Build
run: yarn build

- name: Test
run: yarn test
- name: Test and Generate Coverage
run: yarn coverage

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/node_modules/
/build/
/coverage/
.idea
node_modules
build
coverage
yarn-error.log
docker-compose.yml
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
coverage
docs
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
16 changes: 16 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [
{"type": "chore", "scope":"deps", "release": "patch"}
]
}],
["@semantic-release/release-notes-generator", {
"writerOpts": {
"headerPartial": ""
}
}],
"@semantic-release/npm",
"@semantic-release/github"
]
}
62 changes: 31 additions & 31 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2496,10 +2496,10 @@ bluebird@^3.1.1, bluebird@^3.5.1, bluebird@^3.5.5:
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==

bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0:
version "4.11.9"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9:
version "4.12.0"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==

bn.js@^5.1.1:
version "5.1.3"
Expand Down Expand Up @@ -2572,7 +2572,7 @@ braces@^3.0.1, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"

brorand@^1.0.1:
brorand@^1.0.1, brorand@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
Expand Down Expand Up @@ -3893,17 +3893,17 @@ electron-to-chromium@^1.3.571:
integrity sha512-0nCJ7cSqnkMC+kUuPs0YgklFHraWGl/xHqtZWWtOeVtyi+YqkoAOMGuZQad43DscXCQI/yizcTa3u6B5r+BLww==

elliptic@^6.5.3:
version "6.5.3"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
version "6.5.4"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb"
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
dependencies:
bn.js "^4.4.0"
brorand "^1.0.1"
bn.js "^4.11.9"
brorand "^1.1.0"
hash.js "^1.0.0"
hmac-drbg "^1.0.0"
inherits "^2.0.1"
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"
hmac-drbg "^1.0.1"
inherits "^2.0.4"
minimalistic-assert "^1.0.1"
minimalistic-crypto-utils "^1.0.1"

"emoji-regex@>=6.0.0 <=6.1.1":
version "6.1.1"
Expand Down Expand Up @@ -4847,7 +4847,7 @@ hex-color-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==

hmac-drbg@^1.0.0:
hmac-drbg@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
Expand Down Expand Up @@ -5713,9 +5713,9 @@ lodash.uniq@^4.5.0:
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=

lodash@^4.15.0, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.3, lodash@^4.17.5:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

loglevel@^1.6.2:
version "1.7.0"
Expand Down Expand Up @@ -6046,7 +6046,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==

minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
Expand Down Expand Up @@ -7548,9 +7548,9 @@ prism-themes@^1.4.1:
integrity sha512-Sxk5+Wr63WxMq/sU/JYxnq5WbB0CTjv9dscGGMF91iBo3rHEJFfhZVxEsepEOMRbOQ9Exc+xySuAEaX4ATxtIQ==

prismjs@^1.22.0:
version "1.22.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.22.0.tgz#73c3400afc58a823dd7eed023f8e1ce9fd8977fa"
integrity sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==
version "1.23.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33"
integrity sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==
optionalDependencies:
clipboard "^2.0.0"

Expand Down Expand Up @@ -8428,9 +8428,9 @@ sprintf-js@~1.0.2:
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=

ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Expand Down Expand Up @@ -8956,9 +8956,9 @@ typedarray@^0.0.6:
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

ua-parser-js@^0.7.22:
version "0.7.22"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.22.tgz#960df60a5f911ea8f1c818f3747b99c6e177eae3"
integrity sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q==
version "0.7.28"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31"
integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==

uglify-js@^3.5.1:
version "3.11.2"
Expand Down Expand Up @@ -9650,9 +9650,9 @@ xxhashjs@^0.2.1:
cuint "^0.2.2"

y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==

yallist@^2.1.2:
version "2.1.2"
Expand Down
8 changes: 3 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module.exports = {
collectCoverageFrom: [
"src/*.js",
"!src/index.js",
]
};
coverageDirectory: './coverage/',
collectCoverageFrom: ['src/*.js', '!src/index.js']
}
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
"scripts": {
"build": "babel src -d build",
"lint": "eslint --ext .js .",
"test": "jest --coverage",
"test-watch": "jest --watch --coverage"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
"test": "jest",
"test:watch": "jest --watch",
"coverage": "jest --coverage"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -61,13 +58,20 @@
"axios-mock-adapter": "^1.18.1",
"babel-eslint": "^10.1.0",
"codecov": "^3.6.5",
"eslint": "^6.8.0",
"eslint": "^7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"jest": "^24.1.0",
"prettier": "^2.2.1",
"semantic-release": "^17.2.2"
},
"dependencies": {
"dotprop": "^1.2.0",
"dset": "^2.0.1",
"merge": "^2.1.1",
"object-to-formdata": "^4.1.0",
"qs": "^6.9.4"
}
Expand Down
14 changes: 9 additions & 5 deletions src/Builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Prepare attributes to be parsed
*/

import Parser from './Parser';
import setProp from 'dset'

export default class Builder {
import Parser from './Parser'

export default class Builder {
constructor(model) {
this.model = model
this.includes = []
Expand Down Expand Up @@ -45,7 +45,7 @@ export default class Builder {
* object, and a value, which is the nested filter.
*
*/
_nestedFilter (keys, value) {
_nestedFilter(keys, value) {
// Get first key from `keys` array, then remove it from array
const _key = keys.shift()
// Initialize an empty object
Expand All @@ -64,7 +64,9 @@ export default class Builder {
*/

include(...relationships) {
relationships = Array.isArray(relationships[0]) ? relationships[0] : relationships
relationships = Array.isArray(relationships[0])
? relationships[0]
: relationships
this.includes = relationships

return this
Expand Down Expand Up @@ -119,7 +121,9 @@ export default class Builder {

whereIn(key, array) {
if (!Array.isArray(array)) {
throw new Error('The second argument on whereIn() method must be an array.')
throw new Error(
'The second argument on whereIn() method must be an array.'
)
}

if (Array.isArray(key)) {
Expand Down
Loading

0 comments on commit 2d1d887

Please sign in to comment.