Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
SurgeCode committed Dec 5, 2024
1 parent cc9bc3c commit 75a1ba6
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/services/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export class TunnelService {

async start(): Promise<void> {
console.log(
`Setting up ${this.config.useServeo ? "Serveo" : "Localtunnel"} tunnel on port ${this.config.port}...`,
`Setting up ${
this.config.useServeo ? "Serveo" : "Localtunnel"
} tunnel on port ${this.config.port}...`
);

const tunnel = this.config.useServeo
Expand All @@ -56,7 +58,7 @@ export class TunnelService {
this.registerCleanupHandlers();

console.log(
"Tunnel is running. Watching for changes. Press Ctrl+C to stop.",
"Tunnel is running. Watching for changes. Press Ctrl+C to stop."
);
await this.watchForChanges();
}
Expand Down Expand Up @@ -129,7 +131,7 @@ export class TunnelService {
tunnelUrl: string;
cleanup: () => Promise<void>;
}) => void,
reject: (reason: Error) => void,
reject: (reason: Error) => void
): void {
let tunnelUrl = "";

Expand Down Expand Up @@ -165,7 +167,8 @@ export class TunnelService {
await this.updateBitteConfig({ url: this.tunnelUrl });
await new Promise((resolve) => setTimeout(resolve, 1000));

const signedMessage = await this.pluginService.auth.authenticateOrCreateKey();
const signedMessage =
await this.pluginService.auth.authenticateOrCreateKey();
if (!signedMessage) {
throw new Error("Failed to authenticate or create a key.");
}
Expand All @@ -175,7 +178,7 @@ export class TunnelService {

if (!isValid || !accountId) {
throw new Error(
"OpenAPI specification validation failed or missing account ID.",
"OpenAPI specification validation failed or missing account ID."
);
}

Expand All @@ -186,7 +189,7 @@ export class TunnelService {

if (!result) {
console.log(
"Initial registration failed. Waiting for file changes to retry...",
"Initial registration failed. Waiting for file changes to retry..."
);
return;
}
Expand Down Expand Up @@ -214,22 +217,23 @@ export class TunnelService {

private async handleFileChange(
event: { filename: string | null },
projectDir: string,
projectDir: string
): Promise<void> {
if (!this.tunnelUrl || !this.pluginId) return;

const relativePath = relative(projectDir, event.filename ?? "");
if (this.shouldIgnorePath(relativePath)) return;

console.log(
`Change detected in ${relativePath}. Attempting to update or register the plugin...`,
`Change detected in ${relativePath}. Attempting to update or register the plugin...`
);

const { accountId } = await validateAndParseOpenApiSpec(
getSpecUrl(this.tunnelUrl),
getSpecUrl(this.tunnelUrl)
);
const authentication = await this.pluginService.auth.getAuthentication(
accountId
);
const authentication =
await this.pluginService.auth.getAuthentication(accountId);

const result = authentication
? await this.pluginService.update(this.pluginId, accountId)
Expand Down Expand Up @@ -274,7 +278,7 @@ export class TunnelService {
const updatedConfig = { ...existingConfig, ...data };
await appendToEnv(
BITTE_CONFIG_ENV_KEY,
JSON.stringify(updatedConfig, null, 2),
JSON.stringify(updatedConfig, null, 2)
);
console.log("BITTE_CONFIG updated successfully.");
}
Expand Down

0 comments on commit 75a1ba6

Please sign in to comment.