feat(dev-infra): add github to common config for ng-dev configuration typings (#37097)

Adds a gitub object to the common configuration for ng-dev. This github
configuration provides information needed for making API requests to
github.

PR Close #37097
This commit is contained in:
Joey Perrott 2020-05-12 15:26:03 -07:00 committed by Kara Erickson
parent 2c5e873da0
commit 20d377c11b
1 changed files with 20 additions and 4 deletions

View File

@ -11,7 +11,11 @@ import {exec} from 'shelljs';
/** The common configuration for ng-dev. */
type CommonConfig = {
// TODO: add common configuration
// Github repository configuration used for API Requests, determining upstream remote, etc.
github: {
owner: string;
name: string;
}
};
/**
@ -46,9 +50,21 @@ export function getConfig(): NgDevConfig {
}
/** Validate the common configuration has been met for the ng-dev command. */
function validateCommonConfig(config: NgDevConfig<CommonConfig>) {
// TODO: add validation for the common configuration
return config;
function validateCommonConfig(config: Partial<NgDevConfig>) {
const errors: string[] = [];
// Validate the github configuration.
if (config.github === undefined) {
errors.push(`Github repository not configured. Set the "github" option.`);
} else {
if (config.github.name === undefined) {
errors.push(`"github.name" is not defined`);
}
if (config.github.owner === undefined) {
errors.push(`"github.owner" is not defined`);
}
}
return config as NgDevConfig;
}
/**