diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml index 817c7d4..1bc3aaa 100644 --- a/.github/workflows/macos-release.yml +++ b/.github/workflows/macos-release.yml @@ -6,7 +6,7 @@ on: release_tag: description: Existing GitHub release tag to receive the macOS files required: true - default: v2.0.0-alpha.29 + default: v2.0.0-alpha.30 push: tags: - 'v*' diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index f73039b..4ea694a 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -6,7 +6,7 @@ on: release_tag: description: Existing GitHub release tag to receive the Windows installer required: true - default: v2.0.0-alpha.29 + default: v2.0.0-alpha.30 push: tags: - 'v*' diff --git a/package-lock.json b/package-lock.json index f70c5d6..bffec0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "aurora-dockside", - "version": "2.0.0-alpha.29", + "version": "2.0.0-alpha.30", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "aurora-dockside", - "version": "2.0.0-alpha.29", + "version": "2.0.0-alpha.30", "hasInstallScript": true, "dependencies": { "@electron-toolkit/preload": "^3.0.2", diff --git a/package.json b/package.json index f5b03db..55d84f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurora-dockside", - "version": "2.0.0-alpha.29", + "version": "2.0.0-alpha.30", "description": "A modern, modular Docker development platform for building, running, and managing web applications locally.", "desktopName": "aurora-dockside.desktop", "main": "./out/main/index.js", diff --git a/src/renderer/src/components/create/CreateProjectModal.test.tsx b/src/renderer/src/components/create/CreateProjectModal.test.tsx index 7c3443c..c534999 100644 --- a/src/renderer/src/components/create/CreateProjectModal.test.tsx +++ b/src/renderer/src/components/create/CreateProjectModal.test.tsx @@ -16,14 +16,39 @@ const wordpress: AuroraModuleManifest = { aurora: { core: '2.0.0-alpha.24', moduleApi: '1.0.0' } } -function renderModal(modules: AuroraModuleManifest[]): { queryClient: QueryClient } { +function renderModal( + modules: AuroraModuleManifest[], + nativeAvailable = false +): { queryClient: QueryClient } { vi.stubGlobal('api', { modules: { listRegistry: vi.fn().mockResolvedValue(modules) }, + runtime: { + status: vi.fn().mockResolvedValue({ + selectedEngine: nativeAvailable ? 'native' : 'container', + container: { available: false, provider: null }, + native: { + available: nativeAvailable, + platform: 'win32', + arch: 'x64', + runtimeVersion: nativeAvailable ? '0.1.0' : undefined, + components: nativeAvailable + ? [{ id: 'php', version: '8.5.9', executable: 'php.exe', sha256: 'a'.repeat(64) }] + : [] + } + }) + }, create: { pickDirectory: vi.fn(), project: vi.fn() }, - terminal: { onData: vi.fn().mockReturnValue(() => {}), onExit: vi.fn().mockReturnValue(() => {}) } + terminal: { + onData: vi.fn().mockReturnValue(() => {}), + onExit: vi.fn().mockReturnValue(() => {}) + } }) const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } }) - render() + render( + + + + ) return { queryClient } } @@ -41,4 +66,11 @@ describe('external application choices', () => { await waitFor(() => expect(screen.queryByText('WordPress')).not.toBeInTheDocument()) expect(screen.getByText('No application modules installed')).toBeInTheDocument() }) + + it('defaults to Aurora Native when the bundled runtime is ready', async () => { + renderModal([wordpress], true) + const native = await screen.findByRole('button', { name: /Aurora Native/i }) + await waitFor(() => expect(native.className).toContain('border-cyan-400')) + expect(screen.getByLabelText('PHP')).toHaveValue('8.5') + }) }) diff --git a/src/renderer/src/components/create/CreateProjectModal.tsx b/src/renderer/src/components/create/CreateProjectModal.tsx index c30ef58..658ece6 100644 --- a/src/renderer/src/components/create/CreateProjectModal.tsx +++ b/src/renderer/src/components/create/CreateProjectModal.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { clsx } from 'clsx' import { ArrowLeft, @@ -56,6 +56,7 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }): React. const createProject = useCreateProject() const selectProject = useAppStore((s) => s.selectProject) const setupRef = useRef(null) + const runtimeChoiceMade = useRef(false) const { data: moduleRegistry = [] } = useModuleRegistry() const { data: runtimeStatus } = useRuntimeStatus() const applicationModules = moduleRegistry.filter((module) => module.category === 'application') @@ -68,8 +69,27 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }): React. const canContinue = directory !== null && nameValid && selectedModule !== undefined const canSubmit = canContinue && setupValid && !isSubmitting + useEffect(() => { + if (!runtimeStatus || runtimeChoiceMade.current) return + runtimeChoiceMade.current = true + if (!runtimeStatus.native.available) return + setRuntimeEngine('native') + const nativePhp = runtimeStatus.native.components.find( + (component) => component.id === 'php' + )?.version + if (nativePhp) setPhpVersion(nativePhp.split('.').slice(0, 2).join('.')) + setWebServer('nginx') + setDatabase('mariadb') + setDatabaseVersion('11.8') + setAdminer(true) + setRedis(false) + setMailpit(false) + setXdebug(false) + }, [runtimeStatus]) + function selectRuntimeEngine(engine: 'container' | 'native'): void { if (engine === 'native' && !runtimeStatus?.native.available) return + runtimeChoiceMade.current = true setRuntimeEngine(engine) if (engine === 'native') { const nativePhp = runtimeStatus?.native.components.find( @@ -376,8 +396,11 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }): React. - PHP + + PHP + setPhpVersion(e.target.value)}