Skip to content

Commit

Permalink
create-triplit-app: add svelte option
Browse files Browse the repository at this point in the history
  • Loading branch information
pbohlman committed Apr 2, 2024
1 parent d2c8029 commit c63eb36
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-ways-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-triplit-app': patch
---

add svelte option
5 changes: 1 addition & 4 deletions packages/create-triplit-app/files/schema.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// import { Schema as S } from '@triplit/db';

/**
* Define your schema here. To use your schema, you can either:
* - Directly import your schema into your app
* - Run 'triplit migrate create' to generate migrations (recommended for production apps)
*
* Define your schema here.
* For more information on schemas, see the docs: https://www.triplit.dev/docs/database/schemas
*/
export const schema = {
Expand Down
14 changes: 13 additions & 1 deletion packages/create-triplit-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ const FRAMEWORKS: Framework[] = [
'@triplit/react': '^0.3.1',
},
},
{
name: 'svelte',
display: 'Svelte',
color: red,
variants: [],
dependencies: {
'@triplit/svelte': '^0.1.3',
},
},
];

const TEMPLATES = ['chat'];
Expand All @@ -69,6 +78,8 @@ function getViteTemplateForFramework(framework: string) {
switch (framework) {
case 'react':
return 'react-ts';
case 'svelte':
return 'svelte-ts';
case 'vanilla':
return 'vanilla-ts';
default:
Expand Down Expand Up @@ -182,7 +193,8 @@ async function createTriplitAppWithVite() {
const viteScaffold = new Promise<void>((resolve, reject) => {
const child = spawn(pkgManager, createArgs, {
stdio: [process.stdin, process.stdout, process.stderr],
shell:true})!;
shell: true,
})!;
child.on('error', (err) => {
console.error(err);
reject();
Expand Down

0 comments on commit c63eb36

Please sign in to comment.