mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2025-02-02 02:14:45 +01:00
Add wrangler dist
This commit is contained in:
parent
9fed19aa4e
commit
f87db509f7
29 changed files with 37576 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
||||||
dist
|
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
|
6
dist/exec.d.ts
vendored
Normal file
6
dist/exec.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { exec as _childProcessExec } from "node:child_process";
|
||||||
|
export { exec } from "@actions/exec";
|
||||||
|
declare const childProcessExec: typeof _childProcessExec.__promisify__;
|
||||||
|
export declare function execShell(command: string, { silent, ...options }?: Parameters<typeof childProcessExec>[1] & {
|
||||||
|
silent?: boolean;
|
||||||
|
}): Promise<number | null>;
|
1
dist/index.d.ts
vendored
Normal file
1
dist/index.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
37255
dist/index.mjs
vendored
Normal file
37255
dist/index.mjs
vendored
Normal file
File diff suppressed because one or more lines are too long
3
dist/package.json
vendored
Normal file
3
dist/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
24
dist/packageManagers.d.ts
vendored
Normal file
24
dist/packageManagers.d.ts
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
export interface PackageManager {
|
||||||
|
install: string;
|
||||||
|
exec: string;
|
||||||
|
execNoInstall: string;
|
||||||
|
}
|
||||||
|
export declare function getPackageManager(name: string, { workingDirectory }?: {
|
||||||
|
workingDirectory?: string;
|
||||||
|
}): {
|
||||||
|
readonly install: "npm i";
|
||||||
|
readonly exec: "npx";
|
||||||
|
readonly execNoInstall: "npx --no-install";
|
||||||
|
} | {
|
||||||
|
readonly install: "yarn add";
|
||||||
|
readonly exec: "yarn";
|
||||||
|
readonly execNoInstall: "yarn";
|
||||||
|
} | {
|
||||||
|
readonly install: "pnpm add";
|
||||||
|
readonly exec: "pnpm exec";
|
||||||
|
readonly execNoInstall: "pnpm exec";
|
||||||
|
} | {
|
||||||
|
readonly install: "bun i";
|
||||||
|
readonly exec: "bunx";
|
||||||
|
readonly execNoInstall: "bun run";
|
||||||
|
};
|
1
dist/packageManagers.test.d.ts
vendored
Normal file
1
dist/packageManagers.test.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
23
dist/service/github.d.ts
vendored
Normal file
23
dist/service/github.d.ts
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { getOctokit } from "@actions/github";
|
||||||
|
import { OutputEntryPagesDeployment } from "../wranglerArtifactManager";
|
||||||
|
import { WranglerActionConfig } from "../wranglerAction";
|
||||||
|
type Octokit = ReturnType<typeof getOctokit>;
|
||||||
|
export declare function createGitHubDeployment({ config, octokit, productionBranch, environment, deploymentId, projectName, deploymentUrl, }: {
|
||||||
|
config: WranglerActionConfig;
|
||||||
|
octokit: Octokit;
|
||||||
|
productionBranch: string;
|
||||||
|
environment: string;
|
||||||
|
deploymentId: string | null;
|
||||||
|
projectName: string;
|
||||||
|
deploymentUrl?: string;
|
||||||
|
}): Promise<void>;
|
||||||
|
export declare function createJobSummary({ commitHash, deploymentUrl, aliasUrl, }: {
|
||||||
|
commitHash: string;
|
||||||
|
deploymentUrl?: string;
|
||||||
|
aliasUrl?: string;
|
||||||
|
}): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Create github deployment, if GITHUB_TOKEN is present in config
|
||||||
|
*/
|
||||||
|
export declare function createGitHubDeploymentAndJobSummary(config: WranglerActionConfig, pagesArtifactFields: OutputEntryPagesDeployment): Promise<void>;
|
||||||
|
export {};
|
1
dist/service/github.spec.d.ts
vendored
Normal file
1
dist/service/github.spec.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
8
dist/test/fixtures/build-quiet/index.d.ts
vendored
Normal file
8
dist/test/fixtures/build-quiet/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/bun/index.d.ts
vendored
Normal file
8
dist/test/fixtures/bun/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/environment/index.d.ts
vendored
Normal file
8
dist/test/fixtures/environment/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/npm/index.d.ts
vendored
Normal file
8
dist/test/fixtures/npm/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/only-build/index.d.ts
vendored
Normal file
8
dist/test/fixtures/only-build/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/pnpm/index.d.ts
vendored
Normal file
8
dist/test/fixtures/pnpm/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/pre-installed-wrangler/index.d.ts
vendored
Normal file
8
dist/test/fixtures/pre-installed-wrangler/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/secrets-default/index.d.ts
vendored
Normal file
8
dist/test/fixtures/secrets-default/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/secrets-v2/index.d.ts
vendored
Normal file
8
dist/test/fixtures/secrets-v2/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
2
dist/test/fixtures/specify-package-manager/index.d.ts
vendored
Normal file
2
dist/test/fixtures/specify-package-manager/index.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
declare const _default: {};
|
||||||
|
export default _default;
|
2
dist/test/fixtures/unspecified-package-manager/index.d.ts
vendored
Normal file
2
dist/test/fixtures/unspecified-package-manager/index.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
declare const _default: {};
|
||||||
|
export default _default;
|
8
dist/test/fixtures/yarn/index.d.ts
vendored
Normal file
8
dist/test/fixtures/yarn/index.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
type Env = {
|
||||||
|
SECRET1?: string;
|
||||||
|
SECRET2?: string;
|
||||||
|
};
|
||||||
|
declare const _default: {
|
||||||
|
fetch(request: Request, env: Env): Response;
|
||||||
|
};
|
||||||
|
export default _default;
|
6
dist/test/mocks.d.ts
vendored
Normal file
6
dist/test/mocks.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export declare function mockGithubDeployments({ githubUser, githubRepoName, }: {
|
||||||
|
githubUser: string;
|
||||||
|
githubRepoName: string;
|
||||||
|
}): {
|
||||||
|
handlers: import("msw").HttpHandler[];
|
||||||
|
};
|
4
dist/test/test-utils.d.ts
vendored
Normal file
4
dist/test/test-utils.d.ts
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import { WranglerActionConfig } from "../wranglerAction";
|
||||||
|
export declare function getTestConfig({ config, }?: {
|
||||||
|
config?: Partial<WranglerActionConfig>;
|
||||||
|
}): WranglerActionConfig;
|
8
dist/utils.d.ts
vendored
Normal file
8
dist/utils.d.ts
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { WranglerActionConfig } from "./wranglerAction";
|
||||||
|
/**
|
||||||
|
* A helper function to compare two semver versions. If the second arg is greater than the first arg, it returns true.
|
||||||
|
*/
|
||||||
|
export declare function semverCompare(version1: string, version2: string): boolean;
|
||||||
|
export declare function checkWorkingDirectory(workingDirectory?: string): string;
|
||||||
|
export declare function info(config: WranglerActionConfig, message: string, bypass?: boolean): void;
|
||||||
|
export declare function error(config: WranglerActionConfig, message: string, bypass?: boolean): void;
|
1
dist/utils.test.d.ts
vendored
Normal file
1
dist/utils.test.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
54
dist/wranglerAction.d.ts
vendored
Normal file
54
dist/wranglerAction.d.ts
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
import { PackageManager } from "./packageManagers";
|
||||||
|
import { info } from "./utils";
|
||||||
|
export type WranglerActionConfig = z.infer<typeof wranglerActionConfig>;
|
||||||
|
export declare const wranglerActionConfig: z.ZodObject<{
|
||||||
|
WRANGLER_VERSION: z.ZodString;
|
||||||
|
didUserProvideWranglerVersion: z.ZodBoolean;
|
||||||
|
secrets: z.ZodArray<z.ZodString, "many">;
|
||||||
|
workingDirectory: z.ZodString;
|
||||||
|
CLOUDFLARE_API_TOKEN: z.ZodString;
|
||||||
|
CLOUDFLARE_ACCOUNT_ID: z.ZodString;
|
||||||
|
ENVIRONMENT: z.ZodString;
|
||||||
|
VARS: z.ZodArray<z.ZodString, "many">;
|
||||||
|
COMMANDS: z.ZodArray<z.ZodString, "many">;
|
||||||
|
QUIET_MODE: z.ZodBoolean;
|
||||||
|
PACKAGE_MANAGER: z.ZodString;
|
||||||
|
WRANGLER_OUTPUT_DIR: z.ZodString;
|
||||||
|
GITHUB_TOKEN: z.ZodString;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
WRANGLER_VERSION: string;
|
||||||
|
didUserProvideWranglerVersion: boolean;
|
||||||
|
secrets: string[];
|
||||||
|
workingDirectory: string;
|
||||||
|
CLOUDFLARE_API_TOKEN: string;
|
||||||
|
CLOUDFLARE_ACCOUNT_ID: string;
|
||||||
|
ENVIRONMENT: string;
|
||||||
|
VARS: string[];
|
||||||
|
COMMANDS: string[];
|
||||||
|
QUIET_MODE: boolean;
|
||||||
|
PACKAGE_MANAGER: string;
|
||||||
|
WRANGLER_OUTPUT_DIR: string;
|
||||||
|
GITHUB_TOKEN: string;
|
||||||
|
}, {
|
||||||
|
WRANGLER_VERSION: string;
|
||||||
|
didUserProvideWranglerVersion: boolean;
|
||||||
|
secrets: string[];
|
||||||
|
workingDirectory: string;
|
||||||
|
CLOUDFLARE_API_TOKEN: string;
|
||||||
|
CLOUDFLARE_ACCOUNT_ID: string;
|
||||||
|
ENVIRONMENT: string;
|
||||||
|
VARS: string[];
|
||||||
|
COMMANDS: string[];
|
||||||
|
QUIET_MODE: boolean;
|
||||||
|
PACKAGE_MANAGER: string;
|
||||||
|
WRANGLER_OUTPUT_DIR: string;
|
||||||
|
GITHUB_TOKEN: string;
|
||||||
|
}>;
|
||||||
|
declare function main(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
|
||||||
|
declare function installWrangler(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
|
||||||
|
declare function authenticationSetup(config: WranglerActionConfig): void;
|
||||||
|
declare function execCommands(config: WranglerActionConfig, packageManager: PackageManager, commands: string[], cmdType: string): Promise<void>;
|
||||||
|
declare function uploadSecrets(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
|
||||||
|
declare function wranglerCommands(config: WranglerActionConfig, packageManager: PackageManager): Promise<void>;
|
||||||
|
export { authenticationSetup, execCommands, info, installWrangler, main, uploadSecrets, wranglerCommands, };
|
1
dist/wranglerAction.test.d.ts
vendored
Normal file
1
dist/wranglerAction.test.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
103
dist/wranglerArtifactManager.d.ts
vendored
Normal file
103
dist/wranglerArtifactManager.d.ts
vendored
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
import { z } from "zod";
|
||||||
|
declare const OutputEntryPagesDeployment: z.ZodObject<z.objectUtil.extendShape<{
|
||||||
|
version: z.ZodLiteral<1>;
|
||||||
|
type: z.ZodString;
|
||||||
|
}, {
|
||||||
|
type: z.ZodLiteral<"pages-deploy-detailed">;
|
||||||
|
pages_project: z.ZodNullable<z.ZodString>;
|
||||||
|
deployment_id: z.ZodNullable<z.ZodString>;
|
||||||
|
url: z.ZodOptional<z.ZodString>;
|
||||||
|
alias: z.ZodOptional<z.ZodString>;
|
||||||
|
environment: z.ZodEnum<["production", "preview"]>;
|
||||||
|
production_branch: z.ZodOptional<z.ZodString>;
|
||||||
|
stages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||||
|
name: z.ZodEnum<["queued", "initialize", "clone_repo", "build", "deploy"]>;
|
||||||
|
status: z.ZodEnum<["idle", "active", "canceled", "success", "failure", "skipped"]>;
|
||||||
|
started_on: z.ZodNullable<z.ZodString>;
|
||||||
|
ended_on: z.ZodNullable<z.ZodString>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
status: "idle" | "active" | "canceled" | "success" | "failure" | "skipped";
|
||||||
|
name: "deploy" | "queued" | "initialize" | "clone_repo" | "build";
|
||||||
|
started_on: string | null;
|
||||||
|
ended_on: string | null;
|
||||||
|
}, {
|
||||||
|
status: "idle" | "active" | "canceled" | "success" | "failure" | "skipped";
|
||||||
|
name: "deploy" | "queued" | "initialize" | "clone_repo" | "build";
|
||||||
|
started_on: string | null;
|
||||||
|
ended_on: string | null;
|
||||||
|
}>, "many">>;
|
||||||
|
deployment_trigger: z.ZodOptional<z.ZodObject<{
|
||||||
|
metadata: z.ZodObject<{
|
||||||
|
/** Commit hash of the deployment trigger metadata for the pages project */
|
||||||
|
commit_hash: z.ZodString;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
commit_hash: string;
|
||||||
|
}, {
|
||||||
|
commit_hash: string;
|
||||||
|
}>;
|
||||||
|
}, "strip", z.ZodTypeAny, {
|
||||||
|
metadata: {
|
||||||
|
commit_hash: string;
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
metadata: {
|
||||||
|
commit_hash: string;
|
||||||
|
};
|
||||||
|
}>>;
|
||||||
|
}>, "strip", z.ZodTypeAny, {
|
||||||
|
type: "pages-deploy-detailed";
|
||||||
|
environment: "production" | "preview";
|
||||||
|
version: 1;
|
||||||
|
pages_project: string | null;
|
||||||
|
deployment_id: string | null;
|
||||||
|
url?: string | undefined;
|
||||||
|
alias?: string | undefined;
|
||||||
|
production_branch?: string | undefined;
|
||||||
|
stages?: {
|
||||||
|
status: "idle" | "active" | "canceled" | "success" | "failure" | "skipped";
|
||||||
|
name: "deploy" | "queued" | "initialize" | "clone_repo" | "build";
|
||||||
|
started_on: string | null;
|
||||||
|
ended_on: string | null;
|
||||||
|
}[] | undefined;
|
||||||
|
deployment_trigger?: {
|
||||||
|
metadata: {
|
||||||
|
commit_hash: string;
|
||||||
|
};
|
||||||
|
} | undefined;
|
||||||
|
}, {
|
||||||
|
type: "pages-deploy-detailed";
|
||||||
|
environment: "production" | "preview";
|
||||||
|
version: 1;
|
||||||
|
pages_project: string | null;
|
||||||
|
deployment_id: string | null;
|
||||||
|
url?: string | undefined;
|
||||||
|
alias?: string | undefined;
|
||||||
|
production_branch?: string | undefined;
|
||||||
|
stages?: {
|
||||||
|
status: "idle" | "active" | "canceled" | "success" | "failure" | "skipped";
|
||||||
|
name: "deploy" | "queued" | "initialize" | "clone_repo" | "build";
|
||||||
|
started_on: string | null;
|
||||||
|
ended_on: string | null;
|
||||||
|
}[] | undefined;
|
||||||
|
deployment_trigger?: {
|
||||||
|
metadata: {
|
||||||
|
commit_hash: string;
|
||||||
|
};
|
||||||
|
} | undefined;
|
||||||
|
}>;
|
||||||
|
export type OutputEntryPagesDeployment = z.infer<typeof OutputEntryPagesDeployment>;
|
||||||
|
/**
|
||||||
|
* Parses file names in a directory to find wrangler artifact files
|
||||||
|
*
|
||||||
|
* @param artifactDirectory
|
||||||
|
* @returns All artifact files from the directory
|
||||||
|
*/
|
||||||
|
export declare function getWranglerArtifacts(artifactDirectory: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Searches for detailed wrangler output from a pages deploy
|
||||||
|
*
|
||||||
|
* @param artifactDirectory
|
||||||
|
* @returns The first pages-output-detailed found within a wrangler artifact directory
|
||||||
|
*/
|
||||||
|
export declare function getDetailedPagesDeployOutput(artifactDirectory: string): Promise<OutputEntryPagesDeployment | null>;
|
||||||
|
export {};
|
1
dist/wranglerArtifactManager.test.d.ts
vendored
Normal file
1
dist/wranglerArtifactManager.test.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
Loading…
Reference in a new issue