mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
add git-url-parse (#27233)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
6c93547985
commit
6e4e25a30e
8
types/git-url-parse/git-url-parse-tests.ts
Normal file
8
types/git-url-parse/git-url-parse-tests.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import gitUrlParse = require('git-url-parse');
|
||||
|
||||
gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git"); // $ExpectType GitUrl
|
||||
gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toString(); // $ExpectType string
|
||||
gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toString('git+ssh'); // $ExpectType string
|
||||
|
||||
gitUrlParse.stringify(gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git")); // $ExpectType string
|
||||
gitUrlParse.stringify(gitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git"), 'https'); // $ExpectType string
|
||||
48
types/git-url-parse/index.d.ts
vendored
Normal file
48
types/git-url-parse/index.d.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Type definitions for git-url-parse 9.0
|
||||
// Project: https://github.com/IonicaBizau/git-url-parse
|
||||
// Definitions by: Klaus Meinhardt <https://github.com/ajafff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace gitUrlParse {
|
||||
interface GitUrl {
|
||||
/** An array with the url protocols (usually it has one element). */
|
||||
protocols: string[];
|
||||
port: number | null;
|
||||
/** The url domain (including subdomains). */
|
||||
resource: string;
|
||||
/** The authentication user (usually for ssh urls). */
|
||||
user: string;
|
||||
pathname: string;
|
||||
hash: string;
|
||||
search: string;
|
||||
href: string;
|
||||
protocol: string;
|
||||
/** The oauth token (could appear in the https urls). */
|
||||
token: string;
|
||||
/** The Git provider (e.g. `"github.com"`). */
|
||||
source: string;
|
||||
/** The repository owner. */
|
||||
owner: string;
|
||||
/** The repository name. */
|
||||
name: string;
|
||||
/** The repository ref (e.g., "master" or "dev"). */
|
||||
ref: string;
|
||||
/** A filepath relative to the repository root. */
|
||||
filepath: string;
|
||||
/** The type of filepath in the url ("blob" or "tree"). */
|
||||
filepathtype: string;
|
||||
/** The owner and name values in the `owner/name` format. */
|
||||
full_name: string;
|
||||
/** The organization the owner belongs to. This is CloudForge specific. */
|
||||
organization: string;
|
||||
/** Whether to add the `.git` suffix or not. */
|
||||
git_suffix?: boolean;
|
||||
toString(type?: string): string;
|
||||
}
|
||||
|
||||
function stringify(url: GitUrl, type?: string): string;
|
||||
}
|
||||
|
||||
declare function gitUrlParse(url: string): gitUrlParse.GitUrl;
|
||||
|
||||
export = gitUrlParse;
|
||||
23
types/git-url-parse/tsconfig.json
Normal file
23
types/git-url-parse/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"git-url-parse-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/git-url-parse/tslint.json
Normal file
1
types/git-url-parse/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user