Skip to content

Instantly share code, notes, and snippets.

@iainjreid
Last active January 5, 2017 15:58
Show Gist options
  • Save iainjreid/de3bf96ae0ded86a83d41082a0a7bdab to your computer and use it in GitHub Desktop.
Save iainjreid/de3bf96ae0ded86a83d41082a0a7bdab to your computer and use it in GitHub Desktop.
A Typescript type definition for Bower package files
export interface IBowerJSON extends Object {
/**
* The name of the package as stored in the registry
*/
readonly name: string;
/**
* A description of the package limited to 140 characters
*/
readonly description?: string;
/**
* The entry-point files necessary to use your package
*/
readonly main?: string|string[];
/**
* The type of module defined in the main JavaScript file
*/
readonly moduleType?: BowerModuleType|BowerModuleType[];
/**
* SPDX license identifier or path/url to a license
*/
readonly license?: string|string[];
/**
* A list of files for Bower to ignore when installing your package
*/
readonly ignore?: string[];
/**
* Helps make your package easier to discover without people needing to know its name
*/
readonly keywords?: string[];
/**
* A list of people that authored the contents of the package
*/
readonly authors?: string[]|IAuthor[];
/**
* URL to learn more about the package
*/
readonly homepage?: string;
/**
* The repository in which the source code can be found
*/
readonly repository?: IRepository;
/**
* Dependencies are specified with a simple hash of package name to a semver compatible identifier or URL
*/
readonly dependencies?: IDependencyMap;
/**
* Dependencies that are only needed for development of the package, e.g., test framework or building documentation
*/
readonly devDependencies?: IDependencyMap;
/**
* Dependency versions to automatically resolve with if conflicts occur between packages
*/
readonly resolutions?: IDependencyMap;
/**
* If set to true, Bower will refuse to publish it
*/
readonly private?: boolean;
}
export interface IBowerModuleJSON extends IBowerJSON {
_release: string;
}
declare enum BowerModuleType {
"globals",
"amd",
"node",
"es6",
"yui"
}
/**
* A map of dependencies
*/
export interface IDependencyMap {
[dependencyName: string]: string;
}
/**
* An author or contributor
*/
export interface IAuthor {
name: string;
email?: string;
homepage?: string;
}
/**
* A project repository
*/
export interface IRepository {
type: string;
url: string;
}
{
"name": "@types/gist-bower-json",
"version": "1.0.0",
"author": "Iain Reid",
"types": "bower-json.d.ts"
}
{
"authors": "Iain Reid",
"definitionFilename": "bower-json.d.ts",
"sourceRepoURL": "https://gist.github.com/iainreid820/de3bf96ae0ded86a83d41082a0a7bdab",
"declaredModules": [
"IBowerJSON",
"IDependencyMap",
"IAuthor",
"IRepository"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment