Skip to content

Commit 152bc23

Browse files
authored
Merge pull request #157 from rtfpessoa/bump-deps
Bump deps
2 parents 4b19275 + db9760f commit 152bc23

17 files changed

+2695
-1393
lines changed

.eslintrc.js renamed to .eslintrc.cjs

+17-11
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ module.exports = {
3333
],
3434
plugins: ['@typescript-eslint', 'json', 'promise', 'import', 'node', 'sonarjs', 'jest', 'optimize-regex'],
3535
rules: {
36-
// Enable
3736
'optimize-regex/optimize-regex': 'error',
38-
// Hack: For some reason we need pass again the extensions
39-
'node/no-missing-import': [
40-
'error',
41-
{
42-
tryExtensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
43-
},
44-
],
45-
// Disable
46-
// https://github.com/benmosher/eslint-plugin-import/issues/1446
47-
'import/named': 'off',
37+
'import/no-unresolved': 'error',
38+
'node/no-missing-import': 'off',
39+
// 'node/no-missing-import': [
40+
// 'error',
41+
// {
42+
// tryExtensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
43+
// },
44+
// ],
4845
// We don't need this since we are using transpilation
4946
'node/no-unsupported-features/es-syntax': 'off',
5047
'no-process-exit': 'off',
@@ -53,4 +50,13 @@ module.exports = {
5350
// Too verbose
5451
'sonarjs/cognitive-complexity': 'off',
5552
},
53+
settings: {
54+
// This loads <rootdir>/tsconfig.json to eslint
55+
'import/resolver': {
56+
typescript: { alwaysTryTypes: true },
57+
},
58+
'import/parsers': {
59+
'@typescript-eslint/parser': ['.ts', '.tsx'],
60+
},
61+
},
5662
};

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

+33-33
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
needs: [version]
5353
strategy:
5454
matrix:
55-
node-version: [14.x, 16.x, 18.x]
55+
node-version: [16.x, 18.x, 20.x]
5656
steps:
5757
- uses: actions/checkout@v3
5858
with:
@@ -64,8 +64,8 @@ jobs:
6464
cache: 'yarn'
6565
- name: Log environment setup
6666
run: |
67-
node -v
68-
yarn -v
67+
node -v
68+
yarn -v
6969
- name: Install dependencies
7070
run: yarn install --ignore-engines
7171
- name: Build library
@@ -87,13 +87,13 @@ jobs:
8787
run: echo "version=$(cat .version)" >> $GITHUB_ENV
8888
- name: Configure Git
8989
run: |
90-
git config user.email "[email protected]"
91-
git config user.name "GitHub Actions"
90+
git config user.email "[email protected]"
91+
git config user.name "GitHub Actions"
9292
- name: Tag commit
9393
uses: tvdias/[email protected]
9494
with:
95-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
96-
tag: "${{ env.version }}"
95+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
96+
tag: '${{ env.version }}'
9797
- name: Install dependencies
9898
run: yarn
9999
- uses: actions/setup-node@v3
@@ -104,18 +104,18 @@ jobs:
104104
env:
105105
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
106106
run: |
107-
rm -f .npmrc
108-
touch .npmrc
109-
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
110-
echo "registry=https://registry.npmjs.org/" >> .npmrc
111-
echo "access=public" >> .npmrc
112-
echo "save-exact=true" >> .npmrc
113-
yarn config set version-tag-prefix ""
114-
yarn config set version-git-message "Release version %s"
107+
rm -f .npmrc
108+
touch .npmrc
109+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
110+
echo "registry=https://registry.npmjs.org/" >> .npmrc
111+
echo "access=public" >> .npmrc
112+
echo "save-exact=true" >> .npmrc
113+
yarn config set version-tag-prefix ""
114+
yarn config set version-git-message "Release version %s"
115115
- name: Version package
116116
run: |
117-
# Update version in packages to publish
118-
yarn version --non-interactive --new-version $(cat .version)
117+
# Update version in packages to publish
118+
yarn version --non-interactive --new-version $(cat .version)
119119
- name: Publish to NPM
120120
run: yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
121121
- uses: actions/setup-node@v3
@@ -126,23 +126,23 @@ jobs:
126126
env:
127127
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128128
run: |
129-
rm -f .npmrc
130-
touch .npmrc
131-
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
132-
echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc
133-
echo "access=public" >> .npmrc
134-
echo "save-exact=true" >> .npmrc
135-
yarn config set version-tag-prefix ""
136-
yarn config set version-git-message "Release version %s"
129+
rm -f .npmrc
130+
touch .npmrc
131+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
132+
echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc
133+
echo "access=public" >> .npmrc
134+
echo "save-exact=true" >> .npmrc
135+
yarn config set version-tag-prefix ""
136+
yarn config set version-git-message "Release version %s"
137137
- name: Version package
138138
run: |
139-
# Update version in packages to publish
140-
yarn version --non-interactive --new-version $(cat .version)
139+
# Update version in packages to publish
140+
yarn version --non-interactive --new-version $(cat .version)
141141
- name: Publish to GPR
142142
run: |
143-
# HACK: Override npm package name to be able to publish in GitHub
144-
sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html-cli",/g' package.json
145-
echo "Going to publish version $(cat .version) to GitHub"
146-
yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
147-
# HACK: Restore npm package name
148-
sed -i 's/^ "name":.*/ "name": "diff2html-cli",/g' package.json
143+
# HACK: Override npm package name to be able to publish in GitHub
144+
sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html-cli",/g' package.json
145+
echo "Going to publish version $(cat .version) to GitHub"
146+
yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
147+
# HACK: Restore npm package name
148+
sed -i 's/^ "name":.*/ "name": "diff2html-cli",/g' package.json

