Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Angular Configuration Check #12250

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/angular/cli/lib/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { logging, terminal } from '@angular-devkit/core';
import { filter } from 'rxjs/operators';
import { runCommand } from '../../models/command-runner';
import { getWorkspaceRaw } from '../../utilities/config';
import { getWorkspaceDetails } from '../../utilities/project';


Expand All @@ -21,6 +22,14 @@ export default async function(options: { testing?: boolean, cliArgs: string[] })

let projectDetails = getWorkspaceDetails();
if (projectDetails === null) {
const [, localPath] = getWorkspaceRaw('local');
if (localPath !== null) {
logger.fatal(`An invalid configuration file was found ['${localPath}'].`
+ ' Please delete the file before running the command.');

return 1;
}

projectDetails = { root: process.cwd() };
}

Expand Down
4 changes: 2 additions & 2 deletions packages/angular/cli/models/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ export abstract class Command<T extends BaseCommandOptions = BaseCommandOptions>
async validateScope(): Promise<void> {
switch (this.description.scope) {
case CommandScope.OutProject:
if (this.workspace.configFile || getWorkspace('local') !== null) {
if (this.workspace.configFile) {
this.logger.fatal(tags.oneLine`
The ${this.description.name} command requires to be run outside of a project, but a
project definition was found at "${this.workspace.root}".
project definition was found at "${this.workspace.configFile}".
`);
throw 1;
}
Expand Down