Preview: Dev-Modus nur mit dev-Skript waehlbar
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1818fadcf
commit
447b7e733e
3 files changed
+36
-4
No files matched your search
@@ -7,6 +7,18 @@ export const MODE_OPTIONS = [
|
||||
{ value: 'off', label: 'Aus' },
|
||||
]
|
||||
|
||||
export const NO_DEV_HINT = 'Reines HTML braucht keinen Dev-Server – Änderungen erscheinen nach jedem Push automatisch.'
|
||||
const DEV_UNAVAILABLE = 'Dev-Modus hier nicht möglich'
|
||||
|
||||
// Modus-Optionen; "Dev-Server" nur wählbar, wenn das Projekt ein dev-Skript hat (devAvailable !== false)
|
||||
export function modeOptionsFor(devAvailable) {
|
||||
return MODE_OPTIONS.map((o) => (o.value === 'dev' && devAvailable === false
|
||||
? { ...o, label: 'Dev-Server (kein dev-Skript)', disabled: true }
|
||||
: { ...o, disabled: false }))
|
||||
}
|
||||
|
||||
export const isDevUnavailableError = (error) => typeof error === 'string' && error.startsWith(DEV_UNAVAILABLE)
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('de-DE', {
|
||||
timeZone: 'Europe/Berlin',
|
||||
day: '2-digit',
|
||||
@@ -40,6 +52,7 @@ export function previewStatus(p) {
|
||||
case 'sleeping':
|
||||
return { color: 'yellow', text: 'Dev-Server schläft, startet beim nächsten Aufruf' }
|
||||
case 'failed':
|
||||
if (isDevUnavailableError(p.error)) return { color: 'yellow', text: 'Dev-Modus hier nicht möglich – statische Version ist online' }
|
||||
return { color: 'red', text: 'Build fehlgeschlagen – letzte funktionierende Version ist online' }
|
||||
default:
|
||||
return { color: 'grey', text: 'Keine Preview' }
|
||||
|
||||
Reference in new issue
Block a user