From 5bff44a0592dc2de161477d22ff9c2f31105ca81 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 06:46:32 +0000 Subject: [PATCH] Add definitions and tests for main-bower-files --- main-bower-files/main-bower-files-tests.ts | 31 ++++++++++++++++++++ main-bower-files/main-bower-files.d.ts | 34 ++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 main-bower-files/main-bower-files-tests.ts create mode 100644 main-bower-files/main-bower-files.d.ts diff --git a/main-bower-files/main-bower-files-tests.ts b/main-bower-files/main-bower-files-tests.ts new file mode 100644 index 000000000..1658b3800 --- /dev/null +++ b/main-bower-files/main-bower-files-tests.ts @@ -0,0 +1,31 @@ +/// +/// + +import gulp = require("gulp"); +import mainBowerFiles = require("main-bower-files"); + +gulp.task("main-bower-files:simple", () => { + gulp.src(mainBowerFiles()) + .pipe(gulp.dest("dist/bower")); +}); + +gulp.task("main-bower-files:options", () => { + var files = mainBowerFiles({ + debugging: false, + env: process.env.NODE_ENV, + paths: { + bowerDirectory: "path/for/bower_components", + bowerrc: "path/for/.bowerrc", + bowerJson: "path/for/bower.json" + }, + checkExistence: false, + includeDev: false, + includeSelf: false, + filter: (filepath) => { + return filepath.indexOf("search") >= 0; + } + }); + + gulp.src(files, { base: "path/to/bower_components" }) + .pipe(gulp.dest("dist/bower")); +}); diff --git a/main-bower-files/main-bower-files.d.ts b/main-bower-files/main-bower-files.d.ts new file mode 100644 index 000000000..80a4996db --- /dev/null +++ b/main-bower-files/main-bower-files.d.ts @@ -0,0 +1,34 @@ +// Type definitions for main-bower-files +// Project: https://github.com/ck86/main-bower-files +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "main-bower-files" { + + interface IPaths { + bowerDirectory?: string; + bowerrc?: string; + bowerJson?: string; + } + + interface IFilterFunction { + (filepath: string): boolean; + } + + interface IOptions { + debugging?: boolean; + main?: string | string[] | Object; + env?: string; + paths?: IPaths | string; + checkExistence?: boolean; + includeDev?: boolean | string; + includeSelf?: boolean; + filter?: RegExp | IFilterFunction | string | string[]; + } + + function mainBowerFiles(options?: IOptions): string[]; + + export = mainBowerFiles; +}