refactor: clean up whitespace and improve prompt formatting in port management

- Removed unnecessary whitespace in the init.mjs file for better readability.
- Enhanced the formatting of user prompts to improve clarity during port conflict resolution.
This commit is contained in:
WebDevCody
2026-01-01 00:46:14 -05:00
parent f32f3e82b2
commit 75143c0792

View File

@@ -389,7 +389,9 @@ async function main() {
console.log('');
while (true) {
const choice = await prompt('What would you like to do? (k)ill processes, (u)se different ports, or (c)ancel: ');
const choice = await prompt(
'What would you like to do? (k)ill processes, (u)se different ports, or (c)ancel: '
);
const lowerChoice = choice.toLowerCase();
if (lowerChoice === 'k' || lowerChoice === 'kill') {
@@ -417,7 +419,10 @@ async function main() {
if (isPortInUse(parsedWebPort)) {
const pids = getProcessesOnPort(parsedWebPort);
log(`Port ${parsedWebPort} is already in use by process(es): ${pids.join(', ')}`, 'red');
log(
`Port ${parsedWebPort} is already in use by process(es): ${pids.join(', ')}`,
'red'
);
const useAnyway = await prompt('Use this port anyway? (y/n): ');
if (useAnyway.toLowerCase() !== 'y' && useAnyway.toLowerCase() !== 'yes') {
continue;
@@ -444,7 +449,10 @@ async function main() {
if (isPortInUse(parsedServerPort)) {
const pids = getProcessesOnPort(parsedServerPort);
log(`Port ${parsedServerPort} is already in use by process(es): ${pids.join(', ')}`, 'red');
log(
`Port ${parsedServerPort} is already in use by process(es): ${pids.join(', ')}`,
'red'
);
const useAnyway = await prompt('Use this port anyway? (y/n): ');
if (useAnyway.toLowerCase() !== 'y' && useAnyway.toLowerCase() !== 'yes') {
continue;
@@ -461,7 +469,10 @@ async function main() {
log('Cancelled.', 'yellow');
process.exit(0);
} else {
log('Invalid choice. Please enter k (kill), u (use different ports), or c (cancel).', 'red');
log(
'Invalid choice. Please enter k (kill), u (use different ports), or c (cancel).',
'red'
);
}
}
} else {