diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts new file mode 100644 index 0000000000..3a70a8ea9a --- /dev/null +++ b/types/nodegit/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for nodegit 0.18 +// Project: https://github.com/nodegit/nodegit +// Definitions by: Dolan Miu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export { Repository } from './repository'; diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts new file mode 100644 index 0000000000..b7fa54b0c1 --- /dev/null +++ b/types/nodegit/nodegit-tests.ts @@ -0,0 +1,5 @@ +import * as Git from 'nodegit'; + +Git.Repository.discover("startPath", 1, "ceilingDirs").then((string) => { + // Use string +}); diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts new file mode 100644 index 0000000000..f075a063f1 --- /dev/null +++ b/types/nodegit/repository.d.ts @@ -0,0 +1,71 @@ +interface RepositoryInitOptions { + description: string, + flags: number, + initialHead: string, + mode: number, + originUrl: string, + templatePath: string, + version: number, + workdirPath: string +} + + +export class Repository { + /** + * Creates a branch with the passed in name pointing to the commit + * + * @static + * @param {string} startPath + * @param {number} acrossFs + * @param {string} ceilingDirs + * @returns {Promise} + * + * @memberof Repository + */ + static discover(startPath: string, acrossFs: number, ceilingDirs: string): Promise; + /** + * + * + * @static + * @param {string} path + * @param {boolean} [isBare] + * @returns {Promise} + * + * @memberof Repository + */ + static init(path: string, isBare?: boolean): Promise; + /** + * + * + * @static + * @param {string} repoPath + * @param {RepositoryInitOptions} [options] + * @returns {Promise} + * + * @memberof Repository + */ + static initExt(repoPath: string, options?: RepositoryInitOptions): Promise; + /** + * + * + * @static + * @param {string} path + * @returns {Promise} + * + * @memberof Repository + */ + static open(path: string): Promise; + /** + * + * + * @static + * @param {string} barePath + * @returns {Promise} + * + * @memberof Repository + */ + static openBare(barePath: string): Promise; + static openExt(path: string, flags?: number, ceilingDirs?: string): Promise; + + // getBranchCommit(name: string): Promise; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json new file mode 100644 index 0000000000..ba25d4da3e --- /dev/null +++ b/types/nodegit/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nodegit-tests.ts", + "repository.d.ts" + ] +} diff --git a/types/nodegit/tslint.json b/types/nodegit/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/nodegit/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +}