Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Nov 24, 2023
1 parent e2a78b2 commit a6dff1e
Show file tree
Hide file tree
Showing 667 changed files with 4,161 additions and 4,157 deletions.
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"printWidth": 120,
"tabWidth": 4,
"trailingComma": "none",
"overrides": [
{
"files": "*.{yml,yaml,json,md,mdx}",
Expand Down
6 changes: 3 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import defaultConfig from "./shared/jest.config.shared";
export default async (): Promise<Config> => {
const packages = await getAllPackages({
// in PRs, only run tests on the changed packages
since: isBranchInCi(),
since: isBranchInCi()
});

return {
Expand All @@ -19,9 +19,9 @@ export default async (): Promise<Config> => {
return {
...defaultConfig,
displayName: p.name,
rootDir: `${p.location}/src`,
rootDir: `${p.location}/src`
};
}),
})
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getOrganizationNameValidationError } from "./getOrganizationNameValidat
export async function createOrganizationIfDoesNotExist({
organization,
token,
context,
context
}: {
organization: string;
token: FernUserToken;
Expand All @@ -26,7 +26,7 @@ export async function createOrganizationIfDoesNotExist({
context.failAndThrow(validationError);
}
const createOrganizationResponse = await venus.organization.create({
organizationId: FernVenusApi.OrganizationId(organization),
organizationId: FernVenusApi.OrganizationId(organization)
});
if (!createOrganizationResponse.ok) {
context.failAndThrow(`Failed to create organization: ${organization}`, createOrganizationResponse.error);
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/auth/src/persistence/getToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function getAccessToken(): Promise<FernOrganizationToken | undefine
}
return {
type: "organization",
value: tokenFromEnvVar,
value: tokenFromEnvVar
};
}

Expand All @@ -35,6 +35,6 @@ export async function getUserToken(): Promise<FernUserToken | undefined> {

return {
type: "user",
value: tokenString,
value: tokenString
};
}
2 changes: 1 addition & 1 deletion packages/cli/auth/src/users/getCurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FernUserToken } from "../FernToken";

export async function getCurrentUser({
token,
context,
context
}: {
token: FernUserToken;
context: TaskContext;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/auth/src/verify/verifyJwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import jwksClient from "jwks-rsa";
import { FernUserToken } from "../FernToken";

const client = jwksClient({
jwksUri: `https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json`,
jwksUri: `https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json`
});

export async function verifyJwt(token: FernUserToken): Promise<boolean> {
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/cli/build.dev.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ async function main() {
"process.env.VENUS_AUDIENCE": getEnvironmentVariable("VENUS_AUDIENCE"),
"process.env.LOCAL_STORAGE_FOLDER": getEnvironmentVariable("LOCAL_STORAGE_FOLDER"),
"process.env.POSTHOG_API_KEY": getEnvironmentVariable("POSTHOG_API_KEY"),
"process.env.DOCS_DOMAIN_SUFFIX": getEnvironmentVariable("DOCS_DOMAIN_SUFFIX"),
},
"process.env.DOCS_DOMAIN_SUFFIX": getEnvironmentVariable("DOCS_DOMAIN_SUFFIX")
}
};

function getEnvironmentVariable(environmentVariable) {
Expand Down Expand Up @@ -63,7 +63,7 @@ require("./bundle.cjs");`
version: packageJson.version,
repository: packageJson.repository,
files: ["bundle.cjs", "cli.cjs"],
bin: { "fern-dev": "cli.cjs" },
bin: { "fern-dev": "cli.cjs" }
},
undefined,
2
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/cli/build.prod.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ async function main() {
"process.env.VENUS_AUDIENCE": getEnvironmentVariable("VENUS_AUDIENCE"),
"process.env.LOCAL_STORAGE_FOLDER": getEnvironmentVariable("LOCAL_STORAGE_FOLDER"),
"process.env.POSTHOG_API_KEY": getEnvironmentVariable("POSTHOG_API_KEY"),
"process.env.DOCS_DOMAIN_SUFFIX": getEnvironmentVariable("DOCS_DOMAIN_SUFFIX"),
},
"process.env.DOCS_DOMAIN_SUFFIX": getEnvironmentVariable("DOCS_DOMAIN_SUFFIX")
}
};

function getEnvironmentVariable(environmentVariable) {
Expand Down Expand Up @@ -63,7 +63,7 @@ require("./bundle.cjs");`
version: packageJson.version,
repository: packageJson.repository,
files: ["bundle.cjs", "cli.cjs"],
bin: { fern: "cli.cjs" },
bin: { fern: "cli.cjs" }
},
undefined,
2
Expand Down
22 changes: 11 additions & 11 deletions packages/cli/cli/src/cli-context/CliContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class CliContext {
this.environment = {
packageName,
packageVersion,
cliName,
cliName
};
}

Expand Down Expand Up @@ -104,13 +104,13 @@ export class CliContext {
[Promise<FernCliUpgradeInfo>, Promise<never>]
>([
this.isUpgradeAvailable(),
new Promise((_resolve, reject) => setTimeout(() => reject("Request timed out"), 300)),
new Promise((_resolve, reject) => setTimeout(() => reject("Request timed out"), 300))
]);

if (isUpgradeAvailable) {
let upgradeMessage = getFernCliUpgradeMessage({
toVersion: latestVersion,
cliEnvironment: this.environment,
cliEnvironment: this.environment
});
if (!upgradeMessage.endsWith("\n")) {
upgradeMessage += "\n";
Expand Down Expand Up @@ -210,7 +210,7 @@ export class CliContext {
const prefixWithColor = chalk.hex(colorForWorkspace)(prefix);
return {
...this.constructTaskInit(),
logPrefix: prefixWithColor,
logPrefix: prefixWithColor
};
}

Expand All @@ -226,7 +226,7 @@ export class CliContext {
instrumentPostHogEvent: (event) => {
this.instrumentPostHogEvent(event);
},
shouldBufferLogs: false,
shouldBufferLogs: false
};
}

Expand All @@ -235,15 +235,15 @@ export class CliContext {
{
parts,
level,
time: new Date(),
},
time: new Date()
}
]);
}

private logImmediately(logs: Log[]): void {
const filtered = logs.filter((log) => LOG_LEVELS.indexOf(log.level) >= LOG_LEVELS.indexOf(this.logLevel));
this.ttyAwareLogger.log(filtered, {
includeDebugInfo: this.logLevel === LogLevel.Debug,
includeDebugInfo: this.logLevel === LogLevel.Debug
});
}

Expand All @@ -254,7 +254,7 @@ export class CliContext {

private _isUpgradeAvailable: FernCliUpgradeInfo | undefined;
public async isUpgradeAvailable({
includePreReleases = false,
includePreReleases = false
}: {
includePreReleases?: boolean;
} = {}): Promise<FernCliUpgradeInfo> {
Expand All @@ -263,7 +263,7 @@ export class CliContext {

const latestPackageVersion = await getLatestVersionOfCli({
cliEnvironment: this.environment,
includePreReleases,
includePreReleases
});
const isUpgradeAvailable = isVersionAhead(latestPackageVersion, this.environment.packageVersion);

Expand All @@ -274,7 +274,7 @@ export class CliContext {

this._isUpgradeAvailable = {
isUpgradeAvailable,
latestVersion: latestPackageVersion,
latestVersion: latestPackageVersion
};
}
return this._isUpgradeAvailable;
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/cli/src/cli-context/TaskContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
PosthogEvent,
Startable,
TaskContext,
TaskResult,
TaskResult
} from "@fern-api/task-context";
import chalk from "chalk";
import { Log } from "./Log";
Expand Down Expand Up @@ -44,7 +44,7 @@ export class TaskContextImpl implements Startable<TaskContext>, Finishable, Task
takeOverTerminal,
onResult,
shouldBufferLogs,
instrumentPostHogEvent,
instrumentPostHogEvent
}: TaskContextImpl.Init) {
this.logImmediately = logImmediately;
this.logPrefix = logPrefix ?? "";
Expand Down Expand Up @@ -103,14 +103,14 @@ export class TaskContextImpl implements Startable<TaskContext>, Finishable, Task
parts,
level,
time: new Date(),
...overrides,
...overrides
});
}

