Skip to content

Commit 2d1d887

Browse files
Merge pull request #198 from robsontenorio/dev
Release v1.9.1
2 parents 53d0768 + 4c778aa commit 2d1d887

29 files changed

+1209
-573
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
build
33
coverage
4+
docs

.eslintrc

-8
This file was deleted.

.eslintrc.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
browser: true,
6+
node: true,
7+
jest: true
8+
},
9+
extends: [
10+
'eslint:recommended',
11+
'plugin:prettier/recommended',
12+
'plugin:import/errors',
13+
'plugin:import/warnings',
14+
'plugin:jest/recommended',
15+
'plugin:jest/style'
16+
],
17+
parser: 'babel-eslint',
18+
parserOptions: {
19+
ecmaVersion: 12,
20+
sourceType: 'module',
21+
allowImportExportEverywhere: false,
22+
codeFrame: true
23+
},
24+
plugins: ['prettier', 'import', 'simple-import-sort', 'jest'],
25+
ignorePatterns: ['build'],
26+
rules: {
27+
'prettier/prettier': 'error',
28+
'simple-import-sort/imports': 'warn',
29+
'simple-import-sort/exports': 'warn',
30+
31+
/* Import */
32+
'import/no-named-as-default': 'off',
33+
34+
/* Others */
35+
'no-console': 'error'
36+
},
37+
overrides: [
38+
{
39+
files: ['tests/*.js'],
40+
rules: {
41+
'no-console': 'off'
42+
}
43+
}
44+
]
45+
}

.github/workflows/test-and-release.yml

+39-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,49 @@ name: Test and Release
55

66
on:
77
push:
8-
branches: [ master, dev ]
8+
branches: [
9+
master,
10+
dev,
11+
alpha,
12+
beta,
13+
next,
14+
next-major
15+
]
916

1017
pull_request:
11-
branches: [ master, dev ]
18+
branches: [
19+
master,
20+
dev,
21+
alpha,
22+
beta,
23+
next,
24+
next-major
25+
]
1226

1327
jobs:
28+
pre_job:
29+
name: Pre Job
30+
31+
runs-on: ubuntu-latest
32+
33+
outputs:
34+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
35+
36+
steps:
37+
- id: skip_check
38+
uses: fkirc/skip-duplicate-actions@master
39+
with:
40+
github_token: ${{ github.token }}
41+
paths_ignore: '["**/*.md", ".releaserc", ".editorconfig", ".gitignore", ".eslintignore", ".prettierignore", "docs/**", ".github/**"]'
42+
do_not_skip: '["workflow_dispatch", "schedule"]'
43+
1444
test:
1545
name: Test
1646

47+
needs: pre_job
48+
49+
if: needs.pre_job.outputs.should_skip != 'true' || (github.ref != 'refs/heads/dev' && github.head_ref != 'dev' && github.base_ref != 'dev')
50+
1751
runs-on: ${{ matrix.os }}
1852

1953
strategy:
@@ -55,7 +89,7 @@ jobs:
5589

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

58-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
92+
if: github.event_name == 'push'
5993

6094
strategy:
6195
matrix:
@@ -80,8 +114,8 @@ jobs:
80114
- name: Build
81115
run: yarn build
82116

83-
- name: Test
84-
run: yarn test
117+
- name: Test and Generate Coverage
118+
run: yarn coverage
85119

86120
- name: Upload Coverage to Codecov
87121
uses: codecov/codecov-action@v1

.gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/node_modules/
2-
/build/
3-
/coverage/
1+
.idea
2+
node_modules
3+
build
4+
coverage
45
yarn-error.log
56
docker-compose.yml

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
build
3+
coverage
4+
docs

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"trailingComma": "none"
5+
}

.releaserc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"plugins": [
3+
["@semantic-release/commit-analyzer", {
4+
"releaseRules": [
5+
{"type": "chore", "scope":"deps", "release": "patch"}
6+
]
7+
}],
8+
["@semantic-release/release-notes-generator", {
9+
"writerOpts": {
10+
"headerPartial": ""
11+
}
12+
}],
13+
"@semantic-release/npm",
14+
"@semantic-release/github"
15+
]
16+
}

docs/yarn.lock

+31-31
Original file line numberDiff line numberDiff line change
@@ -2496,10 +2496,10 @@ bluebird@^3.1.1, bluebird@^3.5.1, bluebird@^3.5.5:
24962496
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
24972497
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
24982498

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

25042504
bn.js@^5.1.1:
25052505
version "5.1.3"
@@ -2572,7 +2572,7 @@ braces@^3.0.1, braces@~3.0.2:
25722572
dependencies:
25732573
fill-range "^7.0.1"
25742574

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

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

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

4850-
hmac-drbg@^1.0.0:
4850+
hmac-drbg@^1.0.1:
48514851
version "1.0.1"
48524852
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
48534853
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
@@ -5713,9 +5713,9 @@ lodash.uniq@^4.5.0:
57135713
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
57145714

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

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

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

75507550
prismjs@^1.22.0:
7551-
version "1.22.0"
7552-
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.22.0.tgz#73c3400afc58a823dd7eed023f8e1ce9fd8977fa"
7553-
integrity sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==
7551+
version "1.23.0"
7552+
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33"
7553+
integrity sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==
75547554
optionalDependencies:
75557555
clipboard "^2.0.0"
75567556

@@ -8428,9 +8428,9 @@ sprintf-js@~1.0.2:
84288428
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
84298429

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

@@ -8956,9 +8956,9 @@ typedarray@^0.0.6:
89568956
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
89578957

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

89638963
uglify-js@^3.5.1:
89648964
version "3.11.2"
@@ -9650,9 +9650,9 @@ xxhashjs@^0.2.1:
96509650
cuint "^0.2.2"
96519651

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

96579657
yallist@^2.1.2:
96589658
version "2.1.2"

jest.config.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
module.exports = {
2-
collectCoverageFrom: [
3-
"src/*.js",
4-
"!src/index.js",
5-
]
6-
};
2+
coverageDirectory: './coverage/',
3+
collectCoverageFrom: ['src/*.js', '!src/index.js']
4+
}

package.json

+11-7
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@
1111
"scripts": {
1212
"build": "babel src -d build",
1313
"lint": "eslint --ext .js .",
14-
"test": "jest --coverage",
15-
"test-watch": "jest --watch --coverage"
16-
},
17-
"jest": {
18-
"coverageDirectory": "./coverage/",
19-
"collectCoverage": true
14+
"test": "jest",
15+
"test:watch": "jest --watch",
16+
"coverage": "jest --coverage"
2017
},
2118
"repository": {
2219
"type": "git",
@@ -61,13 +58,20 @@
6158
"axios-mock-adapter": "^1.18.1",
6259
"babel-eslint": "^10.1.0",
6360
"codecov": "^3.6.5",
64-
"eslint": "^6.8.0",
61+
"eslint": "^7.18.0",
62+
"eslint-config-prettier": "^7.2.0",
63+
"eslint-plugin-import": "^2.22.1",
64+
"eslint-plugin-jest": "^24.1.3",
65+
"eslint-plugin-prettier": "^3.3.1",
66+
"eslint-plugin-simple-import-sort": "^7.0.0",
6567
"jest": "^24.1.0",
68+
"prettier": "^2.2.1",
6669
"semantic-release": "^17.2.2"
6770
},
6871
"dependencies": {
6972
"dotprop": "^1.2.0",
7073
"dset": "^2.0.1",
74+
"merge": "^2.1.1",
7175
"object-to-formdata": "^4.1.0",
7276
"qs": "^6.9.4"
7377
}

src/Builder.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* Prepare attributes to be parsed
33
*/
44

5-
import Parser from './Parser';
65
import setProp from 'dset'
76

8-
export default class Builder {
7+
import Parser from './Parser'
98

9+
export default class Builder {
1010
constructor(model) {
1111
this.model = model
1212
this.includes = []
@@ -45,7 +45,7 @@ export default class Builder {
4545
* object, and a value, which is the nested filter.
4646
*
4747
*/
48-
_nestedFilter (keys, value) {
48+
_nestedFilter(keys, value) {
4949
// Get first key from `keys` array, then remove it from array
5050
const _key = keys.shift()
5151
// Initialize an empty object
@@ -64,7 +64,9 @@ export default class Builder {
6464
*/
6565

6666
include(...relationships) {
67-
relationships = Array.isArray(relationships[0]) ? relationships[0] : relationships
67+
relationships = Array.isArray(relationships[0])
68+
? relationships[0]
69+
: relationships
6870
this.includes = relationships
6971

7072
return this
@@ -119,7 +121,9 @@ export default class Builder {
119121

120122
whereIn(key, array) {
121123
if (!Array.isArray(array)) {
122-
throw new Error('The second argument on whereIn() method must be an array.')
124+
throw new Error(
125+
'The second argument on whereIn() method must be an array.'
126+
)
123127
}
124128

125129
if (Array.isArray(key)) {

0 commit comments

Comments
 (0)