diff --git a/package.json b/package.json index fccd006..6303bf4 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "@types/yargs": "^17.0.32", "clean-publish": "^4.2.0", "npm-package-json-lint": "^7.1.0", + "precommit": "^1.2.2", "semantic-release": "^22.0.12", "snazzy": "^9.0.0", "ts-node": "^10.9.2", @@ -83,5 +84,8 @@ "lodash": "^4.17.21", "pino": "^8.17.2", "pino-pretty": "^10.3.1" - } + }, + "precommit": [ + "lint:fix" + ] } diff --git a/src/constants.ts b/src/constants.ts index 8aaf1f9..8f80835 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -5,10 +5,10 @@ export const DEFAULT_NPM = { } } -export const CLI_PROGRESS = (area: string) => { +export const CLI_PROGRESS = (area: string): any => { return { format: `${area} {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}`, barCompleteChar: '\u25A0', barIncompleteChar: ' ' } -}; \ No newline at end of file +} diff --git a/src/helpers.ts b/src/helpers.ts index a6dfc2c..7b19e09 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,7 +1,7 @@ import cliProgress from 'cli-progress' import fs from 'fs' import path from 'node:path' -import {CLI_PROGRESS} from "./constants.js"; +import { CLI_PROGRESS } from './constants.js' import { TemplateCopyOptions } from './types.js' /** diff --git a/src/index.ts b/src/index.ts index dc6f7b2..0f2df7c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,7 +62,7 @@ export const main = async (): Promise => { type: 'input', name: 'repoName', message: 'Project Name:', - default: npmName || defaultProjectName, + default: typeof npmName !== 'undefined' ? npmName : '', when: (answers) => answers.gitLocation === 'github' }, { type: 'input', @@ -135,9 +135,9 @@ export const main = async (): Promise => { const temp: string = process.env.NODE_ENV === 'test' ? 'temp/' : '' // create folder - let cwd: string = process.cwd() - let folder = typeof npmName !== 'undefined' ? npmName : npm - cwd = path.join(process.cwd(), `${temp}/${folder}`) + + const folder: string = typeof npmName !== 'undefined' ? npmName : npm + let cwd = path.join(process.cwd(), `${temp}/${folder}`) fs.mkdirSync(cwd, { recursive: true }) process.chdir(cwd) diff --git a/src/npm.ts b/src/npm.ts index 94c2b2e..c0742b3 100644 --- a/src/npm.ts +++ b/src/npm.ts @@ -1,7 +1,7 @@ import childProcess from 'node:child_process' import { promisify } from 'node:util' import cliProgress from 'cli-progress' -import {CLI_PROGRESS} from "./constants.js"; +import { CLI_PROGRESS } from './constants.js' import { GeneratePackageJsonInputWithOptions, GeneratePackageJsonParams @@ -148,7 +148,7 @@ export const installDeps = async (dependencies: string[], options: { dev?: boole } if (dependencies.length > 0) { - const bar = new cliProgress.SingleBar({}, CLI_PROGRESS(options.dev === true ? 'NPM DEV': 'NPM')) + const bar = new cliProgress.SingleBar({}, CLI_PROGRESS(options.dev === true ? 'NPM DEV' : 'NPM')) bar.start(dependencies.length, 0) let value = 0