Skip to content

Commit ce9f771

Browse files
fix: add paraglide output directory to .gitignore (#338)
Co-authored-by: AdrianGonz97 <[email protected]>
1 parent 33ecdd5 commit ce9f771

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.changeset/silver-bees-pump.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 paraglide output directory to `.gitignore`

packages/addons/paraglide/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export default defineAddon({
7171
const ext = typescript ? 'ts' : 'js';
7272
if (!kit) throw new Error('SvelteKit is required');
7373

74+
const paraglideOutDir = 'src/lib/paraglide';
75+
7476
sv.dependency('@inlang/paraglide-sveltekit', '^0.11.1');
7577

7678
sv.file('project.inlang/settings.json', (content) => {
@@ -104,7 +106,7 @@ export default defineAddon({
104106
const pluginFunctionCall = functions.call(vitePluginName, []);
105107
const pluginConfig = object.create({
106108
project: common.createLiteral('./project.inlang'),
107-
outdir: common.createLiteral('./src/lib/paraglide')
109+
outdir: common.createLiteral(`./${paraglideOutDir}`)
108110
});
109111
functions.argumentByIndex(pluginFunctionCall, 0, pluginConfig);
110112
array.push(pluginsArray, pluginFunctionCall);
@@ -209,6 +211,15 @@ export default defineAddon({
209211
return generateCode();
210212
});
211213

214+
sv.file('.gitignore', (content) => {
215+
if (!content) return content;
216+
217+
if (!content.includes(`\n${paraglideOutDir}`)) {
218+
content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
219+
}
220+
return content;
221+
});
222+
212223
if (options.demo) {
213224
sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
214225
return addToDemoPage(content, 'paraglide');

0 commit comments

Comments
 (0)