export declare const git: (cwd: string, ...args: string[]) => string; /** The repository root, however deep in it the command was run. GitHub only reads workflows from here. */ export declare const repoRoot: (cwd: string) => string; /** owner/name from the origin remote, or the first GitHub remote. Handles ssh, https, .git and trailing slashes. */ export declare function detectRepo(root: string): string | undefined; export interface Pkg { /** Relative to the repo root, posix separators. '' is the root. */ dir: string; name: string; scripts: Record; deps: Set; esm: boolean; workspaces: boolean; main?: string; } /** Every package.json in the repo down to `maxDepth` folders, whatever the folders are called. */ export declare function findPackages(root: string, maxDepth?: number): Pkg[]; export declare const isNext: (p: Pkg) => boolean; export declare const isFrontend: (p: Pkg) => boolean; export declare const isBackend: (p: Pkg) => boolean; export declare const backendFramework: (p: Pkg) => string | undefined; export interface Layout { frontend?: Pkg; backend?: Pkg; /** Where the report endpoint goes. */ handler: 'next' | 'express' | 'other' | 'none'; /** The package that gets the dependency and the endpoint. */ handlerPkg?: Pkg; /** Other packages that could equally be the backend, so the user can be asked. */ alternatives: Pkg[]; } /** * Works out which package is the frontend and which the backend, by what they depend on and not by what they are named. * A Next.js frontend hosts its own endpoint (same origin, no CORS). Otherwise the endpoint goes in the backend. */ export declare function pickLayout(packages: Pkg[], flags?: { backend?: string; frontend?: string; }): Layout; export declare const usesTypeScript: (root: string, pkg: Pkg) => boolean; /** TypeScript's node16/nodenext resolution needs a `.js` on relative imports; other modes don't want one. */ export declare const needsJsExtension: (root: string, pkg: Pkg) => boolean; export interface Entry { /** Relative to the repo root. */ file: string; appVar: string; /** Zero-based line of the `const app = express()` statement. */ line: number; } /** The file that creates the Express app: from the start/dev scripts and `main` first, then a scan of the source folder. */ export declare function findExpressEntry(root: string, pkg: Pkg): Entry | undefined; /** The port the backend listens on, for pointing a separate frontend at it. */ export declare function detectPort(root: string, pkg: Pkg, entry?: Entry): number; /** True when the frontend's dev server already forwards /api to the backend, so a relative endpoint works. */ export declare function frontendProxiesApi(root: string, pkg: Pkg): boolean; export declare function findHtmlEntry(root: string, pkg: Pkg): string | undefined; export declare function findNext(root: string, pkg: Pkg): { kind: 'app' | 'pages'; dir: string; layout?: string; } | undefined; export type PackageManager = 'npm' | 'pnpm' | 'yarn'; /** The package manager for a package: its own lockfile first, then the repo root's. */ export declare function detectPm(root: string, pkg: Pkg): { pm: PackageManager; locked: boolean; }; /** The Node major a project targets: .nvmrc, .node-version, then engines.node. Undefined when it says nothing usable. */ export declare function detectNodeMajor(root: string, packages: Pkg[]): number | undefined; /** * The commands the fix engine runs in a fresh clone, split so tests can run offline: `install` needs network and runs * first, `test` and `build` then need none. In a monorepo with workspaces they are the root's own scripts. Otherwise they * are the install, tests and build of each package that has them, each run from its own folder. */ export declare function buildCommands(root: string, packages: Pkg[], chosen: Pkg[]): { install: string; test: string; build: string; hasTests: boolean; nodeMajor?: number; }; //# sourceMappingURL=detect.d.ts.map