8000 feat: Lucia adder by AdrianGonz97 · Pull Request #30 · sveltejs/cli · GitHub
[go: up one dir, main page]

Skip to content

feat: Lucia adder #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/adders/_config/categories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type CategoryKeys = 'codeQuality' | 'css' | 'db' | 'testing' | 'additional';
export type CategoryKeys = 'codeQuality' | 'css' | 'db' | 'testing' | 'auth' | 'additional';

export type CategoryInfo = {
id: CategoryKeys;
Expand Down Expand Up @@ -31,6 +31,11 @@ export const categories: CategoryDetails = {
name: 'Database',
description: ''
},
auth: {
id: 'auth',
name: 'Auth',
description: ''
},
additional: {
id: 'additional',
name: 'Additional functionality',
Expand Down
2 changes: 2 additions & 0 deletions packages/adders/_config/official.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { AdderWithoutExplicitArgs } from '@svelte-cli/core';
// adders
import drizzle from '../drizzle/index.ts';
import eslint from '../eslint/index.ts';
import lucia from '../lucia/index.ts';
import mdsvex from '../mdsvex/index.ts';
import playwright from '../playwright/index.ts';
import prettier from '../prettier/index.ts';
Expand All @@ -17,6 +18,7 @@ const categories = {
testing: [vitest, playwright],
css: [tailwindcss],
db: [drizzle],
auth: [lucia],
additional: [storybook, mdsvex, routify]
};

Expand Down
26 changes: 15 additions & 11 deletions packages/adders/drizzle/config/adder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export const adder = defineAdderConfig({
options: availableOptions,
integrationType: 'inline',
packages: [
{ name: 'drizzle-orm', version: '^0.31.2', dev: false },
{ name: 'drizzle-orm', version: '^0.33.0', dev: false },
{ name: 'drizzle-kit', version: '^0.22.0', dev: true },
// MySQL
{
name: 'mysql2',
version: '^3.9.8',
version: '^3.11.0',
dev: false,
condition: ({ options }) => options.mysql === 'mysql2'
},
Expand All @@ -41,7 +41,7 @@ export const adder = defineAdderConfig({
// PostgreSQL
{
name: '@neondatabase/serverless',
version: '^0.9.3',
version: '^0.9.4',
dev: false,
condition: ({ options }) => options.postgresql === 'neon'
},
Expand All @@ -54,19 +54,19 @@ export const adder = defineAdderConfig({
// SQLite
{
name: 'better-sqlite3',
version: '^10.0.0',
version: '^11.1.2',
dev: false,
condition: ({ options }) => options.sqlite === 'better-sqlite3'
},
{
name: '@types/better-sqlite3',
version: '^7.6.10',
version: '^7.6.11',
dev: true,
condition: ({ options }) => options.sqlite === 'better-sqlite3'
},
{
name: '@libsql/client',
version: '^0.6.1',
version: '^0.9.0',
dev: false,
condition: ({ options }) => options.sqlite === 'libsql' || options.sqlite === 'turso'
}
Expand Down Expand Up @@ -210,7 +210,6 @@ export const adder = defineAdderConfig({

userSchemaExpression = common.expressionFromString(`sqliteTable('user', {
id: integer('id').primaryKey(),
name: text('name').notNull(),
age: integer('age')
})`);
}
Expand All @@ -224,7 +223,6 @@ export const adder = defineAdderConfig({

userSchemaExpression = common.expressionFromString(`mysqlTable('user', {
id: serial("id").primaryKey(),
name: text('name').notNull(),
age: int('age'),
})`);
}
Expand All @@ -238,7 +236,6 @@ export const adder = defineAdderConfig({

userSchemaExpression = common.expressionFromString(`pgTable('user', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
age: integer('age'),
})`);
}
Expand Down Expand Up @@ -329,8 +326,15 @@ export const adder = defineAdderConfig({
}
}
],
nextSteps: () => {
const steps = ['You will need to set DATABASE_URL in your production environment'];
nextSteps: ({ options, colors }) => {
const highlight = (str: string) => colors.bold(colors.cyan(str));
const steps = [
`You will need to set ${colors.yellow('DATABASE_URL')} in your production environment`
];
if (options.docker) {
steps.push(`Run ${highlight('npm run db:start')} to start the docker container`);
}
steps.push(`To update your DB schema, run ${highlight('npm run db:push')}`);

return steps;
}
Expand Down
Loading
0