Created Glue project

This commit is contained in:
Gareth Parker
2018-03-20 16:56:31 +00:00
parent 08ed4e9f18
commit b017d84e6a
4 changed files with 88 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import * as Glue from "glue";
import * as Hapi from "hapi";
const manifest: Glue.Manifest = {
server: {
port: 3000
},
register: {
plugins: [
{
plugin: "./test",
routes: {
prefix: "test"
}
}
]
}
}
Glue.compose(manifest);
+35
View File
@@ -0,0 +1,35 @@
// Type definitions for glue
// Project: https://github.com/hapijs/glue
// Definitions by: Gareth Parker
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
declare module "glue" {
import { Server, ServerOptions } from "hapi";
export interface Options {
relativeTo: string;
preConnections?: (Server:Server, next:(err:any)=>void ) => void;
preRegister?: (Server:Server, next:(err:any)=>void ) => void;
}
interface Plugin {
plugin: string | {
register:string;
options?:any;
};
options?: any;
routes?: any
}
interface Manifest {
server: ServerOptions;
register?: {
plugins: Array<Plugin>
}
}
export function compose(manifest: Manifest, options?: Options): Server;
}
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"hapi-glue-test.ts"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"ban-types": false
}
}