mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[build-utils] Make repoRootPath non-optional (#7909)
This value is always set in the Vercel build infra, so mark the type as non-optional.
This commit is contained in:
@@ -82,7 +82,7 @@ export interface BuildOptions {
|
|||||||
* is the Git Repository Root. This is only relevant for Monorepos.
|
* is the Git Repository Root. This is only relevant for Monorepos.
|
||||||
* See https://vercel.com/blog/monorepos
|
* See https://vercel.com/blog/monorepos
|
||||||
*/
|
*/
|
||||||
repoRootPath?: string;
|
repoRootPath: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An arbitrary object passed by the user in the build definition defined
|
* An arbitrary object passed by the user in the build definition defined
|
||||||
@@ -123,7 +123,7 @@ export interface PrepareCacheOptions {
|
|||||||
* is the Git Repository Root. This is only relevant for Monorepos.
|
* is the Git Repository Root. This is only relevant for Monorepos.
|
||||||
* See https://vercel.com/blog/monorepos
|
* See https://vercel.com/blog/monorepos
|
||||||
*/
|
*/
|
||||||
repoRootPath?: string;
|
repoRootPath: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An arbitrary object passed by the user in the build definition defined
|
* An arbitrary object passed by the user in the build definition defined
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ export default async function main(client: Client): Promise<number> {
|
|||||||
// TODO: parallelize builds
|
// TODO: parallelize builds
|
||||||
const buildResults: Map<Builder, BuildResult> = new Map();
|
const buildResults: Map<Builder, BuildResult> = new Map();
|
||||||
const overrides: PathOverride[] = [];
|
const overrides: PathOverride[] = [];
|
||||||
const repoRootPath = cwd === workPath ? undefined : cwd;
|
const repoRootPath = cwd;
|
||||||
const rootPackageJsonPath = repoRootPath || workPath;
|
const rootPackageJsonPath = repoRootPath || workPath;
|
||||||
const corepackShimDir = await initCorepack({ cwd, rootPackageJsonPath });
|
const corepackShimDir = await initCorepack({ cwd, rootPackageJsonPath });
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ export async function executeBuild(
|
|||||||
files,
|
files,
|
||||||
entrypoint,
|
entrypoint,
|
||||||
workPath,
|
workPath,
|
||||||
|
repoRootPath: workPath,
|
||||||
config,
|
config,
|
||||||
meta: {
|
meta: {
|
||||||
isDev: true,
|
isDev: true,
|
||||||
|
|||||||
@@ -1735,6 +1735,7 @@ export default class DevServer {
|
|||||||
entrypoint: match.entrypoint,
|
entrypoint: match.entrypoint,
|
||||||
workPath,
|
workPath,
|
||||||
config: match.config || {},
|
config: match.config || {},
|
||||||
|
repoRootPath: this.cwd,
|
||||||
meta: {
|
meta: {
|
||||||
isDev: true,
|
isDev: true,
|
||||||
requestPath,
|
requestPath,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export async function downloadFilesInWorkPath({
|
|||||||
workPath,
|
workPath,
|
||||||
files,
|
files,
|
||||||
meta = {},
|
meta = {},
|
||||||
}: BuildOptions) {
|
}: Pick<BuildOptions, 'entrypoint' | 'workPath' | 'files' | 'meta'>) {
|
||||||
debug('Downloading user files...');
|
debug('Downloading user files...');
|
||||||
let downloadedFiles = await download(files, workPath, meta);
|
let downloadedFiles = await download(files, workPath, meta);
|
||||||
if (meta.isDev) {
|
if (meta.isDev) {
|
||||||
@@ -67,7 +67,6 @@ export const build = async ({
|
|||||||
files: originalFiles,
|
files: originalFiles,
|
||||||
entrypoint,
|
entrypoint,
|
||||||
meta,
|
meta,
|
||||||
config,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
2
packages/remix/test/build.test.ts
vendored
2
packages/remix/test/build.test.ts
vendored
@@ -20,6 +20,7 @@ describe('build()', () => {
|
|||||||
files: {},
|
files: {},
|
||||||
entrypoint: 'package.json',
|
entrypoint: 'package.json',
|
||||||
workPath,
|
workPath,
|
||||||
|
repoRootPath: workPath,
|
||||||
config: {},
|
config: {},
|
||||||
});
|
});
|
||||||
assert('output' in result);
|
assert('output' in result);
|
||||||
@@ -36,6 +37,7 @@ describe('build()', () => {
|
|||||||
files: {},
|
files: {},
|
||||||
entrypoint: 'package.json',
|
entrypoint: 'package.json',
|
||||||
workPath,
|
workPath,
|
||||||
|
repoRootPath: workPath,
|
||||||
config: {},
|
config: {},
|
||||||
});
|
});
|
||||||
const cacheNames = Object.keys(cache);
|
const cacheNames = Object.keys(cache);
|
||||||
|
|||||||
Reference in New Issue
Block a user