Skip to content

Commit f64e275

Browse files
authored
fix: update dependencies and npm bundle (#145)
1 parent e26df56 commit f64e275

11 files changed

+4242
-1967
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ jobs:
44
test:
55
runs-on: ubuntu-latest
66
strategy:
7+
fail-fast: false
78
matrix:
89
node: [10, 12]
910
steps:

__tests__/order.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
12
import order from '../src/order';
23
import {PropertyMap} from '../src/models';
34

__tests__/stringify.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
12
import stringify from '../src/stringify';
23
import {PropertyMap} from '../src/models';
34

package.json

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "json-order",
33
"version": "0.0.0-development",
44
"description": "Control the order of properties in JSON via a lookup object - including nested properties.",
5-
"main": "src/index.js",
6-
"types": "src/index.d.ts",
5+
"main": "index.js",
6+
"types": "index.d.ts",
77
"files": [
8-
"src"
8+
"dist"
99
],
1010
"repository": {
1111
"type": "git",
@@ -20,15 +20,14 @@
2020
"test:cover": "jest --coverage",
2121
"test:watch": "jest --watch",
2222
"test:ci": "jest --ci --coverage",
23-
"compile": "tsc",
23+
"compile": "tsc -p tsconfig.build.json",
2424
"lint": "eslint **/*.{t,j}s",
2525
"lint:fix": "yarn lint --fix",
2626
"semantic-release": "semantic-release"
2727
},
2828
"lint-staged": {
2929
"*.{{t,j}s{,x}}": [
30-
"eslint --fix",
31-
"git add"
30+
"eslint --fix"
3231
]
3332
},
3433
"husky": {
@@ -50,22 +49,20 @@
5049
"@types/babel__core": "^7.1.10",
5150
"@types/jest": "^26.0.3",
5251
"@types/lodash.clonedeep": "^4.5.6",
53-
"@typescript-eslint/eslint-plugin": "^2.12.0",
54-
"@typescript-eslint/parser": "^2.12.0",
55-
"eslint": "^6.8.0",
52+
"@typescript-eslint/eslint-plugin": "^4.4.0",
53+
"@typescript-eslint/parser": "^4.4.0",
54+
"eslint": "^7.10.0",
5655
"eslint-config-prettier": "^6.7.0",
5756
"eslint-plugin-import": "^2.19.1",
58-
"eslint-plugin-jest": "^23.1.1",
57+
"eslint-plugin-jest": "^24.1.0",
5958
"eslint-plugin-prettier": "^3.1.2",
6059
"husky": "^4.0.1",
61-
"jest": "^25.1.0",
62-
"jest-junit": "^11.0.1",
63-
"lint-staged": "8.2.1",
64-
"prettier": "^1.19.1",
65-
"ts-jest": "^25.0.0",
66-
"tslint": "^6.0.0",
67-
"typescript": "3.9.7",
68-
"semantic-release": "^17.1.2"
60+
"jest": "^26.5.2",
61+
"lint-staged": "10.4.0",
62+
"prettier": "^2.1.2",
63+
"semantic-release": "^17.1.2",
64+
"ts-jest": "^26.4.1",
65+
"typescript": "4.0.3"
6966
},
7067
"dependencies": {
7168
"lodash.clonedeep": "^4.5.0"

src/order.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
2+
13
import clonedeep from 'lodash.clonedeep';
24
import {PropertyMap} from './models';
35

@@ -15,7 +17,7 @@ const getProperty = (
1517

1618
const value = key
1719
.split(separator)
18-
.filter(s => s.length > 0)
20+
.filter((s) => s.length > 0)
1921
.reduce((o: object, x: string) => {
2022
exists = o && o.hasOwnProperty(x);
2123

@@ -37,11 +39,11 @@ const setProperty = (
3739
) => {
3840
key
3941
.split(separator)
40-
.filter(s => s.length > 0)
42+
.filter((s) => s.length > 0)
4143
.reduce((o: object, x: string, idx: number, src: Array<string>): object => {
4244
if (idx === src.length - 1) {
4345
const valueToSet = Array.isArray(value)
44-
? clonedeep(value).map(p => (typeof p === 'object' ? {} : p))
46+
? clonedeep(value).map((p) => (typeof p === 'object' ? {} : p))
4547
: value;
4648
o[x] = valueToSet;
4749
}
@@ -87,7 +89,7 @@ const order = <T extends object>(
8789
const prefixLength = (mapKeys[0] && mapKeys[0].length) || 0;
8890

8991
const resultObject = {};
90-
mapKeys.forEach(mk => {
92+
mapKeys.forEach((mk) => {
9193
const childKeys = map[mk];
9294

9395
// Remove prefix
@@ -102,7 +104,7 @@ const order = <T extends object>(
102104
setProperty(resultObject, parentKey, defaultValue, separator);
103105

104106
// Fetch value from source and set on output
105-
childKeys.forEach(key =>
107+
childKeys.forEach((key) =>
106108
copyProperty(
107109
sourceObject,
108110
resultObject,

src/parse.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
2+
13
import {OrderedParseResult, PropertyMap} from './models';
24

35
const traverseObject = <T extends object>(
@@ -17,7 +19,7 @@ const traverseObject = <T extends object>(
1719
map[`${parentKey}`] = childKeys;
1820
}
1921

20-
childKeys.forEach(childKey => {
22+
childKeys.forEach((childKey) => {
2123
const value = obj[childKey];
2224

2325
if (typeof value === 'object') {

src/stringify.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
2+
13
import {PropertyMap} from './models';
24
import order from './order';
35

tsconfig.base.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"esModuleInterop": true,
5+
"target": "es5",
6+
"sourceMap": false,
7+
"allowJs": false,
8+
"moduleResolution": "node",
9+
"outDir": "dist",
10+
"forceConsistentCasingInFileNames": true,
11+
"noImplicitReturns": true,
12+
"noImplicitThis": true,
13+
"noImplicitAny": true,
14+
"strict": true,
15+
"suppressImplicitAnyIndexErrors": true,
16+
"noUnusedLocals": true,
17+
"allowSyntheticDefaultImports": true,
18+
"lib": [
19+
"es2015",
20+
],
21+
"declaration": true
22+
},
23+
"exclude": [
24+
"node_modules",
25+
"jest.config.js",
26+
"commitlint.config.js",
27+
]
28+
}

tsconfig.build.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"files": ["src/index.ts"],
4+
"include": ["src"]
5+
}

tsconfig.json

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,4 @@
11
{
2-
"compilerOptions": {
3-
"module": "commonjs",
4-
"esModuleInterop": true,
5-
"target": "es5",
6-
"sourceMap": false,
7-
"allowJs": false,
8-
"moduleResolution": "node",
9-
"outDir": "dist",
10-
"forceConsistentCasingInFileNames": true,
11-
"noImplicitReturns": true,
12-
"noImplicitThis": true,
13-
"noImplicitAny": true,
14-
"strict": true,
15-
"suppressImplicitAnyIndexErrors": true,
16-
"noUnusedLocals": true,
17-
"allowSyntheticDefaultImports": true,
18-
"lib": [
19-
"es2015",
20-
],
21-
"declaration": true
22-
},
23-
"include": [
24-
"src",
25-
"__tests__"
26-
],
27-
"exclude": [
28-
"node_modules",
29-
"jest.config.js",
30-
"commitlint.config.js"
31-
]
2+
"extends": "./tsconfig.base.json",
3+
"include": ["src", "__tests__"]
324
}

0 commit comments

Comments
 (0)