mirror of
https://github.com/severian-dev/sucker.severian.dev.git
synced 2025-10-28 04:35:43 +00:00
chore: initial transfer commit
This commit is contained in:
21
sucker.js
Normal file
21
sucker.js
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
// 1. Grab the port from the '-p' argument
|
||||
const portIndex = process.argv.indexOf("-p");
|
||||
let port = "3000";
|
||||
if (portIndex !== -1 && portIndex + 1 < process.argv.length) {
|
||||
port = process.argv[portIndex + 1];
|
||||
}
|
||||
|
||||
// 2. Start Next.js using that port
|
||||
try {
|
||||
// Either pass it directly to next, e.g.:
|
||||
// execSync(`npx next start -p ${port}`, { stdio: "inherit" });
|
||||
//
|
||||
// Or set the PORT env var and run your npm script:
|
||||
execSync(`PORT=${port} npm run start`, { stdio: "inherit" });
|
||||
} catch (err) {
|
||||
console.error("Failed to start Next.js:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user