Update stuff
This commit is contained in:
@@ -189,20 +189,30 @@ const detectPackageCommands = async (
|
||||
scripts?: Record<string, string>;
|
||||
};
|
||||
const scripts = packageJson.scripts ?? {};
|
||||
const packageManager = (await fileExists(path.join(repoDir, 'bun.lock')))
|
||||
? 'bun'
|
||||
: (await fileExists(path.join(repoDir, 'pnpm-lock.yaml')))
|
||||
? 'pnpm'
|
||||
: (await fileExists(path.join(repoDir, 'yarn.lock')))
|
||||
? 'yarn'
|
||||
: 'npm';
|
||||
const runScript = (script: string) =>
|
||||
packageManager === 'npm'
|
||||
? `npm run ${script}`
|
||||
: `${packageManager} run ${script}`;
|
||||
|
||||
return {
|
||||
install: (await fileExists(path.join(repoDir, 'bun.lock')))
|
||||
? 'bun install'
|
||||
: (await fileExists(path.join(repoDir, 'pnpm-lock.yaml')))
|
||||
? 'pnpm install'
|
||||
: (await fileExists(path.join(repoDir, 'yarn.lock')))
|
||||
? 'yarn install'
|
||||
: 'npm install',
|
||||
install: `${packageManager} install`,
|
||||
check: scripts.typecheck
|
||||
? 'npm run typecheck'
|
||||
? runScript('typecheck')
|
||||
: scripts.lint
|
||||
? 'npm run lint'
|
||||
? runScript('lint')
|
||||
: undefined,
|
||||
test: scripts.test ? 'npm test' : undefined,
|
||||
test: scripts.test
|
||||
? packageManager === 'npm'
|
||||
? 'npm test'
|
||||
: `${packageManager} test`
|
||||
: undefined,
|
||||
};
|
||||
} catch {
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user