Skip to content

Commit a0ca15d

Browse files
authored
chore: remove prettier dependency (#1171)
1 parent c13a1fd commit a0ca15d

File tree

3 files changed

+2
-33
lines changed

3 files changed

+2
-33
lines changed

packages/sdk/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@zenstackhq/runtime": "workspace:*",
2626
"langium": "1.3.1",
2727
"lower-case-first": "^2.0.2",
28-
"prettier": "^2.8.3 || 3.x",
2928
"semver": "^7.5.2",
3029
"ts-morph": "^16.0.0",
3130
"ts-pattern": "^4.3.0",

packages/sdk/src/code-gen.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,6 @@
1-
import prettier from 'prettier';
2-
import { CompilerOptions, DiagnosticCategory, ModuleKind, Project, ScriptTarget, SourceFile } from 'ts-morph';
1+
import { CompilerOptions, DiagnosticCategory, ModuleKind, Project, ScriptTarget } from 'ts-morph';
32
import { PluginError } from './types';
43

5-
const formatOptions = {
6-
trailingComma: 'all',
7-
tabWidth: 4,
8-
printWidth: 120,
9-
bracketSpacing: true,
10-
semi: true,
11-
singleQuote: true,
12-
useTabs: false,
13-
parser: 'typescript',
14-
} as const;
15-
16-
async function formatFile(sourceFile: SourceFile) {
17-
try {
18-
const content = sourceFile.getFullText();
19-
const formatted = await prettier.format(content, formatOptions);
20-
sourceFile.replaceWithText(formatted);
21-
await sourceFile.save();
22-
} catch {
23-
/* empty */
24-
}
25-
}
26-
274
/**
285
* Creates a TS code generation project
296
*/
@@ -46,11 +23,7 @@ export function createProject(options?: CompilerOptions) {
4623
* Persists a TS project to disk.
4724
*/
4825
export async function saveProject(project: Project) {
49-
await Promise.all(
50-
project.getSourceFiles().map(async (sf) => {
51-
await formatFile(sf);
52-
})
53-
);
26+
project.getSourceFiles().forEach((sf) => sf.formatText());
5427
await project.save();
5528
}
5629

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)