|
1 | 1 | import * as memoize from 'memoizee';
|
2 | 2 | import * as path from 'path';
|
3 |
| -import * as childProcess from 'child_process'; |
4 | 3 | import { CompletionItem, CompletionItemKind } from 'vscode-languageserver/node';
|
5 | 4 | import { addToRegistry, normalizeMatchNaming } from './registry-api';
|
6 | 5 | import { clean, coerce, valid } from 'semver';
|
@@ -120,26 +119,10 @@ export function getPodModulePrefix(root: string): string | null {
|
120 | 119 | return podModulePrefix.trim().length > 0 ? podModulePrefix : null;
|
121 | 120 | }
|
122 | 121 |
|
123 |
| -function getRoot(fromDir: string) { |
124 |
| - try { |
125 |
| - const topLevel = childProcess.execSync('git rev-parse --show-toplevel', { encoding: 'utf8', cwd: fromDir }); |
126 |
| - |
127 |
| - return topLevel.trim(); |
128 |
| - } catch { |
129 |
| - // we ignore the error, because we might not be in a git repo |
130 |
| - return '/'; |
131 |
| - } |
132 |
| -} |
133 |
| - |
134 | 122 | export async function resolvePackageRoot(root: string, addonName: string, packagesFolder = 'node_modules'): Promise<string | false> {
|
135 | 123 | const roots = root.split(path.sep);
|
136 |
| - const stopAt = getRoot(root); |
137 | 124 |
|
138 | 125 | while (roots.length) {
|
139 |
| - if (roots.join(path.sep) === stopAt) { |
140 |
| - return false; |
141 |
| - } |
142 |
| - |
143 | 126 | const prefix = roots.join(path.sep);
|
144 | 127 | const maybePath = path.join(prefix, packagesFolder, addonName);
|
145 | 128 | const linkedPath = path.join(prefix, addonName);
|
|
0 commit comments