mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat(webpack-shell-plugin): definition types (#45295)
- definition file - tests https://github.com/1337programming/webpack-shell-plugin https://www.npmjs.com/package/webpack-shell-plugin#example Thanks!
This commit is contained in:
parent
f16a94d91b
commit
ab4dade120
51
types/webpack-shell-plugin/index.d.ts
vendored
Normal file
51
types/webpack-shell-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
// Type definitions for webpack-shell-plugin 0.5
|
||||
// Project: https://github.com/1337programming/webpack-shell-plugin
|
||||
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare class WebpackShellPlugin extends Plugin {
|
||||
constructor(options?: WebpackShellPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace WebpackShellPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* scripts to execute on the initial build
|
||||
* @default []
|
||||
*/
|
||||
onBuildStart?: string[];
|
||||
/**
|
||||
* scripts to execute after files are emitted at the end of the compilation
|
||||
* @default []
|
||||
*/
|
||||
onBuildEnd?: string[];
|
||||
/**
|
||||
* scripts to execute after webpack process is complete
|
||||
* @default []
|
||||
*/
|
||||
onBuildExit?: string[];
|
||||
/**
|
||||
* Switch for development environments.
|
||||
* This causes scripts to execute once.
|
||||
* Useful for running HMR on webpack-dev-server or webpack watch mode.
|
||||
* @default true
|
||||
*/
|
||||
dev?: boolean;
|
||||
/**
|
||||
* Switches script execution process from spawn to exec.
|
||||
* If running into problems with spawn, turn this setting on.
|
||||
* @default false
|
||||
*/
|
||||
safe?: boolean;
|
||||
/**
|
||||
* Enable for verbose output
|
||||
* @deprecated
|
||||
* @default false
|
||||
*/
|
||||
verbose?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = WebpackShellPlugin;
|
||||
23
types/webpack-shell-plugin/tsconfig.json
Normal file
23
types/webpack-shell-plugin/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"webpack-shell-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/webpack-shell-plugin/tslint.json
Normal file
1
types/webpack-shell-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
41
types/webpack-shell-plugin/webpack-shell-plugin-tests.ts
Normal file
41
types/webpack-shell-plugin/webpack-shell-plugin-tests.ts
Normal file
@ -0,0 +1,41 @@
|
||||
/// <reference types="webpack-dev-server" />
|
||||
import WebpackShellPlugin = require('webpack-shell-plugin');
|
||||
import path = require('path');
|
||||
import { Configuration, Plugin } from 'webpack';
|
||||
import { Options } from 'webpack-shell-plugin';
|
||||
|
||||
const options: Options = {};
|
||||
|
||||
const plugins: Plugin[] = [
|
||||
new WebpackShellPlugin(),
|
||||
new WebpackShellPlugin({}),
|
||||
new WebpackShellPlugin(options),
|
||||
new WebpackShellPlugin({
|
||||
onBuildStart: ['echo "Starting"'],
|
||||
onBuildEnd: ['python script.py && node script.js'],
|
||||
dev: false,
|
||||
onBuildExit: ['echo "Exit"', 'echo "Done"'],
|
||||
safe: true,
|
||||
}),
|
||||
];
|
||||
|
||||
const _: Configuration = {
|
||||
entry: {
|
||||
app: path.resolve(__dirname, 'src/app.js'),
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'bundle.js',
|
||||
},
|
||||
devServer: {
|
||||
contentBase: path.resolve(__dirname, 'src'),
|
||||
},
|
||||
plugins,
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.js$/, loaders: 'babel' },
|
||||
{ test: /\.scss$/, loader: 'style!css!scss?' },
|
||||
{ test: /\.html$/, loader: 'html-loader' },
|
||||
],
|
||||
},
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user