@@ -3,7 +3,7 @@ import { dirname, join, relative } from "node:path";
33
44import { CmdService } from "../../services/CmdService" ;
55import { FileService } from "../../services/FileService" ;
6- import { GitService } from "../../services/GitService " ;
6+ import type { ManagedGitHook } from "../../services/HooksService " ;
77import type { MigrationUpFunction } from "../../services/MigrationsService" ;
88import { PackageJson } from "../../services/PackageJson" ;
99
@@ -12,11 +12,16 @@ const ESLINT_CONFIG_FILE_NAME = "eslint.config.mjs";
1212const PRE_COMMIT_HOOK_NAME = "pre-commit" ;
1313const BIOME_INIT_COMMAND = "npx @biomejs/biome init" ;
1414
15- const OLD_PRE_COMMIT_COMMAND =
16- "npx --no-install lint-staged && npx --no-install pretty-quick --staged" ;
1715const NEW_PRE_COMMIT_COMMAND =
1816 "npx --no-install biome check --error-on-warnings --staged --write" ;
1917
18+ export const hooks : ManagedGitHook [ ] = [
19+ {
20+ name : PRE_COMMIT_HOOK_NAME ,
21+ command : NEW_PRE_COMMIT_COMMAND ,
22+ } ,
23+ ] ;
24+
2025const MANAGED_ESLINT_MARKERS = [
2126 "tsDevToolsCore" ,
2227 "tsDevToolsReact" ,
@@ -83,7 +88,6 @@ export const up: MigrationUpFunction = async (
8388 enableBiomeVcsIntegration ( absoluteProjectDir ) ;
8489 migrateCommonViteStarterFiles ( absoluteProjectDir ) ;
8590 deleteManagedEslintConfig ( absoluteProjectDir , hasManagedEslintConfigFile ) ;
86- updateManagedPreCommitHook ( absoluteProjectDir ) ;
8791} ;
8892
8993async function runBiomeInit ( absoluteProjectDir : string ) : Promise < void > {
@@ -149,7 +153,7 @@ function getBiomeVcsRoot(absoluteProjectDir: string): string | undefined {
149153 return undefined ;
150154 }
151155
152- return relative ( absoluteProjectDir , vcsRootPath ) || undefined ;
156+ return relative ( absoluteProjectDir , vcsRootPath ) ;
153157}
154158
155159function getEnclosingVcsRootPath (
@@ -293,12 +297,3 @@ function deleteManagedEslintConfig(
293297
294298 unlinkSync ( eslintConfigFilePath ) ;
295299}
296-
297- function updateManagedPreCommitHook ( absoluteProjectDir : string ) : void {
298- GitService . updateGitHook (
299- absoluteProjectDir ,
300- PRE_COMMIT_HOOK_NAME ,
301- OLD_PRE_COMMIT_COMMAND ,
302- NEW_PRE_COMMIT_COMMAND ,
303- ) ;
304- }
0 commit comments