diff --git a/packages/sdk/package.json b/packages/sdk/package.json index f704f2ca5..7f37f19fa 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -25,7 +25,6 @@ "@zenstackhq/runtime": "workspace:*", "langium": "1.3.1", "lower-case-first": "^2.0.2", - "prettier": "^2.8.3 || 3.x", "semver": "^7.5.2", "ts-morph": "^16.0.0", "ts-pattern": "^4.3.0", diff --git a/packages/sdk/src/code-gen.ts b/packages/sdk/src/code-gen.ts index 6039c2f25..3f80e7e4d 100644 --- a/packages/sdk/src/code-gen.ts +++ b/packages/sdk/src/code-gen.ts @@ -1,29 +1,6 @@ -import prettier from 'prettier'; -import { CompilerOptions, DiagnosticCategory, ModuleKind, Project, ScriptTarget, SourceFile } from 'ts-morph'; +import { CompilerOptions, DiagnosticCategory, ModuleKind, Project, ScriptTarget } from 'ts-morph'; import { PluginError } from './types'; -const formatOptions = { - trailingComma: 'all', - tabWidth: 4, - printWidth: 120, - bracketSpacing: true, - semi: true, - singleQuote: true, - useTabs: false, - parser: 'typescript', -} as const; - -async function formatFile(sourceFile: SourceFile) { - try { - const content = sourceFile.getFullText(); - const formatted = await prettier.format(content, formatOptions); - sourceFile.replaceWithText(formatted); - await sourceFile.save(); - } catch { - /* empty */ - } -} - /** * Creates a TS code generation project */ @@ -46,11 +23,7 @@ export function createProject(options?: CompilerOptions) { * Persists a TS project to disk. */ export async function saveProject(project: Project) { - await Promise.all( - project.getSourceFiles().map(async (sf) => { - await formatFile(sf); - }) - ); + project.getSourceFiles().forEach((sf) => sf.formatText()); await project.save(); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43aa526d9..5b6571803 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -635,9 +635,6 @@ importers: lower-case-first: specifier: ^2.0.2 version: 2.0.2 - prettier: - specifier: ^2.8.3 || 3.x - version: 2.8.8 semver: specifier: ^7.5.2 version: 7.5.4