File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 10
10
"dev:debug" : " NODE_OPTIONS='--inspect' next dev" ,
11
11
"build" : " next build" ,
12
12
"start" : " next start" ,
13
+ "start:vercel" : " node vercel.prestart.js && next start" ,
13
14
"tsc" : " tsc --pretty --noEmit" ,
14
15
"lint" : " eslint lint --max-warnings=0" ,
15
16
"format" : " eslint --fix --max-warnings=0" ,
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+
3
+ const ENV = process . env . VERCEL_ENV ;
4
+ const URL = process . env . VERCEL_URL ;
5
+ const REPO_SLUG = process . env . VERCEL_GIT_REPO_SLUG ;
6
+ const REPO_OWNER = process . env . VERCEL_GIT_REPO_OWNER ;
7
+ const COMMIT_REF = process . env . VERCEL_GIT_COMMIT_REF ;
8
+
9
+ const domain = 'vercel.app' ;
10
+
11
+ const url = ( ) => {
12
+ if ( ENV === 'production' && REPO_SLUG ) {
13
+ return `${ REPO_SLUG } .${ domain } ` ;
14
+ }
15
+
16
+ if ( COMMIT_REF !== 'master' && COMMIT_REF !== 'main' && REPO_SLUG && COMMIT_REF && REPO_OWNER ) {
17
+ return `${ REPO_SLUG } -git-${ COMMIT_REF } -${ REPO_OWNER } .${ domain } ` ;
18
+ }
19
+
20
+ return URL ?? '' ;
21
+ } ;
22
+
23
+ fs . appendFileSync ( '.env' , `\nVERCEL_URL="${ url ( ) } "\n` ) ;
You can’t perform that action at this time.
0 commit comments