mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add types for find-package-json (#30628)
This commit is contained in:
parent
05c33e7019
commit
efb26511dd
19
types/find-package-json/find-package-json-tests.ts
Normal file
19
types/find-package-json/find-package-json-tests.ts
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
import finder = require("find-package-json");
|
||||
|
||||
const f = finder();
|
||||
const fDirname = finder(__dirname);
|
||||
const fModule: finder.FinderIterator = finder(module);
|
||||
|
||||
const findResult = f.next();
|
||||
|
||||
if (findResult.done) {
|
||||
const res: finder.Done = findResult;
|
||||
const value: undefined = findResult.value;
|
||||
const filename: undefined = findResult.filename;
|
||||
} else {
|
||||
const res: finder.FoundPackage = findResult;
|
||||
const value: finder.Package = findResult.value;
|
||||
const filename: string = findResult.filename;
|
||||
}
|
||||
63
types/find-package-json/index.d.ts
vendored
Normal file
63
types/find-package-json/index.d.ts
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
// Type definitions for find-package-json 1.1
|
||||
// Project: https://github.com/3rd-Eden/find-package-json#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
export = finder;
|
||||
|
||||
import Module = NodeJS.Module;
|
||||
|
||||
declare function finder(root?: string | Module): finder.FinderIterator;
|
||||
|
||||
declare namespace finder {
|
||||
interface FinderIterator {
|
||||
next(): FindResult;
|
||||
}
|
||||
|
||||
type FindResult = FoundPackage | Done;
|
||||
|
||||
interface FoundPackage {
|
||||
done: false;
|
||||
value: Package;
|
||||
filename: string;
|
||||
}
|
||||
|
||||
interface Done {
|
||||
done: true;
|
||||
value: undefined;
|
||||
filename: undefined;
|
||||
}
|
||||
|
||||
interface Person {
|
||||
name?: string;
|
||||
email?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface Package {
|
||||
[k: string]: any;
|
||||
name?: string;
|
||||
version?: string;
|
||||
files?: string[];
|
||||
bin?: { [k: string]: string };
|
||||
man?: string[];
|
||||
keywords?: string[];
|
||||
author?: Person;
|
||||
maintainers?: Person[];
|
||||
contributors?: Person[];
|
||||
bundleDependencies?: { [name: string]: string };
|
||||
dependencies?: { [name: string]: string };
|
||||
devDependencies?: { [name: string]: string };
|
||||
optionalDependencies?: { [name: string]: string };
|
||||
description?: string;
|
||||
engines?: { [type: string]: string };
|
||||
license?: string;
|
||||
repository?: { type: string; url: string };
|
||||
bugs?: { url: string; email?: string } | { url?: string; email: string };
|
||||
homepage?: string;
|
||||
scripts?: { [k: string]: string };
|
||||
readme?: string;
|
||||
}
|
||||
}
|
||||
23
types/find-package-json/tsconfig.json
Normal file
23
types/find-package-json/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"find-package-json-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/find-package-json/tslint.json
Normal file
1
types/find-package-json/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user