@@ -126,9 +126,17 @@ if (oldClientSecret === undefined) delete process.env.AUTH_GITHUB_CLIENT_SECRET;
126126else process . env . AUTH_GITHUB_CLIENT_SECRET = oldClientSecret ;
127127
128128const root = new URL ( "../" , import . meta. url ) ;
129+ const readOptional = async ( path : string ) => {
130+ try {
131+ return await readFile ( new URL ( path , root ) , "utf8" ) ;
132+ } catch ( error ) {
133+ if ( ( error as NodeJS . ErrnoException ) . code === "ENOENT" ) return null ;
134+ throw error ;
135+ }
136+ } ;
129137const auth = await readFile ( new URL ( "apps/api/src/routes/auth.ts" , root ) , "utf8" ) ;
130138const db = await readFile ( new URL ( "apps/api/src/lib/db.ts" , root ) , "utf8" ) ;
131- const setting = await readFile ( new URL ( "apps/web/app/routes/setting.tsx" , root ) , "utf8 ") ;
139+ const setting = await readOptional ( "apps/web/app/routes/setting.tsx" ) ;
132140const migration = await readFile (
133141 new URL ( "packages/db/migrations/pg/0000_github_id_unique.sql" , root ) ,
134142 "utf8" ,
@@ -145,10 +153,12 @@ assert.doesNotMatch(
145153 / c o n s o l e \. (?: l o g | e r r o r ) \( [ ^ \n ] * (?: g h A c c e s s T o k e n | p r o f i l e \. a c c e s s T o k e n | p a s s w o r d | c l i e n t S e c r e t ) / ,
146154) ;
147155assert . match ( db , / g i t h u b I d : n u l l , g i t h u b U s e r n a m e : n u l l , g i t h u b A c c e s s T o k e n : n u l l / ) ;
148- assert . match ( setting , / d i v i d e - y d i v i d e - b o r d e r \/ 7 0 / ) ;
149- assert . match ( setting , / 解 除 G i t H u b 绑 定 / ) ;
150- assert . match ( setting , / 忘 记 密 码 , 先 重 置 密 码 / ) ;
151- assert . match ( setting , / i s S u b m i t t i n g \? " 解 除 中 \. \. \. " / ) ;
156+ if ( setting ) {
157+ assert . match ( setting , / d i v i d e - y d i v i d e - b o r d e r \/ 7 0 / ) ;
158+ assert . match ( setting , / 解 除 G i t H u b 绑 定 / ) ;
159+ assert . match ( setting , / 忘 记 密 码 , 先 重 置 密 码 / ) ;
160+ assert . match ( setting , / i s S u b m i t t i n g \? " 解 除 中 \. \. \. " / ) ;
161+ }
152162assert . match ( migration , / H A V I N G C O U N T \( \* \) > 1 / ) ;
153163assert . match ( migration , / C R E A T E U N I Q U E I N D E X I F N O T E X I S T S " u s e r s _ g i t h u b _ i d _ u n i q u e " / ) ;
154164assert . match ( migration , / O N " u s e r s " \( " g i t h u b _ i d " \) / ) ;
0 commit comments