diff --git a/src/args.ts b/src/args.ts index 90b40a0..ce5d388 100644 --- a/src/args.ts +++ b/src/args.ts @@ -13,7 +13,6 @@ export function parseArgs(args: string[]) { "help", "prod", "last", - "static", "version", "dry-run", "save-config", @@ -59,7 +58,6 @@ export function parseArgs(args: string[]) { "env-file", ], default: { - static: true, config: Deno.env.get("DEPLOYCTL_CONFIG_FILE"), token: Deno.env.get("DENO_DEPLOY_TOKEN"), org: Deno.env.get("DEPLOYCTL_ORGANIZATION"), diff --git a/src/subcommands/deploy.ts b/src/subcommands/deploy.ts index a6e02c4..cac72f3 100644 --- a/src/subcommands/deploy.ts +++ b/src/subcommands/deploy.ts @@ -7,7 +7,6 @@ import { wait } from "../utils/spinner.ts"; import configFile from "../config_file.ts"; import { error } from "../error.ts"; import { API, APIError, endpoint } from "../utils/api.ts"; -import type { ManifestEntry } from "../utils/api_types.ts"; import { parseEntrypoint } from "../utils/entrypoint.ts"; import { convertPatternToRegExp, walk } from "../utils/walk.ts"; import TokenProvisioner from "../utils/access_token.ts"; @@ -88,7 +87,6 @@ OPTIONS: export interface Args { help: boolean; - static: boolean; prod: boolean; exclude: string[]; include: string[]; @@ -108,7 +106,6 @@ export default async function (rawArgs: RawArgs): Promise { : null; const args: Args = { help: !!rawArgs.help, - static: !!rawArgs.static, prod: !!rawArgs.prod, token: rawArgs.token ? String(rawArgs.token) : null, project: rawArgs.project ? String(rawArgs.project) : null, @@ -150,7 +147,6 @@ export default async function (rawArgs: RawArgs): Promise { ? null : await parseEntrypoint(args.importMap, undefined, "import map") .catch((e) => error(e)), - static: args.static, prod: args.prod, token: args.token, project: args.project, @@ -169,7 +165,6 @@ export default async function (rawArgs: RawArgs): Promise { interface DeployOpts { entrypoint: string; importMapUrl: URL | null; - static: boolean; prod: boolean; exclude: string[]; include: string[]; @@ -267,45 +262,40 @@ async function deploy(opts: DeployOpts): Promise { } let uploadSpinner: Spinner | null = null; - const files = []; - let manifest: { entries: Record } | undefined = - undefined; - - if (opts.static) { - wait("").start().info(`Uploading all files from the current dir (${cwd})`); - const assetSpinner = wait("Finding static assets...").start(); - const assets = new Map(); - const include = opts.include.map(convertPatternToRegExp); - const exclude = opts.exclude.map(convertPatternToRegExp); - const entries = await walk(cwd, cwd, assets, { include, exclude }); - assetSpinner.succeed( - `Found ${assets.size} asset${assets.size === 1 ? "" : "s"}.`, - ); - - uploadSpinner = wait("Determining assets to upload...").start(); - const neededHashes = await api.projectNegotiateAssets(project.id, { - entries, - }); + wait("").start().info(`Uploading all files from the current dir (${cwd})`); + const assetSpinner = wait("Finding static assets...").start(); + const assets = new Map(); + const include = opts.include.map(convertPatternToRegExp); + const exclude = opts.exclude.map(convertPatternToRegExp); + const entries = await walk(cwd, cwd, assets, { include, exclude }); + assetSpinner.succeed( + `Found ${assets.size} asset${assets.size === 1 ? "" : "s"}.`, + ); + + uploadSpinner = wait("Determining assets to upload...").start(); + const neededHashes = await api.projectNegotiateAssets(project.id, { + entries, + }); - for (const hash of neededHashes) { - const path = assets.get(hash); - if (path === undefined) { - error(`Asset ${hash} not found.`); - } - const data = await Deno.readFile(path); - files.push(data); - } - if (files.length === 0) { - uploadSpinner.succeed("No new assets to upload."); - uploadSpinner = null; - } else { - uploadSpinner.text = `${files.length} new asset${ - files.length === 1 ? "" : "s" - } to upload.`; + const files = []; + for (const hash of neededHashes) { + const path = assets.get(hash); + if (path === undefined) { + error(`Asset ${hash} not found.`); } - - manifest = { entries }; + const data = await Deno.readFile(path); + files.push(data); } + if (files.length === 0) { + uploadSpinner.succeed("No new assets to upload."); + uploadSpinner = null; + } else { + uploadSpinner.text = `${files.length} new asset${ + files.length === 1 ? "" : "s" + } to upload.`; + } + + const manifest = { entries }; if (opts.dryRun) { uploadSpinner?.succeed(uploadSpinner?.text);