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:
parent
2c5e873da0
commit
20d377c11b
|
@ -11,7 +11,11 @@ import {exec} from 'shelljs';
|
||||||
|
|
||||||
/** The common configuration for ng-dev. */
|
/** The common configuration for ng-dev. */
|
||||||
type CommonConfig = {
|
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. */
|
/** Validate the common configuration has been met for the ng-dev command. */
|
||||||
function validateCommonConfig(config: NgDevConfig<CommonConfig>) {
|
function validateCommonConfig(config: Partial<NgDevConfig>) {
|
||||||
// TODO: add validation for the common configuration
|
const errors: string[] = [];
|
||||||
return config;
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue