mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
more fixes
This commit is contained in:
1 parent
f5d770c6f8
commit
e97efd74f0
3 files changed
+27
-14
No files matched your search
@@ -81,7 +81,10 @@ describe('buildSteps', () => {
|
||||
const connect = buildSteps(cfg, composition(cfg)).find((s) => s.id === 'connect-app')!
|
||||
|
||||
expect(connect.title).toBe('Connect to your app')
|
||||
expect(stepText(connect)).toContain('npx shadcn@latest init -d')
|
||||
expect(stepText(connect)).toContain('test -f components.json || npx shadcn@latest init -d')
|
||||
expect(stepText(connect)).toContain(
|
||||
'Do not run shadcn init when components.json already exists'
|
||||
)
|
||||
expect(stepText(connect)).toContain(
|
||||
'npx shadcn@latest add @supabase/password-based-auth-nextjs'
|
||||
)
|
||||
@@ -187,7 +190,7 @@ describe('buildSteps', () => {
|
||||
const connect = steps.find((s) => s.id === 'connect-app')!
|
||||
expect(steps.some((s) => s.id === 'add')).toBe(false)
|
||||
expect(connect.title).toBe('Connect to your app')
|
||||
expect(stepText(connect)).toContain('npx shadcn@latest init -d')
|
||||
expect(stepText(connect)).toContain('test -f components.json || npx shadcn@latest init -d')
|
||||
})
|
||||
|
||||
it('existing + no shadcn uses the Supabase code step instead of a file tree step', () => {
|
||||
@@ -330,6 +333,17 @@ describe('buildSteps', () => {
|
||||
expect(text).toContain('npx shadcn@latest add SaxonF/templates/todos')
|
||||
expect(text).toContain('npx shadcn@latest add SaxonF/templates/auth')
|
||||
})
|
||||
|
||||
it('points to template readmes for config.toml merge guidance', () => {
|
||||
const cfg = config()
|
||||
const supabaseCode = buildSteps(cfg, composition(cfg)).find((s) => s.id === 'supabase-code')!
|
||||
const text = stepText(supabaseCode)
|
||||
|
||||
expect(text).toContain("Follow the instructions in each installed template's readme")
|
||||
expect(text).toContain('supabase/config.toml')
|
||||
expect(text).not.toContain('--dry-run --diff')
|
||||
expect(text).not.toContain('The Start composer has already merged overlapping files')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildAgentPlan', () => {
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
getRegistryAddCommand,
|
||||
getRegistrySearchCommand,
|
||||
getRegistryViewCommand,
|
||||
} from 'template-composer'
|
||||
import { getRegistryAddCommand, getRegistrySearchCommand } from 'template-composer'
|
||||
|
||||
import type { StartComposition } from './composition/start-composition'
|
||||
import { listEnglish, ORMS, type StartConfig } from './config'
|
||||
@@ -35,7 +31,6 @@ export interface ProjectCodePlan {
|
||||
selectedTemplates: ProjectCodeTemplate[]
|
||||
dependencyTemplates: ProjectCodeTemplate[]
|
||||
addCommands: ProjectCodeTemplateCommand[]
|
||||
viewCommands: ProjectCodeTemplateCommand[]
|
||||
fileGroups: ProjectCodeFileGroup[]
|
||||
filePaths: string[]
|
||||
schemaFiles: string[]
|
||||
@@ -85,7 +80,6 @@ export function buildProjectCodePlan(
|
||||
.filter((resource) => resource.kind === 'edge-function')
|
||||
.map((resource) => resource.label)
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
|
||||
return {
|
||||
hasProjectCode: selectedTemplates.length > 0 || filePaths.length > 0,
|
||||
listCommand: getRegistrySearchCommand('', registryCommandOptions),
|
||||
@@ -97,10 +91,6 @@ export function buildProjectCodePlan(
|
||||
...template,
|
||||
command: getRegistryAddCommand(template.id, registryCommandOptions),
|
||||
})),
|
||||
viewCommands: selectedTemplates.map((template) => ({
|
||||
...template,
|
||||
command: getRegistryViewCommand(template.id, registryCommandOptions),
|
||||
})),
|
||||
fileGroups,
|
||||
filePaths,
|
||||
schemaFiles,
|
||||
|
||||
@@ -296,12 +296,16 @@ function connectAppStep(ctx: GuideContext): SetupStep | null {
|
||||
type: 'code',
|
||||
lang: 'terminal',
|
||||
code: lines([
|
||||
"npx shadcn@latest init -d # if shadcn isn't set up yet",
|
||||
'test -f components.json || npx shadcn@latest init -d # skip init when shadcn/ui is already configured',
|
||||
...blockPrims.map(
|
||||
(p) => `npx shadcn@latest add @supabase/${getShadcnBlockName(p)}-${fw.shadcnTag}`
|
||||
),
|
||||
]),
|
||||
})
|
||||
blocks.push({
|
||||
type: 'note',
|
||||
text: 'Do not run shadcn init when components.json already exists; the Next.js with-supabase starter and many existing apps already include it.',
|
||||
})
|
||||
|
||||
const missing = getMissingShadcnPrimitiveLabels(ctx)
|
||||
if (missing.length) {
|
||||
@@ -390,6 +394,11 @@ function supabaseCodeStep(ctx: GuideContext): SetupStep | null {
|
||||
}
|
||||
|
||||
if (plan.addCommands.length > 0) {
|
||||
blocks.push({
|
||||
type: 'note',
|
||||
text: "Follow the instructions in each installed template's readme, especially when merging changes into supabase/config.toml.",
|
||||
})
|
||||
|
||||
blocks.push({
|
||||
type: 'code',
|
||||
lang: 'terminal',
|
||||
|
||||
Reference in new issue
Block a user