Skip to content

Commit 9a52c4c

Browse files
committed
fix(hooks): restore runVendorBin and align isSkipped implementation
1 parent fa6575f commit 9a52c4c

File tree

1 file changed

+5
-36
lines changed

1 file changed

+5
-36
lines changed

booster/.husky/shared/core.ts

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,41 +111,10 @@ export function formatDuration(ms: number): string {
111111
}
112112

113113
/**
114-
* Check if a tool should be skipped based on environment variables
115-
* @param toolName Name of the tool (e.g., 'rector', 'eslint')
114+
* Check if a tool or check is explicitly skipped via environment variable
115+
* @param name Name of the tool/check (will be converted to SKIP_<NAME>)
116116
*/
117-
export function isSkipped(toolName: string): boolean {
118-
const envVar = `SKIP_${toolName.toUpperCase().replace(/[^A-Z0-9]/g, '')}`
119-
return process.env[envVar] === '1' || process.env[envVar] === 'true'
120-
}
121-
122-
/**
123-
* Check if a vendor binary exists
124-
* @param toolName Name of the tool (e.g., 'rector')
125-
*/
126-
export async function hasVendorBin(toolName: string): Promise<boolean> {
127-
return await fs.pathExists(`./vendor/bin/${toolName}`)
128-
}
129-
130-
/**
131-
* Check if a Composer package is installed
132-
* @param packageName Name of the package (e.g., 'phpunit/phpunit')
133-
*/
134-
export async function hasComposerPackage(packageName: string): Promise<boolean> {
135-
try {
136-
const composerLockPath = './composer.lock'
137-
if (!(await fs.pathExists(composerLockPath))) {
138-
return false
139-
}
140-
141-
const lockContent = await fs.readFile(composerLockPath, 'utf8')
142-
const lockData = JSON.parse(lockContent)
143-
144-
// Check in both packages and packages-dev arrays
145-
const allPackages = [...(lockData.packages || []), ...(lockData['packages-dev'] || [])]
146-
147-
return allPackages.some((pkg: any) => pkg.name === packageName)
148-
} catch (error: unknown) {
149-
return false
150-
}
117+
export function isSkipped(name: string): boolean {
118+
const skipEnvVar = `SKIP_${name.toUpperCase()}`
119+
return process.env[skipEnvVar] === '1' || process.env[skipEnvVar] === 'true'
151120
}

0 commit comments

Comments
 (0)