Skip to content

Commit 2b6bfe7

Browse files
ValeryVSfilipesilva
authored andcommitted
fix: check for old version of the CLI on empty project
Fix #2135 Close #2178
1 parent 8a5b265 commit 2b6bfe7

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: packages/angular-cli/upgrade/version.ts

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ export class Version {
7676

7777

7878
const configPath = CliConfig.configFilePath();
79+
80+
if (configPath === null) {
81+
return new Version(null);
82+
}
83+
7984
const configJson = readFileSync(configPath, 'utf8');
8085

8186
try {

Diff for: tests/e2e/tests/misc/version.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {deleteFile} from '../../utils/fs';
2+
import {ng} from '../../utils/process';
3+
4+
5+
export default function() {
6+
return ng('version')
7+
.then(() => deleteFile('angular-cli.json'))
8+
// doesn't fail on a project with missing angular-cli.json
9+
.then(() => ng('version'));
10+
}

0 commit comments

Comments
 (0)