File tree 2 files changed +18
-4
lines changed
packages/@angular/cli/utilities 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,10 @@ import * as fs from 'fs';
2
2
import * as os from 'os' ;
3
3
import * as path from 'path' ;
4
4
import { findUp } from './find-up' ;
5
+ import { normalize } from '@angular-devkit/core' ;
5
6
6
7
export function insideProject ( ) : boolean {
7
- const possibleConfigFiles = [ 'angular.json' , '.angular.json' ] ;
8
-
9
- return findUp ( possibleConfigFiles , process . cwd ( ) ) !== null ;
8
+ return getProjectDetails ( ) !== null ;
10
9
}
11
10
12
11
export interface ProjectDetails {
@@ -31,7 +30,7 @@ export function getProjectDetails(): ProjectDetails | null {
31
30
const possibleDir = path . dirname ( configFilePath ) ;
32
31
33
32
const homedir = os . homedir ( ) ;
34
- if ( possibleDir === homedir ) {
33
+ if ( normalize ( possibleDir ) === normalize ( homedir ) ) {
35
34
const packageJsonPath = path . join ( possibleDir , 'package.json' ) ;
36
35
if ( ! fs . existsSync ( packageJsonPath ) ) {
37
36
// No package.json
Original file line number Diff line number Diff line change
1
+ import { writeFile , deleteFile } from '../../utils/fs' ;
2
+ import { ng } from '../../utils/process' ;
3
+ import * as os from 'os' ;
4
+ import { join } from 'path' ;
5
+
6
+
7
+ export default function ( ) {
8
+ const homedir = os . homedir ( ) ;
9
+ const globalConfigPath = join ( homedir , '.angular.json' ) ;
10
+ return Promise . resolve ( )
11
+ . then ( ( ) => writeFile ( globalConfigPath , '{"version":1}' ) )
12
+ . then ( ( ) => process . chdir ( homedir ) )
13
+ . then ( ( ) => ng ( 'new' , 'proj-name' , '--dry-run' ) )
14
+ . then ( ( ) => deleteFile ( globalConfigPath ) ) ;
15
+ }
You can’t perform that action at this time.
0 commit comments