babel.config.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
3+
};

bin/diff2html

-3
This file was deleted.

bin/diff2html.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
// eslint-disable-next-line import/no-unresolved
4+
import { main } from '../lib/main.js';
5+
main();

jest.config.js

-16
This file was deleted.

jest.config.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { JestConfigWithTsJest } from 'ts-jest';
2+
3+
const jestConfig: JestConfigWithTsJest = {
4+
preset: 'ts-jest/presets/default-esm',
5+
moduleNameMapper: {
6+
'^(\\.{1,2}/.*)\\.js$': '$1',
7+
},
8+
moduleFileExtensions: ['js', 'json', 'jsx', 'node', 'ts', 'tsx'],
9+
transform: {
10+
// '^.+\\.tsx?$' to process ts with `ts-jest`
11+
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
12+
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
13+
'^.+\\.m?[tj]sx?$': [
14+
'ts-jest',
15+
{
16+
useESM: true,
17+
},
18+
],
19+
},
20+
extensionsToTreatAsEsm: ['.ts'],
21+
verbose: true,
22+
testEnvironment: 'node',
23+
coverageDirectory: './coverage',
24+
coverageProvider: 'v8',
25+
coverageReporters: ['lcov', 'text', 'html', 'json', 'cobertura', 'clover'],
26+
collectCoverageFrom: ['src/**/*.ts'],
27+
coveragePathIgnorePatterns: ['/node_modules/', 'src/__tests__/'],
28+
coverageThreshold: {
29+
global: {
30+
statements: 19,
31+
branches: 10,
32+
functions: 33,
33+
lines: 19,
34+
},
35+
},
36+
};
37+
38+
export default jestConfig;

package.json

