File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
packages/@angular/cli/utilities Expand file tree Collapse file tree 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';
22import * as os from 'os' ;
33import * as path from 'path' ;
44import { findUp } from './find-up' ;
5+ import { normalize } from '@angular-devkit/core' ;
56
67export function insideProject ( ) : boolean {
7- const possibleConfigFiles = [ 'angular.json' , '.angular.json' ] ;
8-
9- return findUp ( possibleConfigFiles , process . cwd ( ) ) !== null ;
8+ return getProjectDetails ( ) !== null ;
109}
1110
1211export interface ProjectDetails {
@@ -31,7 +30,7 @@ export function getProjectDetails(): ProjectDetails | null {
3130 const possibleDir = path . dirname ( configFilePath ) ;
3231
3332 const homedir = os . homedir ( ) ;
34- if ( possibleDir === homedir ) {
33+ if ( normalize ( possibleDir ) === normalize ( homedir ) ) {
3534 const packageJsonPath = path . join ( possibleDir , 'package.json' ) ;
3635 if ( ! fs . existsSync ( packageJsonPath ) ) {
3736 // 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