protected log(log: Log): void {
this.bufferedLogs.push({
...log,
prefix: this.logPrefix,
prefix: this.logPrefix
});
if (!this.shouldBufferLogs) {
this.flushLogs();
Expand All @@ -133,7 +133,7 @@ export class TaskContextImpl implements Startable<TaskContext>, Finishable, Task
takeOverTerminal: this.takeOverTerminal,
onResult: this.onResult,
shouldBufferLogs: this.shouldBufferLogs,
instrumentPostHogEvent: (event) => this.instrumentPostHogEventImpl(event),
instrumentPostHogEvent: (event) => this.instrumentPostHogEventImpl(event)
});
this.subtasks.push(subtask);
return subtask;
Expand Down Expand Up @@ -187,7 +187,7 @@ export class InteractiveTaskContextImpl
public start(): Finishable & InteractiveTaskContext {
super.start();
this.logAtLevelWithOverrides(LogLevel.Info, ["Started."], {
omitOnTTY: true,
omitOnTTY: true
});
this.flushLogs();
return this;
Expand All @@ -200,11 +200,11 @@ export class InteractiveTaskContextImpl
public finish(): void {
if (this.result === TaskResult.Success) {
this.logAtLevelWithOverrides(LogLevel.Info, ["Finished."], {
omitOnTTY: true,
omitOnTTY: true
});
} else {
this.logAtLevelWithOverrides(LogLevel.Error, ["Failed."], {
omitOnTTY: true,
omitOnTTY: true
});
}
super.finish();
Expand All @@ -223,7 +223,7 @@ export class InteractiveTaskContextImpl

return addPrefixToString({
prefix: `${this.getIcon({ spinner }).padEnd(spinner.length)} `,
content: lines.join("\n"),
content: lines.join("\n")
});
}

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/cli/src/cli-context/TtyAwareLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class TtyAwareLogger {
...taskLines.map((taskLine) =>
addPrefixToString({ content: taskLine, prefix: "│ ", includePrefixOnAllLines: true })
),
"└─",
"└─"
].join("\n") + "\n";
this.lastPaint = paint;
return paint;
Expand Down Expand Up @@ -149,13 +149,13 @@ function formatLog(log: Log, { includeDebugInfo }: { includeDebugInfo: boolean }
if (log.prefix != null) {
content = addPrefixToString({
prefix: log.prefix,
content,
content
});
}
if (includeDebugInfo) {
content = addPrefixToString({
prefix: chalk.dim(getDebugPrefix(log)),
content,
content
});
}
content += "\n";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/cli/src/cli-context/logErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function logErrorMessage({
message,
error,
logger,
logLevel = LogLevel.Error,
logLevel = LogLevel.Error
}: {
message: string | undefined;
error: unknown;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { CliEnvironment } from "../CliEnvironment";

export async function doesVersionOfCliExist({
cliEnvironment,
version,
version
}: {
cliEnvironment: CliEnvironment;
version: string;
}): Promise<boolean> {
try {
await latestVersion(cliEnvironment.packageName, {
version,
version
});
return true;
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CliEnvironment } from "../CliEnvironment";

export function getFernCliUpgradeMessage({
cliEnvironment,
toVersion,
toVersion
}: {
cliEnvironment: CliEnvironment;
toVersion: string;
Expand All @@ -23,6 +23,6 @@ export function getFernCliUpgradeMessage({
float: "center",
textAlignment: "center",
borderColor: "yellow",
borderStyle: "round",
borderStyle: "round"
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CliEnvironment } from "../CliEnvironment";

export async function getLatestVersionOfCli({
cliEnvironment,
includePreReleases = false,
includePreReleases = false
}: {
cliEnvironment: CliEnvironment;
includePreReleases?: boolean;
Expand All @@ -14,6 +14,6 @@ export async function getLatestVersionOfCli({
return cliEnvironment.packageVersion;
}
return latestVersion(cliEnvironment.packageName, {
version: includePreReleases ? "prerelease" : "latest",
version: includePreReleases ? "prerelease" : "latest"
});
}
Loading

0 comments on commit a6dff1e

Please sign in to comment.