Skip to content

Instantly share code, notes, and snippets.

@alopix
Forked from iainjreid/package-json.d.ts
Last active May 15, 2019 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alopix/2524414fd075d4fb7a32f00bc80400ef to your computer and use it in GitHub Desktop.
Save alopix/2524414fd075d4fb7a32f00bc80400ef to your computer and use it in GitHub Desktop.
A TypeScript type definition for NPM package files
export interface PackageJson {
name: string;
version?: string;
description?: string;
keywords?: string[];
homepage?: string;
bugs?: string | Bugs;
license?: string;
author?: string | Author;
contributors?: string[] | Author[];
files?: string[];
main?: string;
bin?: string | BinMap;
man?: string | string[];
directories?: Directories;
repository?: string | Repository;
scripts?: ScriptsMap;
config?: Config;
dependencies?: DependencyMap;
devDependencies?: DependencyMap;
peerDependencies?: DependencyMap;
optionalDependencies?: DependencyMap;
bundledDependencies?: string[];
engines?: Engines;
os?: string[];
cpu?: string[];
preferGlobal?: boolean;
private?: boolean;
publishConfig?: PublishConfig;
}
export interface Author {
name: string;
email?: string;
homepage?: string;
}
export interface BinMap {
[commandName: string]: string;
}
export interface Bugs {
email: string;
url: string;
}
export interface Config {
name?: string;
config?: Object;
}
export interface DependencyMap {
[dependencyName: string]: string;
}
export interface Directories {
lib?: string;
bin?: string;
man?: string;
doc?: string;
example?: string;
}
export interface Engines {
node?: string;
npm?: string;
}
export interface PublishConfig {
registry?: string;
}
export interface Repository {
type: string;
url: string;
}
export interface ScriptsMap {
[scriptName: string]: string;
}
{
"name": "@types/gist-package-json",
"version": "1.0.0",
"author": "Iain Reid",
"contributors": ["Dustin Steiner <dustin.steiner@gmail.com>"]
"types": "package-json.d.ts"
}
{
"authors": "Iain Reid",
"contributors": ["Dustin Steiner <dustin.steiner@gmail.com>"]
"definitionFilename": "package-json.d.ts",
"sourceRepoURL": "https://gist.github.com/iainreid820/5c1cc527fe6b5b7dba41fec7fe54bf6e",
"declaredModules": [
"PackageJSON",
"Author",
"BinMap",
"Bugs",
"Config",
"DependencyMap",
"Directories",
"Engines",
"PublishConfig",
"Repository",
"ScriptsMap"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment