/** * This file was copied from @vercel/vercel/packages/cli/src/util/projects/link.ts * and adapted to work without importing most of the vercel CLI code. * * It strips: * - Network requests for validating whether the org/user/team/project exists * - Some vercel-specific environment variable checks and inference * that we're not supporting for Workflow CLI for now */ interface RepoProjectConfig { id: string; name: string; directory: string; /** Per-project orgId, added in vercel/vercel#14967. Prefer this over root-level orgId. */ orgId?: string; } interface RepoProjectsConfig { /** Legacy root-level orgId: older Vercel CLI versions put orgId here. */ orgId?: string; remoteName: string; projects: RepoProjectConfig[]; } interface RepoLink { rootPath: string; repoConfigPath: string; repoConfig?: RepoProjectsConfig; } export interface ProjectLink { /** * ID of the Vercel Project. */ projectId: string; /** * User or Team ID of the owner of the Vercel Project. */ orgId: string; /** * When linked as a repository, contains the absolute path * to the root directory of the repository. */ repoRoot?: string; /** * When linked as a repository, contains the relative path * to the selected project root directory. */ projectRootDirectory?: string; /** * Name of the Vercel Project. */ projectName?: string; } export declare const VERCEL_DIR = ".vercel"; export declare const VERCEL_DIR_FALLBACK = ".now"; export declare const VERCEL_DIR_PROJECT = "project.json"; export declare const VERCEL_DIR_REPO = "repo.json"; /** * A type guard for `try...catch` errors. * @deprecated use `require('node:util').types.isNativeError(error)` instead */ export declare const isError: (error: unknown) => error is Error; export declare const isErrnoException: (error: unknown) => error is NodeJS.ErrnoException; export declare const isOneOfErrNoExceptions: (error: unknown, codes: string[]) => boolean | "" | undefined; /** * Returns the `/.vercel` directory for the current project * with a fallback to /.now` if it exists. * * Throws an error if *both* `.vercel` and `.now` directories exist. */ export declare function getVercelDirectory(cwd: string): string; export declare function getProjectLink(path: string): Promise; /** * Convert Windows separators to Unix separators. */ export declare function normalizeOsPath(p: string): string; /** * Finds the matching Projects from an array of Project links * where the provided relative path is within the Project's * root directory. */ export declare function findProjectsFromPath(projects: RepoProjectConfig[], path: string): RepoProjectConfig[]; export declare function getLinkFromDir(vercelDir: string): Promise; export declare function traverseUpDirectories({ start, base, maxDepth, }: { start: string; base?: string; maxDepth?: number; }): Generator; /** * Given a `start` directory, traverses up the directory hierarchy until * the nearest `.git/config` file is found. Returns the directory where * the Git config was found, or `undefined` when no Git repo was found. */ export declare function findRepoRoot(cwd: string, start: string): Promise; export declare function isGitWorktreeOrSubmodule(cwd: string): boolean; /** * Given a directory path `cwd`, finds the root of the Git repository * and returns the parsed `.vercel/repo.json` file if the repository * has already been linked. */ export declare function getRepoLink(cwd: string): Promise; export {}; //# sourceMappingURL=vercel-link.d.ts.map