🔨 chore: improve start up scripts (#13318)

update scripts
This commit is contained in:
Arvin Xu
2026-03-27 00:49:23 +08:00
committed by GitHub
parent edc8920703
commit 53c5708c9f
2 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -8,9 +8,13 @@ const NEXT_HOST = 'localhost';
/**
* Resolve the Next.js dev port.
* Respects the PORT environment variable, falls back to 3010.
* Priority: -p CLI flag > PORT env var > 3010.
*/
const resolveNextPort = (): number => {
const pIndex = process.argv.indexOf('-p');
if (pIndex !== -1 && process.argv[pIndex + 1]) {
return Number(process.argv[pIndex + 1]);
}
if (process.env.PORT) return Number(process.env.PORT);
return 3010;
};