Skip to content

Commit

Permalink
[wrangler] Fix lint issues (#3821)
Browse files Browse the repository at this point in the history
* Fix lint issues

* Removing unused type annotation
  • Loading branch information
jculvey authored Aug 24, 2023
1 parent a8d8d9a commit 6b6788d
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/pages/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MockedRequest, rest } from "msw";
import { FormData } from "undici";
import { version } from "../../../package.json";
import { ROUTES_SPEC_VERSION } from "../../pages/constants";
import { ApiErrorCodes } from "../../pages/errors";
import { isRoutesJSONSpec } from "../../pages/functions/routes-validation";
import { endEventLoop } from "../helpers/end-event-loop";
import { mockAccountId, mockApiToken } from "../helpers/mock-account-id";
Expand All @@ -18,7 +19,6 @@ import { runWrangler } from "../helpers/run-wrangler";
import { normalizeProgressSteps } from "./project-upload.test";
import type { Project, UploadPayloadFile } from "../../pages/types";
import type { RestRequest } from "msw";
import { ApiErrorCodes } from "../../pages/errors";

describe("deployment create", () => {
const std = mockConsoleMethods();
Expand Down
9 changes: 1 addition & 8 deletions packages/wrangler/src/api/pages/deploy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { fetchResult } from "../../cfetch";
import { FatalError } from "../../errors";
import { logger } from "../../logger";
import { buildFunctions } from "../../pages/buildFunctions";
import { MAX_DEPLOYMENT_ATTEMPTS } from "../../pages/constants";
import {
ApiErrorCodes,
FunctionsNoRoutesError,
Expand All @@ -23,7 +24,6 @@ import { validate } from "../../pages/validate";
import { createUploadWorkerBundleContents } from "./create-worker-bundle-contents";
import type { BundleResult } from "../../deployment-bundle/bundle";
import type { Project, Deployment } from "@cloudflare/types";
import { MAX_DEPLOYMENT_ATTEMPTS } from "../../pages/constants";

interface PagesDeployOptions {
/**
Expand Down Expand Up @@ -160,11 +160,6 @@ export async function deploy({
// Routing configuration displayed in the Functions tab of a deployment in Dash
let filepathRoutingConfig: string | undefined;

const d1Databases = Object.keys(
project.deployment_configs[isProduction ? "production" : "preview"]
.d1_databases ?? {}
);

if (!_workerJS && existsSync(functionsDirectory)) {
const outputConfigPath = join(
tmpdir(),
Expand All @@ -179,7 +174,6 @@ export async function deploy({
buildOutputDirectory: directory,
routesOutputPath,
local: false,
d1Databases,
nodejsCompat,
});

Expand Down Expand Up @@ -259,7 +253,6 @@ export async function deploy({
workerBundle = await traverseAndBuildWorkerJSDirectory({
workerJSDirectory: _workerPath,
buildOutputDirectory: directory,
d1Databases,
nodejsCompat,
});
} else if (_workerJS) {
Expand Down
1 change: 0 additions & 1 deletion packages/wrangler/src/dev/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ function DevSession(props: DevSessionProps) {
useCustomBuild(props.entry, props.build);

const directory = useTmpDir();
const handleError = useErrorHandler();

const workerDefinitions = useDevRegistry(
props.name,
Expand Down
13 changes: 0 additions & 13 deletions packages/wrangler/src/pages/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,9 @@ export const Handler = async (args: PagesBuildArgs) => {
buildOutputDirectory,
nodejsCompat,
legacyNodeCompat,
bindings,
workerScriptPath,
} = validatedArgs;

let d1Databases: string[] | undefined = undefined;
if (bindings) {
try {
const decodedBindings = JSON.parse(bindings);
d1Databases = Object.keys(decodedBindings?.d1_databases || {});
} catch {
throw new FatalError("Could not parse a valid set of 'bindings'.", 1);
}
}

/**
* prioritize building `_worker.js` over Pages Functions, if both exist
* and if we were able to resolve _worker.js
Expand All @@ -209,7 +198,6 @@ export const Handler = async (args: PagesBuildArgs) => {
bundle = await traverseAndBuildWorkerJSDirectory({
workerJSDirectory: workerScriptPath,
buildOutputDirectory,
d1Databases,
nodejsCompat,
});
} else {
Expand Down Expand Up @@ -251,7 +239,6 @@ export const Handler = async (args: PagesBuildArgs) => {
nodejsCompat,
routesOutputPath,
local: false,
d1Databases,
});
} catch (e) {
if (e instanceof FunctionsNoRoutesError) {
Expand Down
2 changes: 0 additions & 2 deletions packages/wrangler/src/pages/buildFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export async function buildFunctions({
legacyNodeCompat,
nodejsCompat,
local,
d1Databases,
}: Partial<
Pick<
PagesBuildArgs,
Expand All @@ -54,7 +53,6 @@ export async function buildFunctions({
onEnd?: () => void;
routesOutputPath?: PagesBuildArgs["outputRoutesPath"];
local: boolean;
d1Databases?: string[];
legacyNodeCompat?: boolean;
nodejsCompat?: boolean;
}) {
Expand Down
2 changes: 0 additions & 2 deletions packages/wrangler/src/pages/functions/buildWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,10 @@ export function buildRawWorker({
export async function traverseAndBuildWorkerJSDirectory({
workerJSDirectory,
buildOutputDirectory,
d1Databases,
nodejsCompat,
}: {
workerJSDirectory: string;
buildOutputDirectory: string;
d1Databases?: string[];
nodejsCompat?: boolean;
}): Promise<BundleResult> {
const entrypoint = resolve(join(workerJSDirectory, "index.js"));
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/pages/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import {
MAX_UPLOAD_ATTEMPTS,
} from "./constants";

import { ApiErrorCodes } from "./errors";
import { validate } from "./validate";
import type {
CommonYargsArgv,
StrictYargsOptionsToInterface,
} from "../yargs-types";
import type { UploadPayloadFile } from "./types";
import type { FileContainer } from "./validate";
import { ApiErrorCodes } from "./errors";

type UploadArgs = StrictYargsOptionsToInterface<typeof Options>;

Expand Down

0 comments on commit 6b6788d

Please sign in to comment.