@@ -23,6 +23,7 @@ const index = readFileSync(resolve(docsDirectory, "index.html"), "utf8");
2323const siteScript = readFileSync ( resolve ( docsDirectory , "scripts/site.js" ) , "utf8" ) ;
2424const workflow = readFileSync ( resolve ( root , ".github/workflows/pages.yml" ) , "utf8" ) ;
2525const packageSource = readFileSync ( resolve ( root , "package.json" ) , "utf8" ) ;
26+ const lastUpdated = JSON . parse ( readFileSync ( resolve ( docsDirectory , "last-updated.json" ) , "utf8" ) ) ;
2627
2728assert ( markdownFiles . length === 23 , `Expected 23 Chinese Markdown files, found ${ markdownFiles . length } .` ) ;
2829assert ( index . includes ( 'lang="zh-CN"' ) , "The document language must remain zh-CN." ) ;
@@ -37,6 +38,17 @@ assert(!siteScript.includes("topMargin:"), "Deprecated topMargin must not offset
3738assert ( workflow . includes ( "fetch-depth: 0" ) , "The deployment checkout must include full Git history." ) ;
3839assert ( packageSource . includes ( "scripts/generate-last-updated.mjs" ) , "The local preview does not generate last-updated metadata." ) ;
3940
41+ const expectedMetadataFiles = markdownFiles
42+ . map ( ( file ) => file . slice ( docsDirectory . length + 1 ) . replaceAll ( "\\" , "/" ) )
43+ . sort ( ) ;
44+ assert (
45+ JSON . stringify ( Object . keys ( lastUpdated ) . sort ( ) ) === JSON . stringify ( expectedMetadataFiles ) ,
46+ "Last-updated metadata must cover every Chinese Markdown file." ,
47+ ) ;
48+ for ( const [ file , date ] of Object . entries ( lastUpdated ) ) {
49+ assert ( / ^ \d { 4 } - \d { 2 } - \d { 2 } $ / . test ( date ) , `Invalid last-updated date for ${ file } .` ) ;
50+ }
51+
4052const commentInvariants = [
4153 'clientID: "296c581fc4b2a837a1e3"' ,
4254 'clientSecret: "7e7f0ad1809fa4a1915430ade04835f6849ab56a"' ,
0 commit comments