Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
35 changes: 34 additions & 1 deletion packages/build-info/src/frameworks/solid-start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('detects and configures a SolidStart site that uses the old `solid-start` p
expect(detected?.[0]?.dev?.port).toBe(3000)
})

test('detects and configures a SolidStart site that uses the new `@solidjs/start` package', async ({ fs }) => {
test('detects and configures a SolidStart v1 site', async ({ fs }) => {
const cwd = mockFileSystem({
'package.json': JSON.stringify({
scripts: {
Expand All @@ -60,6 +60,7 @@ test('detects and configures a SolidStart site that uses the new `@solidjs/start
vinxi: '^0.4.1',
},
}),
'app.config.ts': '',
})
const detected = await new Project(fs, cwd).detectFrameworks()

Expand All @@ -74,3 +75,35 @@ test('detects and configures a SolidStart site that uses the new `@solidjs/start
expect(detected?.[0]?.dev?.command).toBe('vinxi dev')
expect(detected?.[0]?.dev?.port).toBe(3000)
})

test('detects and configures a SolidStart v2 site', async ({ fs }) => {
const cwd = mockFileSystem({
'package.json': JSON.stringify({
scripts: {
dev: 'vite dev',
build: 'vite build',
},
dependencies: {
'@solidjs/router': '^1.0.0',
'@solidjs/start': '2.0.0',
'solid-js': '^1.9.14',
},
devDependencies: {
'@netlify/vite-plugin': '^2.12.9',
vite: '^8.2.0',
},
}),
'vite.config.ts': '',
})
const detected = await new Project(fs, cwd).detectFrameworks()

const detectedFrameworks = (detected ?? []).map((framework) => framework.id)
expect(detectedFrameworks).not.toContain('vite')
expect(detectedFrameworks).not.toContain('solidjs')

expect(detected?.[0]?.id).toBe('solid-start')
expect(detected?.[0]?.build?.command).toBe('vite build')
expect(detected?.[0]?.build?.directory).toBe('dist/client')
expect(detected?.[0]?.dev?.command).toBe('vite dev')
expect(detected?.[0]?.dev?.port).toBe(5173)
})
17 changes: 13 additions & 4 deletions packages/build-info/src/frameworks/solid-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export class SolidStart extends BaseFramework implements Framework {
category = Category.SSG

dev = {
command: 'vinxi dev',
port: 3000,
command: 'vite dev',
port: 5173,
}

build = {
command: 'vinxi build',
directory: 'dist',
command: 'vite build',
directory: 'dist/client',
}

logo = {
Expand All @@ -46,6 +46,15 @@ export class SolidStart extends BaseFramework implements Framework {
this.build = LEGACY_BUILD
return this as DetectedFramework
}

// Became "just vite" starting in v2, used vinxi 0.4.0 to 1.x.
if (this.version && this.version.major < 2) {
Comment thread
serhalp marked this conversation as resolved.
Resolved
this.dev.command = 'vinxi dev'
this.dev.port = 3000
this.build.command = 'vinxi build'
this.build.directory = 'dist'
}

return this as DetectedFramework
}
}
Expand Down
Loading