Skip to content

Commit

Permalink
[D1] remove d1BetaWarning and all usages (#5422)
Browse files Browse the repository at this point in the history
* Removing d1BetaWarning and all usages

* add changeset

* update tests

---------

Co-authored-by: Max Rozen <3822106+rozenmd@users.noreply.github.com>
  • Loading branch information
geelen and rozenmd committed Mar 28, 2024
1 parent fbdca7d commit b341614
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 75 deletions.
7 changes: 7 additions & 0 deletions .changeset/tame-timers-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: remove d1BetaWarning and all usages

This PR removes the warning that D1 is in beta for all D1 commands.
21 changes: 3 additions & 18 deletions packages/wrangler/src/__tests__/d1/d1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ describe("d1", () => {
-c, --config Path to .toml configuration file [string]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
--------------------
🚧 D1 is currently in open beta
🚧 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
--------------------"
-v, --version Show version number [boolean]"
`);
});

Expand Down Expand Up @@ -73,12 +68,7 @@ describe("d1", () => {
-c, --config Path to .toml configuration file [string]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
--------------------
🚧 D1 is currently in open beta
🚧 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
--------------------"
-v, --version Show version number [boolean]"
`);
});

Expand Down Expand Up @@ -108,12 +98,7 @@ describe("d1", () => {
-c, --config Path to .toml configuration file [string]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
--------------------
🚧 D1 is currently in open beta
🚧 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
--------------------"
-v, --version Show version number [boolean]"
`);
});

Expand Down
4 changes: 1 addition & 3 deletions packages/wrangler/src/d1/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { logger } from "../logger";
import { requireAuth } from "../user";
import { renderToString } from "../utils/render";
import { LOCATION_CHOICES } from "./constants";
import { d1BetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand All @@ -26,8 +25,7 @@ export function Options(yargs: CommonYargsArgv) {
describe:
"A hint for the primary location of the new DB. Options:\nweur: Western Europe\neeur: Eastern Europe\napac: Asia Pacific\nwnam: Western North America\nenam: Eastern North America \n",
type: "string",
})
.epilogue(d1BetaWarning);
});
}

type HandlerOptions = StrictYargsOptionsToInterface<typeof Options>;
Expand Down
16 changes: 7 additions & 9 deletions packages/wrangler/src/d1/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ import { confirm } from "../dialogs";
import { logger } from "../logger";
import { requireAuth } from "../user";
import { Name } from "./options";
import { d1BetaWarning, getDatabaseByNameOrBinding } from "./utils";
import { getDatabaseByNameOrBinding } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
} from "../yargs-types";
import type { Database } from "./types";

export function Options(d1ListYargs: CommonYargsArgv) {
return Name(d1ListYargs)
.option("skip-confirmation", {
describe: "Skip confirmation",
type: "boolean",
alias: "y",
default: false,
})
.epilogue(d1BetaWarning);
return Name(d1ListYargs).option("skip-confirmation", {
describe: "Skip confirmation",
type: "boolean",
alias: "y",
default: false,
});
}
type HandlerOptions = StrictYargsOptionsToInterface<typeof Options>;
export const Handler = withConfig<HandlerOptions>(
Expand Down
4 changes: 0 additions & 4 deletions packages/wrangler/src/d1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as Insights from "./insights";
import * as List from "./list";
import * as Migrations from "./migrations";
import * as TimeTravel from "./timeTravel";
import { d1BetaWarning } from "./utils";
import type { CommonYargsArgv } from "../yargs-types";

export function d1(yargs: CommonYargsArgv) {
Expand Down Expand Up @@ -65,7 +64,6 @@ export function d1(yargs: CommonYargsArgv) {
Backups.DownloadOptions,
Backups.DownloadHandler
)
.epilogue(d1BetaWarning)
)
// .command(
// "console <name>",
Expand Down Expand Up @@ -127,8 +125,6 @@ export function d1(yargs: CommonYargsArgv) {
Migrations.ApplyOptions,
Migrations.ApplyHandler
)
.epilogue(d1BetaWarning)
)
.epilogue(d1BetaWarning)
);
}
9 changes: 2 additions & 7 deletions packages/wrangler/src/d1/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import { withConfig } from "../config";
import { logger } from "../logger";
import { requireAuth } from "../user";
import { renderToString } from "../utils/render";
import {
d1BetaWarning,
getDatabaseByNameOrBinding,
getDatabaseInfoFromId,
} from "./utils";
import { getDatabaseByNameOrBinding, getDatabaseInfoFromId } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand All @@ -29,8 +25,7 @@ export function Options(d1ListYargs: CommonYargsArgv) {
describe: "return output as clean JSON",
type: "boolean",
default: false,
})
.epilogue(d1BetaWarning);
});
}

type HandlerOptions = StrictYargsOptionsToInterface<typeof Options>;
Expand Down
9 changes: 2 additions & 7 deletions packages/wrangler/src/d1/insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import { fetchGraphqlResult } from "../cfetch";
import { withConfig } from "../config";
import { logger } from "../logger";
import { requireAuth } from "../user";
import {
d1BetaWarning,
getDatabaseByNameOrBinding,
getDatabaseInfoFromId,
} from "./utils";
import { getDatabaseByNameOrBinding, getDatabaseInfoFromId } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
Expand Down Expand Up @@ -50,8 +46,7 @@ export function Options(d1ListYargs: CommonYargsArgv) {
describe: "return output as clean JSON",
type: "boolean",
default: false,
})
.epilogue(d1BetaWarning);
});
}

const cliOptionToGraphQLOption = {
Expand Down
13 changes: 5 additions & 8 deletions packages/wrangler/src/d1/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ import { withConfig } from "../config";
import { logger } from "../logger";
import { requireAuth } from "../user";
import { renderToString } from "../utils/render";
import { d1BetaWarning } from "./utils";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
} from "../yargs-types";
import type { Database } from "./types";

export function Options(d1ListYargs: CommonYargsArgv) {
return d1ListYargs
.option("json", {
describe: "return output as clean JSON",
type: "boolean",
default: false,
})
.epilogue(d1BetaWarning);
return d1ListYargs.option("json", {
describe: "return output as clean JSON",
type: "boolean",
default: false,
});
}

type HandlerOptions = StrictYargsOptionsToInterface<typeof Options>;
Expand Down
25 changes: 10 additions & 15 deletions packages/wrangler/src/d1/options.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import { d1BetaWarning } from "./utils";
import type { CommonYargsArgv } from "../yargs-types";

export function Name(yargs: CommonYargsArgv) {
return yargs
.positional("name", {
describe: "The name or binding of the DB",
type: "string",
demandOption: true,
})
.epilogue(d1BetaWarning);
return yargs.positional("name", {
describe: "The name or binding of the DB",
type: "string",
demandOption: true,
});
}

export function Database(yargs: CommonYargsArgv) {
return yargs
.positional("database", {
describe: "The name or binding of the DB",
type: "string",
demandOption: true,
})
.epilogue(d1BetaWarning);
return yargs.positional("database", {
describe: "The name or binding of the DB",
type: "string",
demandOption: true,
});
}
4 changes: 0 additions & 4 deletions packages/wrangler/src/d1/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ export const getDatabaseByNameOrBinding = async (
return matchingDB;
};

export const d1BetaWarning = process.env.NO_D1_WARNING
? ""
: "--------------------\n🚧 D1 is currently in open beta\n🚧 Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose\n--------------------\n";

export const getDatabaseInfoFromId = async (
accountId: string,
databaseId: string
Expand Down

0 comments on commit b341614

Please sign in to comment.