Last active
February 13, 2020 20:28
-
-
Save iainjreid/5c1cc527fe6b5b7dba41fec7fe54bf6e to your computer and use it in GitHub Desktop.
A Typescript type definition for NPM package files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IPackageJSON extends Object { | |
readonly name: string; | |
readonly version?: string; | |
readonly description?: string; | |
readonly keywords?: string[]; | |
readonly homepage?: string; | |
readonly bugs?: string|IBugs; | |
readonly license?: string; | |
readonly author?: string|IAuthor; | |
readonly contributors?: string[]|IAuthor[]; | |
readonly files?: string[]; | |
readonly main?: string; | |
readonly bin?: string|IBinMap; | |
readonly man?: string|string[]; | |
readonly directories?: IDirectories; | |
readonly repository?: string|IRepository; | |
readonly scripts?: IScriptsMap; | |
readonly config?: IConfig; | |
readonly dependencies?: IDependencyMap; | |
readonly devDependencies?: IDependencyMap; | |
readonly peerDependencies?: IDependencyMap; | |
readonly optionalDependencies?: IDependencyMap; | |
readonly bundledDependencies?: string[]; | |
readonly engines?: IEngines; | |
readonly os?: string[]; | |
readonly cpu?: string[]; | |
readonly preferGlobal?: boolean; | |
readonly private?: boolean; | |
readonly publishConfig?: IPublishConfig; | |
} | |
/** | |
* An author or contributor | |
*/ | |
export interface IAuthor { | |
name: string; | |
email?: string; | |
homepage?: string; | |
} | |
/** | |
* A map of exposed bin commands | |
*/ | |
export interface IBinMap { | |
[commandName: string]: string; | |
} | |
/** | |
* A bugs link | |
*/ | |
export interface IBugs { | |
email: string; | |
url: string; | |
} | |
export interface IConfig { | |
name?: string; | |
config?: Object; | |
} | |
/** | |
* A map of dependencies | |
*/ | |
export interface IDependencyMap { | |
[dependencyName: string]: string; | |
} | |
/** | |
* CommonJS package structure | |
*/ | |
export interface IDirectories { | |
lib?: string; | |
bin?: string; | |
man?: string; | |
doc?: string; | |
example?: string; | |
} | |
export interface IEngines { | |
node?: string; | |
npm?: string; | |
} | |
export interface IPublishConfig { | |
registry?: string; | |
} | |
/** | |
* A project repository | |
*/ | |
export interface IRepository { | |
type: string; | |
url: string; | |
} | |
export interface IScriptsMap { | |
[scriptName: string]: string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "@types/gist-package-json", | |
"version": "1.0.0", | |
"author": "Iain Reid", | |
"types": "package-json.d.ts" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"authors": "Iain Reid", | |
"definitionFilename": "package-json.d.ts", | |
"sourceRepoURL": "https://gist.github.com/iainreid820/5c1cc527fe6b5b7dba41fec7fe54bf6e", | |
"declaredModules": [ | |
"IPackageJSON", | |
"IAuthor", | |
"IBinMap", | |
"IBugs", | |
"IConfig", | |
"IDependencyMap", | |
"IDirectories", | |
"IEngines", | |
"IPublishConfig", | |
"IRepository", | |
"IScriptsMap" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Iain,
As there is no license specified, I would like to ask if I can use code based on this d.ts file in MIT licensed open source code. Thanks.