mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-05 09:33:07 +00:00
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:
19
init.mjs
19
init.mjs
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user