()
| 81 | } |
| 82 | |
| 83 | function globalFilePath(): string | null { |
| 84 | const home = os.homedir(); |
| 85 | if (!home) { |
| 86 | return null; |
| 87 | } |
| 88 | |
| 89 | // follow XDG Base Directory spec |
| 90 | // note that createGlobalSettings() will continue creating |
| 91 | // global file in home directory, with this user will have |
| 92 | // choice to move change its location to meet XDG convention |
| 93 | const xdgConfig = xdgConfigHome(home, 'config.json'); |
| 94 | if (existsSync(xdgConfig)) { |
| 95 | return xdgConfig; |
| 96 | } |
| 97 | // NOTE: This check is for the old configuration location, for more |
| 98 | // information see https://github.com/angular/angular-cli/pull/20556 |
| 99 | const xdgConfigOld = xdgConfigHomeOld(home); |
| 100 | if (existsSync(xdgConfigOld)) { |
| 101 | /* eslint-disable no-console */ |
| 102 | console.warn( |
| 103 | `Old configuration location detected: ${xdgConfigOld}\n` + |
| 104 | `Please move the file to the new location ~/.config/angular/config.json`, |
| 105 | ); |
| 106 | |
| 107 | return xdgConfigOld; |
| 108 | } |
| 109 | |
| 110 | if (existsSync(defaultGlobalFilePath)) { |
| 111 | return defaultGlobalFilePath; |
| 112 | } |
| 113 | |
| 114 | return null; |
| 115 | } |
| 116 | |
| 117 | export class AngularWorkspace { |
| 118 | readonly basePath: string; |
no test coverage detected