Skip to content

Commit

Permalink
[Hyperdrive] Update validation.ts (#4455)
Browse files Browse the repository at this point in the history
* [Hyperdrive] Update validation.ts

* fix up hyperdrive warning flag

* use NO_HYPERDRIVE_WARNING

* make linter happy
  • Loading branch information
rozenmd authored Nov 17, 2023
1 parent 01d34f2 commit 1747d21
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-pears-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: make it possible to ignore hyperdrive warnings
5 changes: 3 additions & 2 deletions packages/wrangler/src/config/validation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from "node:path";
import TOML from "@iarna/toml";
import { getConstellationWarningFromEnv } from "../constellation/utils";
import { getHyperdriveWarningFromEnv } from "../hyperdrive/utils";
import { Diagnostics } from "./diagnostics";
import {
deprecated,
Expand Down Expand Up @@ -2372,9 +2373,9 @@ const validateHyperdriveBinding: ValidatorFn = (diagnostics, field, value) => {
);
isValid = false;
}
if (isValid && getConstellationWarningFromEnv() === undefined) {
if (isValid && getHyperdriveWarningFromEnv() === undefined) {
diagnostics.warnings.push(
"Hyperdrive Bindings are currently in beta to allow the API to evolve before general availability.\nPlease report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose`"
"Hyperdrive Bindings are currently in beta to allow the API to evolve before general availability.\nPlease report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"
);
}
return isValid;
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/environment-variables/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type VariableNames =
| "CLOUDFLARE_API_TOKEN"
| "CLOUDFLARE_EMAIL"
| "NO_CONSTELLATION_WARNING"
| "NO_HYPERDRIVE_WARNING"
| "WRANGLER_API_ENVIRONMENT"
| "WRANGLER_AUTH_DOMAIN"
| "WRANGLER_AUTH_URL"
Expand Down
2 changes: 0 additions & 2 deletions packages/wrangler/src/hyperdrive/common.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/wrangler/src/hyperdrive/create.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readConfig } from "../config";
import { logger } from "../logger";
import { createConfig } from "./client";
import { hyperdriveBetaWarning } from "./common";
import { hyperdriveBetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/hyperdrive/delete.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readConfig } from "../config";
import { logger } from "../logger";
import { deleteConfig } from "./client";
import { hyperdriveBetaWarning } from "./common";
import { hyperdriveBetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/hyperdrive/get.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readConfig } from "../config";
import { logger } from "../logger";
import { getConfig } from "./client";
import { hyperdriveBetaWarning } from "./common";
import { hyperdriveBetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/hyperdrive/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { hyperdriveBetaWarning } from "./common";
import { options as createOptions, handler as createHandler } from "./create";
import { options as deleteOptions, handler as deleteHandler } from "./delete";
import { options as getOptions, handler as getHandler } from "./get";
import { options as listOptions, handler as listHandler } from "./list";
import { options as updateOptions, handler as updateHandler } from "./update";
import { hyperdriveBetaWarning } from "./utils";
import type { CommonYargsArgv } from "../yargs-types";

export function hyperdrive(yargs: CommonYargsArgv) {
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/hyperdrive/list.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readConfig } from "../config";
import { logger } from "../logger";
import { listConfigs } from "./client";
import { hyperdriveBetaWarning } from "./common";
import { hyperdriveBetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/hyperdrive/update.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readConfig } from "../config";
import { logger } from "../logger";
import { getConfig, updateConfig } from "./client";
import { hyperdriveBetaWarning } from "./common";
import { hyperdriveBetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand Down
9 changes: 9 additions & 0 deletions packages/wrangler/src/hyperdrive/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getEnvironmentVariableFactory } from "../environment-variables/factory";

export const getHyperdriveWarningFromEnv = getEnvironmentVariableFactory({
variableName: "NO_HYPERDRIVE_WARNING",
});

export const hyperdriveBetaWarning = process.env.NO_HYPERDRIVE_WARNING
? ""
: "--------------------\n📣 Hyperdrive is currently in open beta\n📣 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose\n📣 To give feedback, visit https://discord.gg/cloudflaredev\n--------------------\n";
1 change: 1 addition & 0 deletions packages/wrangler/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"NO_SCRIPT_SIZE_WARNING",
"EXPERIMENTAL_MIDDLEWARE",
"NO_D1_WARNING",
"NO_HYPERDRIVE_WARNING",
"WRANGLER",
"CUSTOM_BUILD_VAR",
"PWD",
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

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

0 comments on commit 1747d21

Please sign in to comment.