Skip to content

Commit

Permalink
fix: add paraglide output directory to .gitignore (#338)
Browse files Browse the repository at this point in the history
Co-authored-by: AdrianGonz97 <[email protected]>
  • Loading branch information
manuel3108 and AdrianGonz97 authored Dec 2, 2024
1 parent 33ecdd5 commit ce9f771
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/silver-bees-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: add paraglide output directory to `.gitignore`
13 changes: 12 additions & 1 deletion packages/addons/paraglide/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export default defineAddon({
const ext = typescript ? 'ts' : 'js';
if (!kit) throw new Error('SvelteKit is required');

const paraglideOutDir = 'src/lib/paraglide';

sv.dependency('@inlang/paraglide-sveltekit', '^0.11.1');

sv.file('project.inlang/settings.json', (content) => {
Expand Down Expand Up @@ -104,7 +106,7 @@ export default defineAddon({
const pluginFunctionCall = functions.call(vitePluginName, []);
const pluginConfig = object.create({
project: common.createLiteral('./project.inlang'),
outdir: common.createLiteral('./src/lib/paraglide')
outdir: common.createLiteral(`./${paraglideOutDir}`)
});
functions.argumentByIndex(pluginFunctionCall, 0, pluginConfig);
array.push(pluginsArray, pluginFunctionCall);
Expand Down Expand Up @@ -209,6 +211,15 @@ export default defineAddon({
return generateCode();
});

sv.file('.gitignore', (content) => {
if (!content) return content;

if (!content.includes(`\n${paraglideOutDir}`)) {
content = content.trimEnd() + `\n\n# Paraglide\n${paraglideOutDir}`;
}
return content;
});

if (options.demo) {
sv.file(`${kit.routesDirectory}/demo/+page.svelte`, (content) => {
return addToDemoPage(content, 'paraglide');
Expand Down

0 comments on commit ce9f771

Please sign in to comment.