Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ jobs:
paths:
- '*'

build-node-12:
<<: *common-build
docker:
- image: node:12

build-node-14:
<<: *common-build
docker:
Expand All @@ -103,6 +98,11 @@ jobs:
docker:
- image: node:16

build-node-18:
<<: *common-build
docker:
- image: node:18

tag_version:
docker:
- image: node:16
Expand Down Expand Up @@ -180,21 +180,21 @@ workflows:
validate-and-publish:
jobs:
- checkout-and-version
- build-node-12:
requires:
- checkout-and-version
- build-node-14:
requires:
- checkout-and-version
- build-node-16:
requires:
- checkout-and-version
- build-node-18:
requires:
- checkout-and-version
- publish_approval:
type: approval
requires:
- build-node-12
- build-node-14
- build-node-16
- build-node-18
- tag_version:
requires:
- publish_approval
Expand Down
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ module.exports = {
'plugin:jest/recommended',
'plugin:jest/style',
'prettier',
'prettier/@typescript-eslint',
'prettier/babel',
],
plugins: ['@typescript-eslint', 'json', 'promise', 'import', 'node', 'sonarjs', 'jest', 'optimize-regex'],
rules: {
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 0 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 120,
"proseWrap": "always",
Expand Down
60 changes: 28 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,14 @@
"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"
"version": "git add -A package.json",
"prepare": "husky install"
},
"bin": {
"diff2html": "./bin/diff2html"
},
"main": "./lib/diff2html.js",
"types": "./lib/diff2html.d.ts",
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/*.+(js|jsx|ts|tsx|json)": [
"prettier --write",
Expand All @@ -85,36 +81,36 @@
},
"dependencies": {
"clipboardy": "^2.3.0",
"diff2html": "^3.4.14",
"node-fetch": "^2.6.0",
"open": "^7.0.3",
"yargs": "^16.1.0"
"diff2html": "^3.4.19",
"node-fetch": "^2.6.7",
"open": "^8.4.0",
"yargs": "^17.6.0"
},
"devDependencies": {
"@types/hogan.js": "^3.0.0",
"@types/jest": "26.0.14",
"@types/node": "14.11.10",
"@types/node-fetch": "^2.5.6",
"@types/request": "2.48.5",
"@typescript-eslint/eslint-plugin": "4.4.1",
"@typescript-eslint/parser": "4.4.1",
"eslint": "7.11.0",
"eslint-config-prettier": "6.13.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.0",
"eslint-plugin-json": "2.1.2",
"@types/hogan.js": "^3.0.1",
"@types/jest": "29.1.2",
"@types/node": "18.11.0",
"@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",
"eslint-plugin-json": "3.1.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-optimize-regex": "1.2.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-sonarjs": "0.5.0",
"husky": "4.3.0",
"is-ci-cli": "2.1.2",
"jest": "26.5.3",
"lint-staged": "10.4.1",
"eslint-plugin-optimize-regex": "1.2.1",
"eslint-plugin-promise": "6.1.0",
"eslint-plugin-sonarjs": "0.16.0",
"husky": "8.0.1",
"is-ci-cli": "2.2.0",
"jest": "29.2.0",
"lint-staged": "13.0.3",
"markdown-toc": "^1.2.0",
"prettier": "2.1.2",
"ts-jest": "26.4.1",
"typescript": "4.0.3"
"prettier": "2.7.1",
"ts-jest": "29.0.3",
"typescript": "4.8.4"
},
"license": "MIT",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import os from 'os';
import path from 'path';

import * as clipboardy from 'clipboardy';
import clipboardy from 'clipboardy';
import open = require('open');
import { parse, html, Diff2HtmlConfig } from 'diff2html';

Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as yargs from './yargs';

export async function main(): Promise<void> {
try {
const argv = yargs.setup();
const argv = await yargs.setup();
const [diff2htmlOptions, configuration] = parseArgv(argv);

const input = await cli.getInput(configuration.inputSource, argv.extraArguments, configuration.ignore);
Expand Down Expand Up @@ -40,6 +40,8 @@ export async function main(): Promise<void> {
if (process.exitCode === undefined || process.exitCode === 0) {
process.exitCode = 1;
}
log.error(error);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const anyError = error as any;
log.error(anyError);
}
}
6 changes: 3 additions & 3 deletions src/yargs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ const choices: ArgvChoices = {
diffy: ['browser', 'pbcopy', 'print'],
};

export function setup(): Argv {
export async function setup(): Promise<Argv> {
const currentYear = new Date().getFullYear();

const argv = yargs
const argv = await yargs
.usage('Usage: diff2html [options] -- [diff args]')
.option('style', {
alias: 's',
Expand Down Expand Up @@ -254,7 +254,7 @@ export function setup(): Argv {
return {
...argv,
ignore: argv.ignore || [],
extraArguments: argv._,
extraArguments: argv._.map(e => e.toString()),
};
}

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["./src/*"],
"exclude": ["node_modules", "./src/__tests__/*"]
Expand Down
Loading