Skip to content

Commit 3f86a3d

Browse files
authored
Merge pull request #7 from z-dev/node-15-modernization
Node 15 modernization
2 parents 239a3cf + 4bccbab commit 3f86a3d

10 files changed

Lines changed: 2874 additions & 678 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ecmaFeatures:
2121

2222
env:
2323
browser: true
24-
mocha: true
24+
jest: true
2525

2626
rules:
2727
arrow-body-style: 0

.github/workflows/node.js.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on: [pull_request, push]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node-version: [15.x]
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: npm install -g yarn
21+
- run: yarn install && yarn ci

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ dist
3838
build
3939

4040
.DS_Store
41+
42+
.eslintcache

customLoader.mjs

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"scripts": {
77
"check:node": "check-node-version --package",
88
"ci": "yarn run lint:js && yarn run test",
9-
"precommit": "lint-staged && yarn run lint",
109
"eslint-check": "eslint --print-config .eslintrc | eslint-config-prettier-check",
1110
"format:js": "prettier --write \"{src,test}/**/*.js\"",
1211
"postinstall": "yarn run check:node",
@@ -15,46 +14,47 @@
1514
"lint:js:without:prettier": "yarn run lint:js -- --rule 'prettier/prettier: 0'",
1615
"lint:watch": "nodemon --watch src --exec \"yarn run lint:without:prettier\"",
1716
"lint:without:prettier": "yarn run lint:js:without:prettier",
18-
"start": "node --es-module-specifier-resolution=node --experimental-loader ./customLoader.mjs src/index.js",
17+
"start": "node --es-module-specifier-resolution=node src/index.js",
1918
"start:built": "node build/index.js",
20-
"start:debug": "node inspect --es-module-specifier-resolution=node --experimental-loader ./customLoader.mjs src/index.js",
21-
"start:docker": "docker build -t lead-finder-server . && docker run --rm -it lead-finder-server",
22-
"test": "NODE_OPTIONS=\"--experimental-specifier-resolution node --experimental-loader ./customLoader.mjs\" node_modules/.bin/mocha test/index.cjs --delay",
19+
"start:debug": "node inspect --es-module-specifier-resolution=node src/index.js",
20+
"test": "node --experimental-vm-modules node_modules/.bin/jest",
2321
"test:watch": "nodemon -w src -w test --exec 'yarn run test'"
2422
},
2523
"dependencies": {
2624
"lodash": "^4.17.12"
2725
},
2826
"devDependencies": {
2927
"babel-eslint": "^7.2.3",
30-
"chai": "^4.0.1",
31-
"chai-moment": "^0.1.0",
3228
"check-node-version": "^2.1.0",
3329
"eslint": "^4.18.2",
3430
"eslint-config-airbnb-base": "^11.2.0",
3531
"eslint-config-prettier": "^2.1.0",
3632
"eslint-plugin-import": "2.2.0",
3733
"eslint-plugin-prettier": "^2.0.1",
38-
"husky": "^1.0.1",
39-
"lint-staged": "^7.3.0",
40-
"mocha": "^5.2.0",
34+
"husky": "^4.3.7",
35+
"jest": "^26.6.3",
36+
"lint-staged": "^10.5.3",
4137
"nodemon": "^1.19.4",
4238
"prettier": "^1.2.2",
4339
"sort-package-json": "^1.15.0"
4440
},
4541
"engines": {
46-
"node": ">= 13.4 < 14"
42+
"node": ">= 15.5 < 16"
4743
},
4844
"engine-strict": true,
45+
"husky": {
46+
"hooks": {
47+
"pre-commit": "lint-staged"
48+
}
49+
},
4950
"lint-staged": {
5051
"{src,test}/**/*.js": [
51-
"prettier --write",
52-
"git add"
52+
"prettier --write"
5353
],
5454
"package.json": [
55-
"sort-package-json",
56-
"git add"
57-
]
55+
"sort-package-json"
56+
],
57+
"*.js": "eslint --cache --fix"
5858
},
5959
"type": "module"
6060
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from 'lodash'
2-
import defaults from '~/config/defaults'
2+
import defaults from './config/defaults'
33

44
console.log(defaults)
55

test/index.cjs

Lines changed: 0 additions & 10 deletions
This file was deleted.

test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import assert from 'assert'
2-
import defaults from '~/config/defaults'
1+
import defaults from '../src/config/defaults'
32

43
console.log(defaults)
4+
55
describe('Array', () => {
66
describe('#indexOf()', () => {
77
it('should return -1 when the value is not present', () => {
8-
assert.equal([1, 2, 3].indexOf(4), -1)
8+
expect([1, 2, 3].indexOf(4)).toBe(-1)
99
})
1010
})
1111
})

0 commit comments

Comments
 (0)