mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 07:21:16 +08:00
chore(app/angular): add additional log outputs
this should help improving the error reporting when a user has trouble using app/angular
This commit is contained in:
parent
93ccb846f1
commit
7980eb656c
@ -50,6 +50,7 @@ export function getAngularCliConfig(dirToSearch: string) {
|
||||
const fname = path.join(dirToSearch, 'angular.json');
|
||||
|
||||
if (!fs.existsSync(fname)) {
|
||||
logger.error(`Could not find angular.json using ${fname}`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@ -67,9 +68,26 @@ export function getLeadingAngularCliProject(ngCliConfig: any) {
|
||||
throw new Error('angular.json must have projects entry.');
|
||||
}
|
||||
|
||||
const fallbackProject = defaultProject && projects[defaultProject];
|
||||
const firstProject = projects[Object.keys(projects)[0]];
|
||||
return projects.storybook || fallbackProject || firstProject;
|
||||
let projectName;
|
||||
const firstProjectName = Object.keys(projects)[0];
|
||||
if (projects.storybook) {
|
||||
projectName = 'storybook';
|
||||
} else if (defaultProject && projects[defaultProject]) {
|
||||
projectName = defaultProject;
|
||||
} else if (projects[firstProjectName]) {
|
||||
projectName = firstProjectName;
|
||||
}
|
||||
|
||||
const project = projects[projectName];
|
||||
if (!project) {
|
||||
logger.error(`Could not find angular project '${projectName}' in angular.json.`);
|
||||
} else {
|
||||
logger.info(`=> Using angular project '${projectName}' for configuring Storybook.`);
|
||||
}
|
||||
if (!project.architect.build) {
|
||||
logger.error(`architect.build is not defined for project '${projectName}'.`);
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
export function getAngularCliWebpackConfigOptions(dirToSearch: Path) {
|
||||
@ -102,7 +120,7 @@ export function getAngularCliWebpackConfigOptions(dirToSearch: Path) {
|
||||
optimization: {},
|
||||
...projectOptions,
|
||||
assets: normalizedAssets,
|
||||
budgets
|
||||
budgets,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user