This commit is contained in:
rain
2026-07-24 18:03:02 +08:00
parent c7f278fe79
commit ec8486b035
86 changed files with 7943 additions and 1841 deletions
+11 -21
View File
@@ -3,7 +3,7 @@ $ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
function Read-Utf8([string]$relativePath) {
return Get-Content -LiteralPath (Join-Path $root $relativePath) -Raw -Encoding UTF8
Get-Content -LiteralPath (Join-Path $root $relativePath) -Raw -Encoding UTF8
}
function Assert-Contains([string]$source, [string]$expected, [string]$page) {
@@ -12,39 +12,29 @@ function Assert-Contains([string]$source, [string]$expected, [string]$page) {
$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 })'
'feedState', 'appApi.getFeedDetail', 'appApi.getFeedComments', 'appApi.createFeedComment',
'feedTypeLabel(feed.type)', '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'
'listState', 'appApi.getArticles', 'openArticle', 'createArticle',
'openPage("F05"', 'openPage("F06"'
)
'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 })'
'articleState', 'appApi.getArticleDetail', 'article-state--${articleState}',
'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('
'listState', 'appApi.getAlbums', 'appApi.createAlbum', 'openAlbum',
'pickAndUploadImage', 'openPage("F08"'
)
}
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 @('listFamilyArticleFixtures', 'findFamilyArticleFixture', 'listFamilyAlbumFixtures', 'localAlbumPreview', 'feed-detail-contract-note', 'data/mock')) {
if ($source.Contains($forbidden)) { throw "$($entry.Key) retains retired F business-flow implementation: $forbidden" }
}
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'