From 3d77f0ac932c8c8532ae846b20414ab7381749a4 Mon Sep 17 00:00:00 2001 From: reaper Date: Fri, 14 Aug 2026 12:30:50 -0500 Subject: [PATCH] feat: restore advanced module setup experience --- artifacts/aurora-module-wordpress-1.1.0.tgz | Bin 0 -> 2352 bytes .../aurora-module-wordpress/main/index.cjs | 5 +- .../aurora-module-wordpress/manifest.json | 17 ++++--- packages/aurora-module-wordpress/package.json | 2 +- .../create/types/ExternalModuleSetup.tsx | 47 +++++++++++++----- src/shared/types.ts | 8 +++ 6 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 artifacts/aurora-module-wordpress-1.1.0.tgz diff --git a/artifacts/aurora-module-wordpress-1.1.0.tgz b/artifacts/aurora-module-wordpress-1.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..eb541cf1d6ca3de46b57d24abac76a48c65d1d0a GIT binary patch literal 2352 zcmV-03D5Q)iwFP!00002|Lqy=a@#i2zx@jom0ot`a?-{wH;3!U#63B zWr$o!h(Uk_K+CG*nfrAQaQB9Nk{bXdMcI;_+%=i&jPXMf7K{DHVi(Ftd_hLoP6_30 z$`iZ_;}2@(4;@hyZEbA8B6t)2ft#86gwDJ{3t~8M= zQS=8W8ATCP-+z+f=L$h-Nn`D=t`2h^YbrP>GQ=a2VuOzpPxohR2Ln%tb9H4O~6Ppn)wyz-En{Kpx58q*?ZOP@Aux=<@O{C zVn&0Q#A7Tt7gjX<{2(Z1h8xMHkR*6=UHQDQd{}tLz?wJx1cxMN`rJzEgt~OnmiP&k z7;7P?H=Q=gvU7tnF+!S|GX!!ir$5{X9G2BM}shAOn?mPwWT`aW=>~Km_W}+a^W?l_~K~7omQ(`JEF%U8v6R!NTB@!iK!kHk+yij2n z8f&(|kA+0HR^goofsGQ}esZls_tSa`dH?jpzp=p?426twDce}^AsyXeT62!&T_VLc zs+?lUz~ss8WKd4c*{)49qEu}<7D{g?gU<8k(Uya$3z`M-7~>276C|ZvX~NipqB=9p zu+M`am&};R1(7k!c@WsR-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s b/packages/aurora-module-wordpress/main/index.cjs index b001b7f..534c16a 100644 --- a/packages/aurora-module-wordpress/main/index.cjs +++ b/packages/aurora-module-wordpress/main/index.cjs @@ -12,6 +12,7 @@ function wpArgs(context, network) { exports.projectCreate = async function projectCreate(context) { const s = context.settings + const title = String(s.title || '').trim() || context.projectName const base = wpArgs(context, false) const networkBase = wpArgs(context, true) const siteUrl = context.urls.https @@ -19,10 +20,10 @@ exports.projectCreate = async function projectCreate(context) { await context.run('start', 'docker', ['compose', '-f', `${context.directory}/.aurora/compose.yaml`, 'up', '-d', '--build', '--remove-orphans']) await context.run('download', 'docker', [...base, 'core', 'download', `--locale=${s.locale || 'en_US'}`, '--force']) await context.run('config', 'docker', [...networkBase, 'config', 'create', '--dbname=db', '--dbuser=db', '--dbpass=db', '--dbhost=db:3306', '--skip-check', '--force']) - await context.run('install', 'docker', [...networkBase, 'core', 'install', `--url=${siteUrl}`, `--title=${s.title}`, `--admin_user=${s.admin_user}`, `--admin_password=${s.admin_password}`, `--admin_email=${s.admin_email}`, '--skip-email']) + await context.run('install', 'docker', [...networkBase, 'core', 'install', `--url=${siteUrl}`, `--title=${title}`, `--admin_user=${s.admin_user}`, `--admin_password=${s.admin_password}`, `--admin_email=${s.admin_email}`, '--skip-email']) await context.run('verify-install', 'docker', [...networkBase, 'core', 'is-installed']) if (s.multisite !== 'none') { - await context.run('multisite-convert', 'docker', [...networkBase, 'core', 'multisite-convert', `--title=${s.title}`, ...(s.multisite === 'subdomain' ? ['--subdomains'] : [])]) + await context.run('multisite-convert', 'docker', [...networkBase, 'core', 'multisite-convert', `--title=${title}`, ...(s.multisite === 'subdomain' ? ['--subdomains'] : [])]) await context.run('verify-network', 'docker', [...networkBase, 'core', 'is-installed', '--network']) await context.run('verify-network-db', 'docker', [...networkBase, 'db', 'query', "SHOW TABLES LIKE 'wp_blogs';", '--skip-column-names']) } diff --git a/packages/aurora-module-wordpress/manifest.json b/packages/aurora-module-wordpress/manifest.json index ba598b8..0d1b66d 100644 --- a/packages/aurora-module-wordpress/manifest.json +++ b/packages/aurora-module-wordpress/manifest.json @@ -1,7 +1,7 @@ { "id": "wordpress", "name": "WordPress", - "version": "1.0.0", + "version": "1.1.0", "category": "application", "description": "WordPress CMS provisioning and WP-CLI tooling.", "main": "main/index.cjs", @@ -12,14 +12,15 @@ "settings": [], "creation": { "databases": ["mariadb"], + "intro": { "title": "WordPress install", "description": "Core downloads automatically and the project starts for setup.", "icon": "globe" }, "setup": [ - { "id": "locale", "label": "Locale", "type": "select", "default": "en_US", "options": ["en_US", "en_GB", "de_DE", "fr_FR", "es_ES"] }, - { "id": "title", "label": "Site title", "type": "text", "default": "Aurora Site" }, - { "id": "admin_user", "label": "Admin username", "type": "text", "default": "admin" }, - { "id": "admin_password", "label": "Admin password", "type": "text", "default": "" }, - { "id": "admin_email", "label": "Admin email", "type": "text", "default": "admin@example.test" }, - { "id": "multisite", "label": "Site mode", "type": "select", "default": "none", "options": ["none", "subdirectory", "subdomain"] }, - { "id": "wp_debug", "label": "Enable WP_DEBUG", "type": "boolean", "default": true } + { "id": "title", "label": "Site title", "type": "text", "default": "", "placeholder": "My WordPress Site", "icon": "title", "span": 2 }, + { "id": "admin_user", "label": "Admin username", "type": "text", "default": "admin", "required": true, "icon": "user" }, + { "id": "admin_password", "label": "Admin password", "type": "text", "default": "", "required": true, "secret": true, "icon": "key" }, + { "id": "admin_email", "label": "Admin email", "type": "text", "default": "", "required": true, "placeholder": "admin@example.com", "icon": "mail", "span": 2 }, + { "id": "locale", "label": "Select language", "type": "select", "default": "en_US", "advanced": true, "icon": "globe", "options": ["en_US", "en_GB", "de_DE", "es_ES", "fr_FR", "it_IT", "pt_BR", "nl_NL", "ja"], "optionLabels": { "en_US": "English (United States)", "en_GB": "English (UK)", "de_DE": "German", "es_ES": "Spanish (Spain)", "fr_FR": "French (France)", "it_IT": "Italian", "pt_BR": "Portuguese (Brazil)", "nl_NL": "Dutch", "ja": "Japanese" } }, + { "id": "multisite", "label": "Is this a WordPress Multisite?", "type": "select", "default": "none", "advanced": true, "icon": "settings", "options": ["none", "subdirectory", "subdomain"], "optionLabels": { "none": "No", "subdirectory": "Yes – Subdirectory", "subdomain": "Yes – Subdomain" } }, + { "id": "wp_debug", "label": "Enable WP_DEBUG", "type": "boolean", "default": true, "advanced": true } ] }, "project": { "adminPath": "/wp-admin/" } diff --git a/packages/aurora-module-wordpress/package.json b/packages/aurora-module-wordpress/package.json index 096609b..5da9dda 100644 --- a/packages/aurora-module-wordpress/package.json +++ b/packages/aurora-module-wordpress/package.json @@ -1,6 +1,6 @@ { "name": "@aurora/module-wordpress", - "version": "1.0.0", + "version": "1.1.0", "private": true, "description": "WordPress application module for Aurora Dockside", "files": ["manifest.json", "main", "README.md"] diff --git a/src/renderer/src/components/create/types/ExternalModuleSetup.tsx b/src/renderer/src/components/create/types/ExternalModuleSetup.tsx index 9e6d9b8..abb445b 100644 --- a/src/renderer/src/components/create/types/ExternalModuleSetup.tsx +++ b/src/renderer/src/components/create/types/ExternalModuleSetup.tsx @@ -1,25 +1,46 @@ import { forwardRef, useEffect, useImperativeHandle, useState } from 'react' -import type { AuroraModuleManifest } from '@shared/types' +import { ChevronDown, ChevronUp, Eye, EyeOff, Globe2, KeyRound, Mail, RefreshCw, Settings2, Type, UserRound } from 'lucide-react' +import type { AuroraModuleManifest, AuroraModuleSetting } from '@shared/types' import type { TypeSetupHandle, TypeSetupProps } from './shared' +const inputClass = 'w-full rounded-lg border border-neutral-300 bg-white/80 px-3 py-2 text-sm shadow-sm transition placeholder:text-neutral-400 focus:border-cyan-400 focus:outline-none focus:ring-2 focus:ring-cyan-400/15 dark:border-white/10 dark:bg-neutral-950/70 dark:placeholder:text-neutral-600' +const labelClass = 'mb-1.5 block text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:text-neutral-400' +const icons = { title: Type, user: UserRound, key: KeyRound, mail: Mail, globe: Globe2, settings: Settings2 } + +function password(): string { + const alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%' + const bytes = crypto.getRandomValues(new Uint8Array(20)) + return Array.from(bytes, (byte) => alphabet[byte % alphabet.length]).join('') +} + export const ExternalModuleSetup = forwardRef( function ExternalModuleSetup({ module, projectName, onValidityChange }, ref) { const fields = module.creation?.setup ?? [] const [values, setValues] = useState>(() => Object.fromEntries(fields.map((field) => [field.id, field.default]))) - const valid = fields.every((field) => field.type === 'boolean' || field.type === 'number' || String(values[field.id] ?? '').trim().length > 0) + const [advanced, setAdvanced] = useState(false) + const [visibleSecrets, setVisibleSecrets] = useState>(new Set()) + const valid = fields.every((field) => !field.required || String(values[field.id] ?? '').trim().length > 0) useEffect(() => onValidityChange(valid), [valid, onValidityChange]) - useImperativeHandle(ref, () => ({ - runPostCreate: async ({ directory }) => { - await window.api.create.runModuleProjectCreate(crypto.randomUUID(), module.id, directory, projectName, values) - } - }), [module.id, projectName, values]) + useImperativeHandle(ref, () => ({ runPostCreate: async ({ directory }) => window.api.create.runModuleProjectCreate(crypto.randomUUID(), module.id, directory, projectName, values) }), [module.id, projectName, values]) + + function fieldControl(field: AuroraModuleSetting): React.JSX.Element { + if (field.type === 'boolean') return + const Icon = field.icon ? icons[field.icon] : undefined + if (field.type === 'select') return + const visible = visibleSecrets.has(field.id) + return
+ {Icon && } + setValues({ ...values, [field.id]: field.type === 'number' ? Number(event.target.value) : event.target.value })} className={`${inputClass} ${Icon ? 'pl-9' : ''} ${field.secret ? 'pr-20' : ''}`}/> + {field.secret &&
} +
+ } + + const standardFields = fields.filter((field) => !field.advanced) + const advancedFields = fields.filter((field) => field.advanced) return
-

