From 9ebe807e4929805aae7c8416e7718eed3f86eb98 Mon Sep 17 00:00:00 2001 From: hiroki osame Date: Thu, 16 Feb 2023 00:35:45 -0500 Subject: [PATCH] build: strict mode, use esm, and target es2020 (#52) --- package.json | 2 ++ pnpm-lock.yaml | 16 +++++++++++++++- src/cli.ts | 4 ++-- tsconfig.json | 10 ++++++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index cbbff6d..7ba0953 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "license": "MIT", "repository": "https://github.com/Nutlope/aicommits", "author": "Hassan El Mghari (@nutlope)", + "type": "module", "files": [ "dist" ], @@ -27,6 +28,7 @@ "devDependencies": { "@pvtnbr/eslint-config": "^0.33.0", "@types/ini": "^1.3.31", + "@types/inquirer": "^9.0.3", "@types/node": "^18.13.0", "eslint": "^8.34.0", "typescript": "^4.9.5" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e897b97..d361df5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,6 +3,7 @@ lockfileVersion: 5.4 specifiers: '@pvtnbr/eslint-config': ^0.33.0 '@types/ini': ^1.3.31 + '@types/inquirer': ^9.0.3 '@types/node': ^18.13.0 chalk: ^4.1.2 eslint: ^8.34.0 @@ -20,6 +21,7 @@ dependencies: devDependencies: '@pvtnbr/eslint-config': 0.33.0_7kw3g6rralp5ps6mg3uyzz6azm '@types/ini': 1.3.31 + '@types/inquirer': 9.0.3 '@types/node': 18.13.0 eslint: 8.34.0 typescript: 4.9.5 @@ -149,6 +151,13 @@ packages: resolution: {integrity: sha512-8ecxxaG4AlVEM1k9+BsziMw8UsX0qy3jYI1ad/71RrDZ+rdL6aZB0wLfAuflQiDhkD5o4yJ0uPK3OSUic3fG0w==} dev: true + /@types/inquirer/9.0.3: + resolution: {integrity: sha512-CzNkWqQftcmk2jaCWdBTf9Sm7xSw4rkI1zpU/Udw3HX5//adEZUIm9STtoRP1qgWj0CWQtJ9UTvqmO2NNjhMJw==} + dependencies: + '@types/through': 0.0.30 + rxjs: 7.8.0 + dev: true + /@types/json-schema/7.0.11: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true @@ -175,6 +184,12 @@ packages: resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} dev: true + /@types/through/0.0.30: + resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} + dependencies: + '@types/node': 18.13.0 + dev: true + /@types/unist/2.0.6: resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} dev: true @@ -2355,7 +2370,6 @@ packages: resolution: {integrity: sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==} dependencies: tslib: 2.5.0 - dev: false /safe-buffer/5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} diff --git a/src/cli.ts b/src/cli.ts index 8cb4b66..316183f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -6,7 +6,7 @@ import inquirer from 'inquirer'; import { getConfig, generateCommitMessage, -} from './utils'; +} from './utils.js'; (async () => { const config = await getConfig(); @@ -86,7 +86,7 @@ import { encoding: 'utf8', }); } catch (error) { - console.error(chalk.white('▲ ') + chalk.red(error.message)); + console.error(chalk.white('▲ ') + chalk.red((error as any).message)); process.exit(1); } })(); diff --git a/tsconfig.json b/tsconfig.json index e87b0b8..33c76d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,13 @@ { "compilerOptions": { - "target": "es2016", - "module": "commonjs", "outDir": "./dist", + "target": "ES2020", + "module": "Node16", + "strict": true, + "resolveJsonModule": true, + "isolatedModules": true, "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true }, "include": ["src"] }