@react-native-windows/find-repo-root
Advanced tools
Comparing version 0.0.0-canary.28 to 0.0.0-canary.29
@@ -8,6 +8,13 @@ /** | ||
*/ | ||
declare const _default: () => Promise<string>; | ||
/** | ||
* Find the root directory of a repo upward from cwd | ||
*/ | ||
export default _default; | ||
declare function findRepoRoot(): Promise<string>; | ||
/** | ||
* Synchronously finds the root directory of a repo upward from cwd | ||
*/ | ||
declare function findRepoRootSync(): string; | ||
declare const exportObj: typeof findRepoRoot & { | ||
sync: typeof findRepoRootSync; | ||
}; | ||
export default exportObj; |
@@ -14,2 +14,3 @@ "use strict"; | ||
const find_up_1 = __importDefault(require("find-up")); | ||
const fs_1 = __importDefault(require("@react-native-windows/fs")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -19,3 +20,3 @@ /** | ||
*/ | ||
exports.default = async () => { | ||
async function findRepoRoot() { | ||
const root = await (0, find_up_1.default)(async (dir) => { | ||
@@ -28,3 +29,17 @@ return (await find_up_1.default.exists(path_1.default.join(dir, '.git'))) ? dir : undefined; | ||
return root; | ||
}; | ||
} | ||
/** | ||
* Synchronously finds the root directory of a repo upward from cwd | ||
*/ | ||
function findRepoRootSync() { | ||
const root = find_up_1.default.sync((dir) => { | ||
return fs_1.default.existsSync(path_1.default.join(dir, '.git')) ? dir : undefined; | ||
}, { type: 'directory' }); | ||
if (!root) { | ||
throw new Error('Unable to find the root of react-native-windows. Are you running within the repo?'); | ||
} | ||
return root; | ||
} | ||
const exportObj = Object.assign(findRepoRoot, { sync: findRepoRootSync }); | ||
exports.default = exportObj; | ||
//# sourceMappingURL=findRepoRoot.js.map |
{ | ||
"name": "@react-native-windows/find-repo-root", | ||
"version": "0.0.0-canary.28", | ||
"version": "0.0.0-canary.29", | ||
"license": "MIT", | ||
@@ -19,2 +19,3 @@ "scripts": { | ||
"dependencies": { | ||
"@react-native-windows/fs": "^1.0.1", | ||
"find-up": "^4.1.0" | ||
@@ -21,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
5529
60
2
+ Added@react-native-windows/fs@1.0.2(transitive)
+ Addedgraceful-fs@4.2.11(transitive)