Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstubbs committed May 30, 2024
2 parents dbac74e + 290774e commit c27f08f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
6 changes: 3 additions & 3 deletions packages/cli/src/cli/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ const init = async ({
template === "gatsby"
? ".env.development"
: template === "vue"
? ".env"
: ".env.local";
? ".env"
: ".env.local";

copyFileSync(
path.join(absoluteProjectPath, ".env.example"),
Expand Down Expand Up @@ -181,7 +181,7 @@ const init = async ({
await inquirer.prompt({
type: "list",
name: "siteId",
choices: (await AddOnApiHelper.listSites())
choices: (await AddOnApiHelper.listSites({}))
.filter((x) => !x.__isPlayground)
.map((x) => `${x.url} (${x.id})`),
})
Expand Down
13 changes: 6 additions & 7 deletions packages/core/src/core/pantheon-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ function generateBaseURL(req: ApiRequest) {
// If this is a forwarded request, use the protocol and host from the headers.
if (req.headers?.["x-forwarded-host"]) {
return `${
req.headers["x-forwarded-proto"] || req.connection?.encrypted
? "https"
: "http"
req.headers["x-forwarded-proto"] ||
(req.connection?.encrypted ? "https" : "http")
}://${req.headers["x-forwarded-host"]}`;
}

Expand Down Expand Up @@ -200,8 +199,8 @@ export const PantheonAPI = (givenOptions?: PantheonAPIOptions) => {
const command = Array.isArray(commandInput)
? commandInput
: typeof commandInput === "string"
? commandInput.split("/")
: [commandInput];
? commandInput.split("/")
: [commandInput];

if (pccGrant) {
setCookie(headers, `PCC-GRANT=${pccGrant}; Path=/; SameSite=Lax`);
Expand Down Expand Up @@ -398,8 +397,8 @@ function setCookie(headers: Headers, value: string) {
...(typeof previous === "string"
? [previous]
: Array.isArray(previous)
? previous
: []),
? previous
: []),
value,
].join("; "),
);
Expand Down
42 changes: 21 additions & 21 deletions packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,25 +193,25 @@ type InferFieldProps<T extends SmartComponentMapField> = T extends {
? O extends readonly { value: infer V }[]
? V
: O extends readonly string[]
? O[number]
: unknown
? O[number]
: unknown
: T extends { type: "number" }
? number
: T extends { type: "boolean" }
? boolean
: T extends { type: "string" | "file" | "date" }
? string
: T extends {
type: "object";
fields: Record<string, unknown>;
}
? T["multiple"] extends true
? Optional<
{ [K in keyof T["fields"]]: InferFieldProps<T["fields"][K]> },
OptionalFields<T["fields"]>
>[]
: Optional<
{ [K in keyof T["fields"]]: InferFieldProps<T["fields"][K]> },
OptionalFields<T["fields"]>
>
: unknown;
? number
: T extends { type: "boolean" }
? boolean
: T extends { type: "string" | "file" | "date" }
? string
: T extends {
type: "object";
fields: Record<string, unknown>;
}
? T["multiple"] extends true
? Optional<
{ [K in keyof T["fields"]]: InferFieldProps<T["fields"][K]> },
OptionalFields<T["fields"]>
>[]
: Optional<
{ [K in keyof T["fields"]]: InferFieldProps<T["fields"][K]> },
OptionalFields<T["fields"]>
>
: unknown;

0 comments on commit c27f08f

Please sign in to comment.