+33-26
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"url": "https://github.com/rtfpessoa/diff2html-cli/issues"
3737
},
3838
"engines": {
39-
"node": ">=12"
39+
"node": ">=16"
4040
},
4141
"preferGlobal": true,
4242
"scripts": {
@@ -46,24 +46,24 @@
4646
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|jsx|ts|tsx|json|css|html|md|mdx)'",
4747
"format:check": "yarn run prettier --check",
4848
"format:fix": "yarn run prettier --write",
49-
"build": "yarn run build:es5",
50-
"build:es5": "rm -rf lib; tsc -p tsconfig.json --outDir lib",
49+
"build": "rm -rf lib; tsc -p tsconfig.json --outDir lib",
5150
"gen": "yarn run gen:toc",
5251
"gen:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i",
5352
"gen:toc": "yarn run gen:toc-base README.md",
5453
"test": "is-ci 'test:coverage' 'test:watch'",
55-
"test:coverage": "jest --coverage",
56-
"test:watch": "jest --watch",
57-
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
54+
"test:coverage": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage",
55+
"test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch",
56+
"test:debug": "node --experimental-vm-modules --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
5857
"coverage:open": "yarn run test:coverage && open ./coverage/index.html",
5958
"validate": "yarn run format:check && yarn run lint:check && yarn run build && yarn run test:coverage",
6059
"fix": "yarn run format:fix && yarn run lint:fix",
6160
"preversion": "yarn run validate",
6261
"version": "git add -A package.json",
6362
"prepare": "husky install"
6463
},
64+
"type": "module",
6565
"bin": {
66-
"diff2html": "./bin/diff2html"
66+
"diff2html": "./bin/diff2html.js"
6767
},
6868
"main": "./lib/diff2html.js",
6969
"types": "./lib/diff2html.d.ts",
@@ -80,37 +80,44 @@
8080
]
8181
},
8282
"dependencies": {
83-
"clipboardy": "^2.3.0",
83+
"clipboardy": "^3.0.0",
8484
"diff2html": "^3.4.19",
85-
"node-fetch": "^2.6.7",
86-
"open": "^8.4.0",
85+
"node-fetch": "^3.3.2",
86+
"open": "^9.1.0",
8787
"yargs": "^17.6.0"
8888
},
8989
"devDependencies": {
90+
"@babel/core": "^7.22.9",
91+
"@babel/preset-env": "^7.22.9",
92+
"@babel/preset-typescript": "^7.22.5",
93+
"@jest/globals": "^29.6.2",
9094
"@types/hogan.js": "^3.0.1",
91-
"@types/jest": "29.1.2",
92-
"@types/node": "18.11.0",
95+
"@types/jest": "^29.5.3",
96+
"@types/node": "20.4.8",
9397
"@types/node-fetch": "^2.6.2",
9498
"@types/request": "2.48.8",
95-
"@typescript-eslint/eslint-plugin": "5.40.0",
96-
"@typescript-eslint/parser": "5.40.0",
97-
"eslint": "8.25.0",
98-
"eslint-config-prettier": "8.5.0",
99-
"eslint-plugin-import": "2.26.0",
100-
"eslint-plugin-jest": "27.1.2",
99+
"@typescript-eslint/eslint-plugin": "6.2.1",
100+
"@typescript-eslint/parser": "6.2.1",
101+
"babel-jest": "^29.6.2",
102+
"eslint": "8.46.0",
103+
"eslint-config-prettier": "9.0.0",
104+
"eslint-import-resolver-typescript": "^3.5.5",
105+
"eslint-plugin-import": "2.28.0",
106+
"eslint-plugin-jest": "27.2.3",
101107
"eslint-plugin-json": "3.1.0",
102108
"eslint-plugin-node": "11.1.0",
103109
"eslint-plugin-optimize-regex": "1.2.1",
104-
"eslint-plugin-promise": "6.1.0",
105-
"eslint-plugin-sonarjs": "0.16.0",
106-
"husky": "8.0.1",
110+
"eslint-plugin-promise": "6.1.1",
111+
"eslint-plugin-sonarjs": "0.20.0",
112+
"husky": "8.0.3",
107113
"is-ci-cli": "2.2.0",
108-
"jest": "29.2.0",
109-
"lint-staged": "13.0.3",
114+
"jest": "29.6.2",
115+
"lint-staged": "13.2.3",
110116
"markdown-toc": "^1.2.0",
111-
"prettier": "2.7.1",
112-
"ts-jest": "29.0.3",
113-
"typescript": "4.8.4"
117+
"prettier": "3.0.1",
118+
"ts-jest": "^29.1.1",
119+
"ts-node": "^10.9.1",
120+
"typescript": "5.1.6"
114121
},
115122
"license": "MIT",
116123
"files": [

0 commit comments

Comments
 (0)