mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat(find-parent-dir): initial commit (#27290)
This commit is contained in:
parent
c3293bdfe3
commit
40ed9ae071
19
types/find-parent-dir/find-parent-dir-tests.ts
Normal file
19
types/find-parent-dir/find-parent-dir-tests.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import findParentDir = require("find-parent-dir");
|
||||
|
||||
let parentDir: string | null;
|
||||
|
||||
findParentDir(__dirname, ".git", (err, dir) => {
|
||||
if (err) {
|
||||
console.error("error", err);
|
||||
} else {
|
||||
parentDir = dir;
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
parentDir = findParentDir.sync(__dirname, ".git");
|
||||
} catch (err) {
|
||||
console.error("error", err);
|
||||
}
|
||||
19
types/find-parent-dir/index.d.ts
vendored
Normal file
19
types/find-parent-dir/index.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Type definitions for find-parent-dir 0.3
|
||||
// Project: https://github.com/thlorenz/find-parent-dir
|
||||
// Definitions by: Ika <https://github.com/ikatyang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Finds the first parent directory that contains a given file or directory.
|
||||
*/
|
||||
declare function findParentDir(
|
||||
currentFullPath: string,
|
||||
clue: string,
|
||||
cb: (err: any, dir: string | null) => void
|
||||
): void;
|
||||
|
||||
declare namespace findParentDir {
|
||||
function sync(currentFullPath: string, clue: string): string | null;
|
||||
}
|
||||
|
||||
export = findParentDir;
|
||||
16
types/find-parent-dir/tsconfig.json
Normal file
16
types/find-parent-dir/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": ["index.d.ts", "find-parent-dir-tests.ts"]
|
||||
}
|
||||
3
types/find-parent-dir/tslint.json
Normal file
3
types/find-parent-dir/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user