MCPcopy Index your code
hub / github.com/angular/angular-cli / globalFilePath

Function globalFilePath

packages/angular/cli/src/utilities/config.ts:83–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81}
82
83function 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
117export class AngularWorkspace {
118 readonly basePath: string;

Callers 2

getWorkspaceFunction · 0.85
getWorkspaceRawFunction · 0.85

Calls 4

xdgConfigHomeFunction · 0.85
existsSyncFunction · 0.85
xdgConfigHomeOldFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected