51 lines
2.5 KiB
PowerShell
51 lines
2.5 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
|
|
function Read-Utf8([string]$relativePath) {
|
|
return Get-Content -LiteralPath (Join-Path $root $relativePath) -Raw -Encoding UTF8
|
|
}
|
|
|
|
function Assert-Contains([string]$source, [string]$expected, [string]$page) {
|
|
if (-not $source.Contains($expected)) { throw "$page missing F business-flow anchor: $expected" }
|
|
}
|
|
|
|
$contracts = [ordered]@{
|
|
'pages/family/f03-feed-detail.vue' = @(
|
|
'feedComments', 'commentDraft', 'submitComment', 'feed-state--expired',
|
|
'genealogyId', 'feedId', 'comment-state--validating', 'comment-state--preview',
|
|
'findFamilyFeedFixture', 'returnTo("F01", { genealogyId: genealogyId.value })'
|
|
)
|
|
'pages/family/f04-article-list.vue' = @(
|
|
'articleCategories', 'filteredArticles', 'openArticle', 'createArticle',
|
|
'article-list-state--loading', 'article-list-state--empty', 'article-list-state--error',
|
|
'listFamilyArticleFixtures', 'openPage(', 'genealogyId: genealogyId.value'
|
|
)
|
|
'pages/family/f05-article-detail.vue' = @(
|
|
'articleParagraphs', 'disabled label=', 'article-state--expired', 'backToArticles',
|
|
'articleId', 'article-state--privacy', 'article-state--error',
|
|
'findFamilyArticleFixture', 'returnTo("F04", { genealogyId: genealogyId.value })'
|
|
)
|
|
'pages/family/f07-album-list.vue' = @(
|
|
'albums', 'openAlbum', 'createAlbum', 'album-state--empty',
|
|
'album-list-state--loading', 'album-list-state--error', 'albumNameDraft',
|
|
'listFamilyAlbumFixtures', 'localAlbumPreview', 'openPage('
|
|
)
|
|
}
|
|
|
|
foreach ($entry in $contracts.GetEnumerator()) {
|
|
$source = Read-Utf8 $entry.Key
|
|
foreach ($anchor in $entry.Value) { Assert-Contains $source $anchor $entry.Key }
|
|
foreach ($required in @('ModulePageBackground', 'PageHeader', 'AppButton', 'AppLoading')) {
|
|
Assert-Contains $source $required $entry.Key
|
|
}
|
|
foreach ($forbidden in @('import ModulePage from', 'uni.showToast', 'uni.showModal', 'uni.navigateTo', 'uni.redirectTo', 'uni.reLaunch', '/pages/', 'finishPage(')) {
|
|
if ($source.Contains($forbidden)) { throw "$($entry.Key) retains forbidden implementation: $forbidden" }
|
|
}
|
|
if ($source -match '<ModulePage(?:\s|/|>)') { throw "$($entry.Key) retains forbidden ModulePage owner" }
|
|
if ($source -match '(?im)(?<![-\w])position\s*:') { throw "$($entry.Key) ordinary content must not use position" }
|
|
if ($source -match '(?im)overflow\s*:\s*hidden') { throw "$($entry.Key) must not clip data-driven content" }
|
|
}
|
|
|
|
Write-Output 'F-BUSINESS-FLOW-CONTRACT PASS'
|