{module.name} setup

Provided by {module.name} {module.version}.

- {fields.map((field) => )} +

{module.creation?.intro?.title ?? `${module.name} install`}

{module.creation?.intro?.description ?? `Setup is provided by ${module.name} ${module.version}.`}

+
{standardFields.map((field) =>
{fieldControl(field)}
)}
+ {advancedFields.length > 0 && <>{advanced &&
{advancedFields.map((field) =>
{field.type !== 'boolean' && }{fieldControl(field)}
)}
}}
} ) diff --git a/src/shared/types.ts b/src/shared/types.ts index 18cf252..9bf3012 100644 --- a/src/shared/types.ts +++ b/src/shared/types.ts @@ -119,6 +119,13 @@ export interface AuroraModuleSetting { type: AuroraModuleSettingType default: string | number | boolean options?: string[] + optionLabels?: Record + placeholder?: string + required?: boolean + advanced?: boolean + secret?: boolean + icon?: 'title' | 'user' | 'key' | 'mail' | 'globe' | 'settings' + span?: 1 | 2 } export interface AuroraModuleManifest { @@ -137,6 +144,7 @@ export interface AuroraModuleManifest { creation?: { databases?: Array<'mariadb' | 'postgres'> setup?: AuroraModuleSetting[] + intro?: { title: string; description: string; icon?: string } } hooks?: Partial> project?: {