From ed59bf6392bb0ad0e623ed1062bf7ef1196e268d Mon Sep 17 00:00:00 2001 From: Patricio Ascencio Date: Thu, 5 Aug 2021 04:48:30 -0400 Subject: [PATCH 1/2] =?UTF-8?q?[FEA]:=20New=20versi=C3=B3n=20with=20module?= =?UTF-8?q?=20types=20definition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmignore | 2 ++ lib/index.d.ts | 42 +++++++++++++++++++++++++++++++++++++++ lib/index.js | 2 +- lib/log-reporter.d.ts | 7 +++++++ lib/s3-paging-stream.d.ts | 12 +++++++++++ package.json | 13 ++++++------ 6 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 .npmignore create mode 100644 lib/index.d.ts create mode 100644 lib/log-reporter.d.ts create mode 100644 lib/s3-paging-stream.d.ts diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..0c30401 --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +test +examples \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..05c1d41 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,42 @@ +import { Transform } from 'stream' +import { LogReporterOptions } from './log-reporter'; + +interface CacheOptions { + cacheFileName?: string +} + +interface Params { + Bucket: string +} + +interface Credentials { + accessKeyId: string + secretAccessKey: string + signatureVersion: string +} + +interface AWSConfig { + region: string + credentials: Credentials + params: Params +} + +interface PublishOptions { + noAcl: boolean + force: boolean + simulate: boolean + createOnly: boolean +} + +interface Headers { + [name: string]: string +} + +declare class Publisher { + constructor(awsConfig: AWSConfig, cacheOptions?: CacheOptions); + public publish(headers?: Headers, options?: PublishOptions): Transform; + public reporter(options?: LogReporterOptions): Transform; + public cache(): Transform; +} + +export function create(awsConfig: AWSConfig, cacheOptions?: CacheOptions): Publisher \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index dd6970d..c18481e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -460,6 +460,6 @@ Publisher.prototype.sync = function (prefix, whitelistedFiles) { * @api public */ -exports.create = function (AWSConfig, cacheOptions) { +module.exports.create = function (AWSConfig, cacheOptions) { return new Publisher(AWSConfig, cacheOptions); }; diff --git a/lib/log-reporter.d.ts b/lib/log-reporter.d.ts new file mode 100644 index 0000000..88ea112 --- /dev/null +++ b/lib/log-reporter.d.ts @@ -0,0 +1,7 @@ +import { Transform } from 'stream' + +export interface LogReporterOptions { + states: string[] +} + +export default function (options?: LogReporterOptions): Transform \ No newline at end of file diff --git a/lib/s3-paging-stream.d.ts b/lib/s3-paging-stream.d.ts new file mode 100644 index 0000000..810d04b --- /dev/null +++ b/lib/s3-paging-stream.d.ts @@ -0,0 +1,12 @@ +import { Transform } from 'stream' + +declare class Request { + public send(pageHandler: Function): void; +} + +interface S3PagingStreamOptions { + read: Function + objectMode: boolean +} + +export default function (request: Request, callback: Function, options: S3PagingStreamOptions): Transform \ No newline at end of file diff --git a/package.json b/package.json index dc88fd4..bf952cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "gulp-awspublish", - "version": "4.1.2", + "name": "@pascencio/gulp-awspublish", + "version": "4.3.2", "description": "gulp plugin to publish files to amazon s3", "keywords": [ "gulpplugin", @@ -8,17 +8,18 @@ "s3", "publish" ], - "homepage": "https://github.com/pgherveou/gulp-awspublish", - "bugs": "https://github.com/pgherveou/gulp-awspublish/issues", + "homepage": "https://github.com/pascencio/gulp-awspublish", + "bugs": "https://github.com/pascencio/gulp-awspublish/issues", "author": { "name": "PG Herveou", "email": "pg@jogabo.com", - "url": "https://github.com/pgherveou" + "url": "https://github.com/pascencio" }, "main": "./lib/index.js", + "types": "./lib/index.d.ts", "repository": { "type": "git", - "url": "git://github.com/pgherveou/gulp-awspublish.git" + "url": "git://github.com/pascencio/gulp-awspublish.git" }, "scripts": { "lint": "prettier --single-quote --write **/*.js && eslint --fix .", From 5c57bdbb15e147042d690683a0d2735bf6efe7eb Mon Sep 17 00:00:00 2001 From: Patricio Ascencio Date: Fri, 6 Aug 2021 13:44:18 -0400 Subject: [PATCH 2/2] [FEA]: Mueve reporter a clase Publisher --- lib/index.d.ts | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 05c1d41..2be6f92 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -35,8 +35,9 @@ interface Headers { declare class Publisher { constructor(awsConfig: AWSConfig, cacheOptions?: CacheOptions); public publish(headers?: Headers, options?: PublishOptions): Transform; - public reporter(options?: LogReporterOptions): Transform; public cache(): Transform; } +export function reporter(options?: LogReporterOptions): Transform; + export function create(awsConfig: AWSConfig, cacheOptions?: CacheOptions): Publisher \ No newline at end of file diff --git a/package.json b/package.json index bf952cb..d9ee638 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pascencio/gulp-awspublish", - "version": "4.3.2", + "version": "4.3.3", "description": "gulp plugin to publish files to amazon s3", "keywords": [ "gulpplugin",