diff --git a/package.json b/package.json index 6876914..ce8e6ad 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "prettier": "^3.9.6", "shx": "^0.4.0", "ts-node": "^10.9.2", - "typescript": "^5" + "typescript": "^6" }, "engines": { "node": ">=18.0.0" diff --git a/src/commands/version.ts b/src/commands/version.ts index bd1edd3..21e1f60 100644 --- a/src/commands/version.ts +++ b/src/commands/version.ts @@ -2,7 +2,7 @@ import {Command, Flags, type Interfaces} from '@oclif/core' import {Ansis} from 'ansis' import {execFile} from 'node:child_process' import {EOL} from 'node:os' -import {dirname, resolve} from 'node:path' +import path from 'node:path' import which from 'which' const ansis = new Ansis() @@ -24,15 +24,15 @@ async function getNpmDetails(pkg: string): Promise { return new Promise((resolve_) => { // Resolve npm from PATH only, excluding CWD. On Windows, both execFile (CreateProcess) // and the `which` module resolve executables from CWD before PATH. - const cwd = resolve(process.cwd()) + const cwd = path.resolve(process.cwd()) const npmPath = which.sync('npm', {nothrow: true}) - if (!npmPath || dirname(resolve(npmPath)) === cwd) { + if (!npmPath || path.dirname(path.resolve(npmPath)) === cwd) { resolve_(false) return } - const useShell = /\.(cmd|bat)$/i.test(npmPath) - execFile(npmPath, ['view', pkg, '--json'], {shell: useShell}, (error, stdout) => { + const isUseShell = /\.(cmd|bat)$/iv.test(npmPath) + execFile(npmPath, ['view', pkg, '--json'], {shell: isUseShell}, (error, stdout) => { if (error) { resolve_(false) } else { diff --git a/test/tsconfig.json b/test/tsconfig.json index b9fdd63..01d9c8f 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -1,4 +1,7 @@ { "extends": "../tsconfig", - "include": ["./**/*", "../src/**/*"] + "include": ["./**/*", "../src/**/*"], + "compilerOptions": { + "rootDir": "../" + } } diff --git a/tsconfig.json b/tsconfig.json index 7eef595..8e83355 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "noUnusedParameters": true, "outDir": "./lib", "pretty": true, - "rootDirs": ["./src"], + "rootDir": "./src", + "types": ["node", "mocha"], "strict": true, "target": "ES2024", "moduleResolution": "Node16" diff --git a/yarn.lock b/yarn.lock index 58f8ff4..c4e547a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5143,10 +5143,10 @@ typescript-eslint@^8.64.0, typescript-eslint@^8.66.0: "@typescript-eslint/typescript-estree" "8.67.0" "@typescript-eslint/utils" "8.67.0" -typescript@^5: - version "5.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" - integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== +typescript@^6: + version "6.0.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.3.tgz#90251dc007916e972786cb94d74d15b185577d21" + integrity sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw== undici-types@~5.26.4: version "5.26.5"