Skip to content

Commit a4fdf9b

Browse files
committed
fix(add): add /drizzle/ folder to .prettierignore
1 parent 4a77117 commit a4fdf9b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.changeset/fair-onions-boil.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'sv': patch
3+
---
4+
5+
fix(add): add `/drizzle/` folder to `.prettierignore` if `prettier` is installed when adding `drizzle` addon.

packages/addons/drizzle/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default defineAddon({
9191
}
9292
}
9393
},
94-
run: ({ sv, typescript, options, kit }) => {
94+
run: ({ sv, typescript, options, kit, dependencyVersion }) => {
9595
const ext = typescript ? 'ts' : 'js';
9696

9797
sv.dependency('drizzle-orm', '^0.40.0');
@@ -180,6 +180,16 @@ export default defineAddon({
180180
return generateCode();
181181
});
182182

183+
const hasPrettier = Boolean(dependencyVersion('prettier'));
184+
if (hasPrettier) {
185+
sv.file('.prettierignore', (content) => {
186+
if (!content.includes(`/drizzle/`)) {
187+
return content.trimEnd() + '\n/drizzle/';
188+
}
189+
return content;
190+
});
191+
}
192+
183193
if (options.database === 'sqlite') {
184194
sv.file('.gitignore', (content) => {
185195
// Adds the db file to the gitignore if an ignore is present

0 commit comments

Comments
 (0)