Skip to content

Commit

Permalink
fix: add env variabls to turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Dec 20, 2024
1 parent 3b7a74a commit c5aadb9
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 8 deletions.
1 change: 1 addition & 0 deletions clis/generator-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ReadmeParser } from "./readme/ReadmeParser";
import { ReferenceGenerator } from "./reference/ReferenceGenerator";

void yargs(hideBin(process.argv))
// eslint-disable-next-line turbo/no-undeclared-env-vars
.scriptName(process.env.CLI_NAME ?? "generator-cli")
.strict()
.command(
Expand Down
2 changes: 2 additions & 0 deletions clis/vercel-scripts/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ void yargs(hideBin(process.argv))
type: "string",
description: "The Vercel API token",
demandOption: true,
// eslint-disable-next-line turbo/no-undeclared-env-vars
default: process.env.VERCEL_TOKEN ?? getVercelTokenFromGlobalConfig(),
})
.options("teamId", {
type: "string",
description: "The Vercel team ID",
demandOption: false,
// eslint-disable-next-line turbo/no-undeclared-env-vars
default: process.env.VERCEL_ORG_ID ?? "team_6FKOM5nw037hv8g2mTk3gaH7",
})
.options("teamName", {
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default tseslint.config(
"**/.next",
"**/storybook-static",
"**/out",
"**/lib",
"**/node_modules",
"fern/**",
],
Expand All @@ -38,6 +39,7 @@ export default tseslint.config(

...compat.config({
extends: [
"turbo",
"prettier",
"next/core-web-vitals",
"next/typescript",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"eslint": "^9",
"eslint-config-next": "15.1.2",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.3.3",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.37.2",
Expand Down
1 change: 1 addition & 0 deletions packages/fern-docs/bundle/src/server/xfernhost/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function getDocsDomainNode(req: NextApiRequest): string {
// attempts to construct the host from environment variables, when the req object is not available
export function getHostNodeStatic(): string | undefined {
if (process.env.NODE_ENV === "development") {
// eslint-disable-next-line turbo/no-undeclared-env-vars
return `${process.env.HOST || "localhost"}:${process.env.PORT || 3000}`;
}

Expand Down
3 changes: 1 addition & 2 deletions packages/fern-docs/bundle/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"tasks": {
"docs:build": {
"outputs": [".next/**", "!.next/cache/**"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"dependsOn": ["^build", "^compile"]
"inputs": ["$TURBO_DEFAULT$", ".env*"]
},
"docs:dev": {
"dependsOn": ["^build", "^compile"]
Expand Down
3 changes: 2 additions & 1 deletion packages/fern-docs/components/src/FontAwesomeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function getIconUrl(icon: string | undefined): string {
function getCdnHost() {
return (
(typeof process !== "undefined"
? process.env.NEXT_PUBLIC_FONTAWESOME_CDN_HOST
? // eslint-disable-next-line turbo/no-undeclared-env-vars
process.env.NEXT_PUBLIC_FONTAWESOME_CDN_HOST
: undefined) ?? "https://icons.ferndocs.com"
);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/fern-docs/search-utils/src/SearchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ async function getAlgoliaSearchConfig(
return undefined;
}

const algoliaAppId = process.env.NEXT_PUBLIC_ALGOLIA_APP_ID;
const algoliaAppId = process.env.ALGOLIA_APP_ID;
// eslint-disable-next-line turbo/no-undeclared-env-vars
const algoliaSearchIndex = process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_INDEX;

assertNonNullish(
algoliaAppId,
"Missing environment variable: NEXT_PUBLIC_ALGOLIA_APP_ID"
"Missing environment variable: ALGOLIA_APP_ID"
);
assertNonNullish(
algoliaSearchIndex,
Expand Down
17 changes: 17 additions & 0 deletions packages/fern-docs/ui/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"compile": {
"env": [
"NODE_ENV",
"ESBUILD_BINARY_PATH",
"FERN_TOKEN",
"NEXT_DEPLOYMENT_ID",
"NEXT_PUBLIC_FDR_ORIGIN",
"NEXT_PUBLIC_VERCEL_ENV"
],
"inputs": ["$TURBO_DEFAULT$"]
}
}
}
1 change: 1 addition & 0 deletions packages/healthchecks/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { printResults } from "./printResults";
import { RuleResult, runRules } from "./rules/runRules";

void yargs(hideBin(process.argv))
// eslint-disable-next-line turbo/no-undeclared-env-vars
.scriptName(process.env.CLI_NAME ?? "fern-healthchecks")
.strict()
.command(
Expand Down
2 changes: 2 additions & 0 deletions packages/healthchecks/src/getDocsURLs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable turbo/no-undeclared-env-vars */

import { VercelClient } from "@fern-fern/vercel";
import { Domain } from "@fern-fern/vercel/api/resources/v9";

Expand Down
1 change: 1 addition & 0 deletions packages/scripts/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import { noop } from "ts-essentials";
import { hideBin } from "yargs/helpers";
import yargs from "yargs/yargs";
Expand Down
31 changes: 30 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions servers/fdr/src/__test__/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export const baseMockFdrConfig: FdrConfig = {
algoliaSearchV2Domains: [],
slackToken: "",
logLevel: "debug",
// eslint-disable-next-line turbo/no-undeclared-env-vars
docsCacheEndpoint: process.env.DOCS_CACHE_ENDPOINT || "",
enableCustomerNotifications: false,
applicationEnvironment: "mock",
Expand Down
30 changes: 30 additions & 0 deletions servers/fern-bot/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"compile": {
"env": [
"CUSTOMER_ALERTS_SLACK_CHANNEL",
"CUSTOMER_PULLS_SLACK_CHANNEL",
"DEFAULT_FDR_ORIGIN",
"DEFAULT_VENUS_ORIGIN",
"ENVIRONMENT",
"FERNIE_SLACK_APP_TOKEN",
"GITHUB_APP_CLIENT_ID",
"GITHUB_APP_CLIENT_SECRET",
"GITHUB_APP_ID",
"GITHUB_APP_LOGIN_ID",
"GITHUB_APP_LOGIN_NAME",
"GITHUB_APP_PRIVATE_KEY",
"GITHUB_APP_WEBHOOK_SECRET",
"HOME",
"NPM_CONFIG_CACHE",
"NPM_CONFIG_PREFIX",
"PINECONE_API_KEY",
"REPO_DATA_S3_BUCKET",
"REPO_DATA_S3_KEY",
"REPO_TO_RUN_ON"
]
}
}
}
53 changes: 51 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"compile": {
"outputs": ["dist/**"],
"dependsOn": ["^compile"]
"dependsOn": ["^compile"],
"env": ["NODE_ENV", "VERCEL_ENV"]
},
"check-types": {
"dependsOn": ["^compile"]
Expand Down Expand Up @@ -40,7 +41,55 @@
},
"docs:dev": {
"persistent": true,
"dependsOn": ["^build", "^compile"]
"dependsOn": ["^build", "^compile"],
"inputs": [
"$TURBO_DEFAULT$",
".env.production.local",
".env.local",
".env.production",
".env"
]
},
"docs:build": {
"dependsOn": ["^build", "^compile", "^docs:build"],
"env": [
"ALGOLIA_API_KEY",
"ALGOLIA_APP_ID",
"ALGOLIA_SEARCH_API_KEY",
"ALGOLIA_WRITE_API_KEY",
"ANTHROPIC_API_KEY",
"ANALYZE",
"AWS_ACCESS_KEY_ID",
"AWS_S3_ENDPOINT",
"AWS_REGION",
"AWS_S3_BUCKET_NAME",
"AWS_SECRET_ACCESS_KEY",
"COHERE_API_KEY",
"EDGE_CONFIG",
"ENABLE_ROOT_PATH_BUILD_CACHE",
"ENABLE_SOURCE_MAPS",
"FERN_TOKEN",
"JWT_SECRET_KEY",
"KV_REST_API_READ_ONLY_TOKEN",
"KV_REST_API_TOKEN",
"KV_REST_API_URL",
"KV_URL",
"NODE_ENV",
"OPENAI_API_KEY",
"QSTASH_CURRENT_SIGNING_KEY",
"QSTASH_NEXT_SIGNING_KEY",
"QSTASH_TOKEN",
"QSTASH_URL",
"TRAILING_SLASH",
"TURBOPUFFER_API_KEY",
"VERCEL",
"VERCEL_AUTOMATION_BYPASS_SECRET",
"VERCEL_DEPLOYMENT_ID",
"VERCEL_ENV",
"VERCEL_URL",
"WORKOS_API_KEY",
"WORKOS_CLIENT_ID"
]
}
},
"globalDependencies": ["eslint.config.mjs", ".prettierrc.json"]
Expand Down

0 comments on commit c5aadb9

Please sign in to comment.