Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
throw err;
}
}
// no builds -> zero config
if (!config.builds || config.builds.length === 0) {
const allFiles = await getAllProjectFiles(this.cwd, this.output);
const files = allFiles.filter(this.filter);
this.output.debug(
`Found ${allFiles.length} and ` +
`filtered out ${allFiles.length - files.length} files`
);
const { builders, errors } = await detectBuilders(files, pkg);
if (errors) {
this.output.error(errors[0].message);
await this.exit();
}
if (builders) {
const { defaultRoutes, error: routesError } = await detectRoutes(
files,
builders
);
config.builds = config.builds || [];
config.builds.push(...builders);
if (routesError) {
} else {
throw err;
}
}
// no builds -> zero config
if (!config.builds || config.builds.length === 0) {
const allFiles = await getAllProjectFiles(this.cwd, this.output);
const files = allFiles.filter(this.filter);
this.output.debug(
`Found ${allFiles.length} and ` +
`filtered out ${allFiles.length - files.length} files`
);
const { builders, warnings, errors } = await detectBuilders(files, pkg, {
tag: getDistTag(cliVersion) === 'canary' ? 'canary' : 'latest',
});
if (errors) {
this.output.error(errors[0].message);
await this.exit();
}
if (warnings && warnings.length > 0) {
warnings.forEach(warning => this.output.warn(warning.message));
}
if (builders) {
const { defaultRoutes, error: routesError } = await detectRoutes(
files,
builders
await this.validateNowConfig(config);
const { error: routeError, routes: maybeRoutes } = getTransformedRoutes({
nowConfig: config,
});
if (routeError) {
this.output.error(routeError.message);
await this.exit();
}
config.routes = maybeRoutes || [];
// no builds -> zero config
if (!config.builds || config.builds.length === 0) {
const { projectSettings } = config;
const { builders, warnings, errors } = await detectBuilders(files, pkg, {
tag: getDistTag(cliVersion) === 'canary' ? 'canary' : 'latest',
functions: config.functions,
...(projectSettings ? { projectSettings } : {}),
});
if (errors) {
this.output.error(errors[0].message);
await this.exit();
}
if (warnings && warnings.length > 0) {
warnings.forEach(warning => this.output.warn(warning.message));
}
if (builders) {
const { defaultRoutes, error: routesError } = await detectRoutes(