Refactor code formatting for consistency in scaffold and update port registry scripts
This commit is contained in:
@@ -131,7 +131,10 @@ function normalizePorts(rawPorts) {
|
||||
});
|
||||
}
|
||||
|
||||
ports.sort((left, right) => left.port - right.port || left.service.localeCompare(right.service));
|
||||
ports.sort(
|
||||
(left, right) =>
|
||||
left.port - right.port || left.service.localeCompare(right.service),
|
||||
);
|
||||
return ports;
|
||||
}
|
||||
|
||||
@@ -256,7 +259,9 @@ function buildPortIndexes(projects) {
|
||||
|
||||
for (const entries of Object.values(ports)) {
|
||||
entries.sort((left, right) => {
|
||||
const leftSeen = left.firstSeenAt ? Date.parse(left.firstSeenAt) : Number.POSITIVE_INFINITY;
|
||||
const leftSeen = left.firstSeenAt
|
||||
? Date.parse(left.firstSeenAt)
|
||||
: Number.POSITIVE_INFINITY;
|
||||
const rightSeen = right.firstSeenAt
|
||||
? Date.parse(right.firstSeenAt)
|
||||
: Number.POSITIVE_INFINITY;
|
||||
@@ -296,7 +301,12 @@ function buildPortIndexes(projects) {
|
||||
* localSnapshot: LocalSnapshot
|
||||
* }} params
|
||||
*/
|
||||
function updateRegistry({ stateDir, projectContext, localSnapshotPath, localSnapshot }) {
|
||||
function updateRegistry({
|
||||
stateDir,
|
||||
projectContext,
|
||||
localSnapshotPath,
|
||||
localSnapshot,
|
||||
}) {
|
||||
ensureDirectory(stateDir);
|
||||
const registryPath = path.join(stateDir, machineRegistryName);
|
||||
|
||||
@@ -348,7 +358,11 @@ function updateRegistry({ stateDir, projectContext, localSnapshotPath, localSnap
|
||||
function appendError(stateDir, errorMessage) {
|
||||
ensureDirectory(stateDir);
|
||||
const errorLine = `${nowIso()} ${errorMessage}`;
|
||||
fs.appendFileSync(path.join(stateDir, "project-ports-errors.log"), `${errorLine}\n`, "utf8");
|
||||
fs.appendFileSync(
|
||||
path.join(stateDir, "project-ports-errors.log"),
|
||||
`${errorLine}\n`,
|
||||
"utf8",
|
||||
);
|
||||
}
|
||||
|
||||
function readStdin() {
|
||||
@@ -405,9 +419,10 @@ function runReport(stateDir) {
|
||||
throw parseError;
|
||||
}
|
||||
|
||||
const conflicts = registry.conflicts && typeof registry.conflicts === "object"
|
||||
? registry.conflicts
|
||||
: {};
|
||||
const conflicts =
|
||||
registry.conflicts && typeof registry.conflicts === "object"
|
||||
? registry.conflicts
|
||||
: {};
|
||||
|
||||
const summary = {
|
||||
registryPath,
|
||||
@@ -445,9 +460,13 @@ function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const projectContext = detectProjectContext(eventPayload, options.projectPath);
|
||||
const projectContext = detectProjectContext(
|
||||
eventPayload,
|
||||
options.projectPath,
|
||||
);
|
||||
|
||||
const { localSnapshotPath, localSnapshot } = loadAndSyncLocalSnapshot(projectContext);
|
||||
const { localSnapshotPath, localSnapshot } =
|
||||
loadAndSyncLocalSnapshot(projectContext);
|
||||
updateRegistry({
|
||||
stateDir: options.stateDir,
|
||||
projectContext,
|
||||
@@ -459,6 +478,9 @@ function main() {
|
||||
try {
|
||||
main();
|
||||
} catch (error) {
|
||||
appendError(defaultStateDir, error instanceof Error ? error.message : String(error));
|
||||
appendError(
|
||||
defaultStateDir,
|
||||
error instanceof Error ? error.message : String(error),
|
||||
);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user