From f9d84e9a2ea2e3e10c7185e78f773c901703bd2f Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Sun, 17 Dec 2017 11:49:44 -0600 Subject: [PATCH] Update: add TypeScript definitions fix #51 --- lib/index.d.ts | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 42 insertions(+) create mode 100644 lib/index.d.ts diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..5548f03 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,41 @@ +import * as webpack from 'webpack' + +declare namespace WebpackShellPlugin { + interface Options { + /** Scripts to execute on the initial build. Defaults to []. */ + onBuildStart?: string[] + + /** + * Scripts to execute after files are emitted at the end of the + * compilation. Defaults to []. + */ + onBuildEnd?: string[] + + /** Scripts to execute after Webpack's process completes. Defaults to []. */ + onBuildExit?: string[] + + /** + * Switch for development environments. This causes scripts to execute once. + * Useful for running HMR on webpack-dev-server or webpack watch mode. + * Defaults to true. + */ + dev?: boolean + + /** + * Switches script execution process from spawn to exec. If running into + * problems with spawn, turn this setting on. Defaults to false. + */ + safe?: boolean + + /** DEPRECATED. Enable for verbose output. Defaults to false. */ + verbose?: boolean + } + + class Plugin extends webpack.Plugin { + constructor(options?: Options) + } +} + +declare module 'webpack-shell-plugin' { + export = WebpackShellPlugin.Plugin +} diff --git a/package.json b/package.json index a51d3ea..94ec7ce 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.5.0", "description": "Run shell commands before and after webpack builds", "main": "lib/index.js", + "types": "lib/index.d.ts", "scripts": { "test": "webpack", "test:dev": "webpack-dev-server --progress",