Skip to content

Commit

Permalink
Add TypeScript definitions and update package and dependencies to sup…
Browse files Browse the repository at this point in the history
…oort and test
  • Loading branch information
ryanhefner committed Apr 24, 2019
1 parent 84036a4 commit e682269
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 0 deletions.
218 changes: 218 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"files": [
"es",
"src",
"types",
"umd",
"index.js"
],
Expand All @@ -27,6 +28,7 @@
"main": "index.js",
"module": "es/index.js",
"jsnext:main": "src/index.js",
"types": "types",
"scripts": {
"clean": "rm -f index.js && rm -rf es && rm -rf umd",
"prebuild": "npm run clean",
Expand All @@ -35,6 +37,7 @@
"prepare": "npm run build",
"prepublishOnly": "node ./tools/build.js",
"push-release": "git push origin master && git push --tags",
"dtslint": "dtslint types",
"test": "jest"
},
"dependencies": {
Expand All @@ -59,6 +62,7 @@
"babel-polyfill": "^6.26.0",
"contentful": "^7.5.0",
"coveralls": "^3.0.3",
"dtslint": "^0.7.0",
"greenkeeper-lockfile": "^1.15.1",
"gzip-size": "^5.1.0",
"jest": "^24.7.1",
Expand Down
51 changes: 51 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// TypeScript Version: 3.0

import { ContentfulClientApi } from 'contentful';

export interface RouteConfig {
url?: string;
changefreg?: string;
lastmod?: string;
id?: string;
pattern?: string;
priority?: number;
params?: object;
query?: object;
}

export interface RoutesInterface {
[index: number]: RouteConfig;
}

export interface OptionsInterface {
locales?: string[];
dynamicLocales?: boolean;
dynamicLastmod?: boolean;
origin?: string;
localeParam?: string;
defaultLocale?: string;
}

export class ContentfulSitemap {
constructor(routes: RoutesInterface, client: ContentfulClientApi, options: OptionsInterface);

addRoute(route: RouteConfig): ContentfulSitemap;

loadLocales(): Promise<any>;

loadEntry(): Promise<any>;

loadEntries(): Promise<any>;

buildLocaleLinks(toPath: () => {}, params: object): RouteConfig[];

filterEntry(entry: object, route: RouteConfig, params: object): boolean;

buildEntryParams(entry: object, route: RouteConfig, params: object): RouteConfig;

handleQueryRoute(route: RouteConfig, toPath: () => {}, params: object): Promise<RouteConfig>;

parseRoutes(): Array<Promise<any>>;

toXML(callback: () => {}): Promise<any>;
}
Loading

0 comments on commit e682269

Please sign in to comment.