diff --git a/package.json b/package.json index 50efcff..c703ccc 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "MIT", "packageManager": "yarn@3.6.4", "engines": { - "node": ">=14.8.0" + "node": ">=14" }, "bin": "lib/cli.mjs", "main": "lib/index.js", @@ -28,7 +28,8 @@ "files": [ "bin", "img", - "lib" + "lib", + "!**/*.tsbuildinfo" ], "keywords": [ "git", diff --git a/src/cli.mts b/src/cli.mts index 0c72c22..4a32c60 100755 --- a/src/cli.mts +++ b/src/cli.mts @@ -12,62 +12,69 @@ const args = mri(process.argv.slice(2), { }, }) -const prettyQuickResult = await prettyQuick(process.cwd(), { - ...args, - onFoundSinceRevision: (scm, revision) => { - console.log( - `🔍 Finding changed files since ${picocolors.bold( - scm, - )} revision ${picocolors.bold(revision)}.`, - ) - }, +const main = async () => { + const prettyQuickResult = await prettyQuick(process.cwd(), { + ...args, + onFoundSinceRevision: (scm, revision) => { + console.log( + `🔍 Finding changed files since ${picocolors.bold( + scm, + )} revision ${picocolors.bold(revision)}.`, + ) + }, - onFoundChangedFiles: changedFiles => { - console.log( - `🎯 Found ${picocolors.bold(changedFiles.length)} changed ${ - changedFiles.length === 1 ? 'file' : 'files' - }.`, - ) - }, + onFoundChangedFiles: changedFiles => { + console.log( + `🎯 Found ${picocolors.bold(changedFiles.length)} changed ${ + changedFiles.length === 1 ? 'file' : 'files' + }.`, + ) + }, - onPartiallyStagedFile: file => { - console.log(`✗ Found ${picocolors.bold('partially')} staged file ${file}.`) - }, + onPartiallyStagedFile: file => { + console.log( + `✗ Found ${picocolors.bold('partially')} staged file ${file}.`, + ) + }, - onWriteFile: file => { - console.log(`✍️ Fixing up ${picocolors.bold(file)}.`) - }, + onWriteFile: file => { + console.log(`✍️ Fixing up ${picocolors.bold(file)}.`) + }, - onCheckFile: (file, isFormatted) => { - if (!isFormatted) { - console.log(`⛔️ Check failed: ${picocolors.bold(file)}`) - } - }, + onCheckFile: (file, isFormatted) => { + if (!isFormatted) { + console.log(`⛔️ Check failed: ${picocolors.bold(file)}`) + } + }, - onExamineFile: file => { - console.log(`🔍 Examining ${picocolors.bold(file)}.`) - }, -}) + onExamineFile: file => { + console.log(`🔍 Examining ${picocolors.bold(file)}.`) + }, + }) -if (prettyQuickResult.success) { - console.log('✅ Everything is awesome!') -} else { - if (prettyQuickResult.errors.includes('PARTIALLY_STAGED_FILE')) { - console.log( - '✗ Partially staged files were fixed up.' + - ` ${picocolors.bold('Please update stage before committing')}.`, - ) - } - if (prettyQuickResult.errors.includes('BAIL_ON_WRITE')) { - console.log( - '✗ File had to be prettified and prettyQuick was set to bail mode.', - ) - } - if (prettyQuickResult.errors.includes('CHECK_FAILED')) { - console.log( - '✗ Code style issues found in the above file(s). Forgot to run Prettier?', - ) + if (prettyQuickResult.success) { + console.log('✅ Everything is awesome!') + } else { + if (prettyQuickResult.errors.includes('PARTIALLY_STAGED_FILE')) { + console.log( + '✗ Partially staged files were fixed up.' + + ` ${picocolors.bold('Please update stage before committing')}.`, + ) + } + if (prettyQuickResult.errors.includes('BAIL_ON_WRITE')) { + console.log( + '✗ File had to be prettified and prettyQuick was set to bail mode.', + ) + } + if (prettyQuickResult.errors.includes('CHECK_FAILED')) { + console.log( + '✗ Code style issues found in the above file(s). Forgot to run Prettier?', + ) + } + // eslint-disable-next-line n/no-process-exit + process.exit(1) // ensure git hooks abort } - // eslint-disable-next-line n/no-process-exit - process.exit(1) // ensure git hooks abort } + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +main() diff --git a/tsconfig.lib.json b/tsconfig.lib.json index 41ee79e..b864f7d 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -1,7 +1,4 @@ { // used by all files but do not includes paths - "extends": "@1stg/tsconfig/node16", - "compilerOptions": { - "target": "ES2017" - } + "extends": "@1stg/tsconfig/node16" }