diff --git a/packages/@biomejs/js-api/src/index.ts b/packages/@biomejs/js-api/src/index.ts index fe1e26780621..430b70af9b16 100644 --- a/packages/@biomejs/js-api/src/index.ts +++ b/packages/@biomejs/js-api/src/index.ts @@ -101,7 +101,9 @@ export class Biome { public static async create(options: BiomeCreate): Promise { const module = await loadModule(options.distribution); const workspace = new module.Workspace(); - return new Biome(module, workspace); + const biome = new Biome(module, workspace); + biome.registerProjectFolder(); + return biome; } /** @@ -123,18 +125,24 @@ export class Biome { */ public applyConfiguration(configuration: Configuration): void { try { - this.workspace.registerProjectFolder({ - setAsCurrentWorkspace: true, - }); this.workspace.updateSettings({ configuration, gitignore_matches: [], + workspace_directory: "./", }); } catch (e) { throw wrapError(e); } } + public registerProjectFolder(): void; + public registerProjectFolder(path?: string): void { + this.workspace.registerProjectFolder({ + path, + setAsCurrentWorkspace: true, + }); + } + private tryCatchWrapper(func: () => T): T { try { return func();