Sha256: 93dec10669ab245369adffe88d793fafd23d1b3cc9deca0ac02987464f87e028

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

import path from 'path';
import { findUp } from 'find-up';
export default toplevel;
/**
 * Find the next git root
 */
async function toplevel(cwd) {
    const found = await searchDotGit(cwd);
    if (typeof found !== 'string') {
        return found;
    }
    return path.join(found, '..');
}
/**
 * Search .git, the '.git' can be a file(submodule), also can be a directory(normal)
 */
async function searchDotGit(cwd) {
    const foundFile = await findUp('.git', { cwd, type: 'file' });
    const foundDir = await findUp('.git', { cwd, type: 'directory' });
    return foundFile || foundDir;
}
//# sourceMappingURL=index.js.map

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcp-server-ruby-sdk-0.0.6 node_modules/@commitlint/top-level/lib/index.js
pcp-server-ruby-sdk-0.1.0 node_modules/@commitlint/top-level/lib/index.js