Skip to content

Commit

Permalink
Merge pull request #157 from rtfpessoa/bump-deps
Browse files Browse the repository at this point in the history
Bump deps
  • Loading branch information
rtfpessoa authored Aug 6, 2023
2 parents 4b19275 + db9760f commit 152bc23
Show file tree
Hide file tree
Showing 17 changed files with 2,695 additions and 1,393 deletions.
28 changes: 17 additions & 11 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,15 @@ module.exports = {
],
plugins: ['@typescript-eslint', 'json', 'promise', 'import', 'node', 'sonarjs', 'jest', 'optimize-regex'],
rules: {
// Enable
'optimize-regex/optimize-regex': 'error',
// Hack: For some reason we need pass again the extensions
'node/no-missing-import': [
'error',
{
tryExtensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
],
// Disable
// https://github.com/benmosher/eslint-plugin-import/issues/1446
'import/named': 'off',
'import/no-unresolved': 'error',
'node/no-missing-import': 'off',
// 'node/no-missing-import': [
// 'error',
// {
// tryExtensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
// },
// ],
// We don't need this since we are using transpilation
'node/no-unsupported-features/es-syntax': 'off',
'no-process-exit': 'off',
Expand All @@ -53,4 +50,13 @@ module.exports = {
// Too verbose
'sonarjs/cognitive-complexity': 'off',
},
settings: {
// This loads <rootdir>/tsconfig.json to eslint
'import/resolver': {
typescript: { alwaysTryTypes: true },
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
};
66 changes: 33 additions & 33 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
needs: [version]
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -64,8 +64,8 @@ jobs:
cache: 'yarn'
- name: Log environment setup
run: |
node -v
yarn -v
node -v
yarn -v
- name: Install dependencies
run: yarn install --ignore-engines
- name: Build library
Expand All @@ -87,13 +87,13 @@ jobs:
run: echo "version=$(cat .version)" >> $GITHUB_ENV
- name: Configure Git
run: |
git config user.email "gh-actions@users.noreply.github.com"
git config user.name "GitHub Actions"
git config user.email "gh-actions@users.noreply.github.com"
git config user.name "GitHub Actions"
- name: Tag commit
uses: tvdias/github-tagger@v0.0.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
tag: "${{ env.version }}"
repo-token: '${{ secrets.GITHUB_TOKEN }}'
tag: '${{ env.version }}'
- name: Install dependencies
run: yarn
- uses: actions/setup-node@v3
Expand All @@ -104,18 +104,18 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
rm -f .npmrc
touch .npmrc
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc
yarn config set version-tag-prefix ""
yarn config set version-git-message "Release version %s"
rm -f .npmrc
touch .npmrc
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc
yarn config set version-tag-prefix ""
yarn config set version-git-message "Release version %s"
- name: Version package
run: |
# Update version in packages to publish
yarn version --non-interactive --new-version $(cat .version)
# Update version in packages to publish
yarn version --non-interactive --new-version $(cat .version)
- name: Publish to NPM
run: yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
- uses: actions/setup-node@v3
Expand All @@ -126,23 +126,23 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -f .npmrc
touch .npmrc
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc
echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc
yarn config set version-tag-prefix ""
yarn config set version-git-message "Release version %s"
rm -f .npmrc
touch .npmrc
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc
echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc
yarn config set version-tag-prefix ""
yarn config set version-git-message "Release version %s"
- name: Version package
run: |
# Update version in packages to publish
yarn version --non-interactive --new-version $(cat .version)
# Update version in packages to publish
yarn version --non-interactive --new-version $(cat .version)
- name: Publish to GPR
run: |
# HACK: Override npm package name to be able to publish in GitHub
sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html-cli",/g' package.json
echo "Going to publish version $(cat .version) to GitHub"
yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
# HACK: Restore npm package name
sed -i 's/^ "name":.*/ "name": "diff2html-cli",/g' package.json
# HACK: Override npm package name to be able to publish in GitHub
sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html-cli",/g' package.json
echo "Going to publish version $(cat .version) to GitHub"
yarn publish --tag $(cat .tag) --non-interactive --new-version $(cat .version)
# HACK: Restore npm package name
sed -i 's/^ "name":.*/ "name": "diff2html-cli",/g' package.json
3 changes: 3 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};
3 changes: 0 additions & 3 deletions bin/diff2html

This file was deleted.

5 changes: 5 additions & 0 deletions bin/diff2html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

// eslint-disable-next-line import/no-unresolved
import { main } from '../lib/main.js';
main();
16 changes: 0 additions & 16 deletions jest.config.js

This file was deleted.

38 changes: 38 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { JestConfigWithTsJest } from 'ts-jest';

const jestConfig: JestConfigWithTsJest = {
preset: 'ts-jest/presets/default-esm',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
moduleFileExtensions: ['js', 'json', 'jsx', 'node', 'ts', 'tsx'],
transform: {
// '^.+\\.tsx?$' to process ts with `ts-jest`
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.m?[tj]sx?$': [
'ts-jest',
{
useESM: true,
},
],
},
extensionsToTreatAsEsm: ['.ts'],
verbose: true,
testEnvironment: 'node',
coverageDirectory: './coverage',
coverageProvider: 'v8',
coverageReporters: ['lcov', 'text', 'html', 'json', 'cobertura', 'clover'],
collectCoverageFrom: ['src/**/*.ts'],
coveragePathIgnorePatterns: ['/node_modules/', 'src/__tests__/'],
coverageThreshold: {
global: {
statements: 19,
branches: 10,
functions: 33,
lines: 19,
},
},
};

export default jestConfig;
59 changes: 33 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"url": "https://github.com/rtfpessoa/diff2html-cli/issues"
},
"engines": {
"node": ">=12"
"node": ">=16"
},
"preferGlobal": true,
"scripts": {
Expand All @@ -46,24 +46,24 @@
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|jsx|ts|tsx|json|css|html|md|mdx)'",
"format:check": "yarn run prettier --check",
"format:fix": "yarn run prettier --write",
"build": "yarn run build:es5",
"build:es5": "rm -rf lib; tsc -p tsconfig.json --outDir lib",
"build": "rm -rf lib; tsc -p tsconfig.json --outDir lib",
"gen": "yarn run gen:toc",
"gen:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i",
"gen:toc": "yarn run gen:toc-base README.md",
"test": "is-ci 'test:coverage' 'test:watch'",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
"test:coverage": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage",
"test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch",
"test:debug": "node --experimental-vm-modules --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
"coverage:open": "yarn run test:coverage && open ./coverage/index.html",
"validate": "yarn run format:check && yarn run lint:check && yarn run build && yarn run test:coverage",
"fix": "yarn run format:fix && yarn run lint:fix",
"preversion": "yarn run validate",
"version": "git add -A package.json",
"prepare": "husky install"
},
"type": "module",
"bin": {
"diff2html": "./bin/diff2html"
"diff2html": "./bin/diff2html.js"
},
"main": "./lib/diff2html.js",
"types": "./lib/diff2html.d.ts",
Expand All @@ -80,37 +80,44 @@
]
},
"dependencies": {
"clipboardy": "^2.3.0",
"clipboardy": "^3.0.0",
"diff2html": "^3.4.19",
"node-fetch": "^2.6.7",
"open": "^8.4.0",
"node-fetch": "^3.3.2",
"open": "^9.1.0",
"yargs": "^17.6.0"
},
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-typescript": "^7.22.5",
"@jest/globals": "^29.6.2",
"@types/hogan.js": "^3.0.1",
"@types/jest": "29.1.2",
"@types/node": "18.11.0",
"@types/jest": "^29.5.3",
"@types/node": "20.4.8",
"@types/node-fetch": "^2.6.2",
"@types/request": "2.48.8",
"@typescript-eslint/eslint-plugin": "5.40.0",
"@typescript-eslint/parser": "5.40.0",
"eslint": "8.25.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "27.1.2",
"@typescript-eslint/eslint-plugin": "6.2.1",
"@typescript-eslint/parser": "6.2.1",
"babel-jest": "^29.6.2",
"eslint": "8.46.0",
"eslint-config-prettier": "9.0.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-jest": "27.2.3",
"eslint-plugin-json": "3.1.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-optimize-regex": "1.2.1",
"eslint-plugin-promise": "6.1.0",
"eslint-plugin-sonarjs": "0.16.0",
"husky": "8.0.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-sonarjs": "0.20.0",
"husky": "8.0.3",
"is-ci-cli": "2.2.0",
"jest": "29.2.0",
"lint-staged": "13.0.3",
"jest": "29.6.2",
"lint-staged": "13.2.3",
"markdown-toc": "^1.2.0",
"prettier": "2.7.1",
"ts-jest": "29.0.3",
"typescript": "4.8.4"
"prettier": "3.0.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "5.1.6"
},
"license": "MIT",
"files": [
Expand Down
Loading

0 comments on commit 152bc23

Please sign in to comment.