Files
kube-now/.erb/scripts/check-port-in-use.js
Junior 15e6692647
Some checks failed
Test / test (macos-latest) (push) Waiting to run
Test / test (windows-latest) (push) Waiting to run
Test / test (ubuntu-latest) (push) Failing after 13m2s
commit inicial do projeto
2026-04-21 18:18:56 -03:00

17 lines
414 B
JavaScript

import chalk from 'chalk';
import detectPort from 'detect-port';
const port = process.env.PORT || '1212';
detectPort(port, (_err, availablePort) => {
if (port !== String(availablePort)) {
throw new Error(
chalk.whiteBright.bgRed.bold(
`Port "${port}" on "localhost" is already in use. Please use another port. ex: PORT=4343 npm start`,
),
);
} else {
process.exit(0);
}
});