mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat(progress-bar-webpack-plugin): new type definition (#43069)
- definition file - tests https://github.com/clessg/progress-bar-webpack-plugin#readme https://github.com/clessg/progress-bar-webpack-plugin#options Thanks!
This commit is contained in:
parent
0f432e3ad0
commit
fe0fce11ec
44
types/progress-bar-webpack-plugin/index.d.ts
vendored
Normal file
44
types/progress-bar-webpack-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Type definitions for progress-bar-webpack-plugin 2.1
|
||||
// Project: https://github.com/clessg/progress-bar-webpack-plugin#readme
|
||||
// Definitions by: Piotr Błażejewicz (Peter Blazejewicz) <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as ProgressBar from 'progress';
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = ProgressBarPlugin;
|
||||
|
||||
declare namespace ProgressBarPlugin {
|
||||
interface Options extends ProgressBar.ProgressBarOptions {
|
||||
/**
|
||||
* the format of the progress bar
|
||||
* @default ':bar'
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* optional function to call when the progress bar completes
|
||||
*/
|
||||
callback?: () => void;
|
||||
/**
|
||||
* option to show summary of time taken
|
||||
* @default true
|
||||
*/
|
||||
summary?: boolean;
|
||||
/**
|
||||
* custom summary message if summary option is false
|
||||
*/
|
||||
summaryContent?: boolean;
|
||||
/**
|
||||
* function to display a custom summary
|
||||
* (passed build time)
|
||||
*/
|
||||
customSummary?: (summary: string) => void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A progress bar plugin for Webpack.
|
||||
*/
|
||||
declare class ProgressBarPlugin extends Plugin {
|
||||
constructor(options?: ProgressBarPlugin.Options);
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
import webpack = require('webpack');
|
||||
|
||||
const configuration: webpack.Configuration = {
|
||||
plugins: [
|
||||
new ProgressBarPlugin({
|
||||
total: 10,
|
||||
format: ` build [:bar] ... (:elapsed seconds)`,
|
||||
clear: false,
|
||||
callback: () => {
|
||||
console.log('done');
|
||||
},
|
||||
complete: '=',
|
||||
curr: 2,
|
||||
incomplete: ' ',
|
||||
width: 20,
|
||||
customSummary: summary => {
|
||||
console.log(summary);
|
||||
// rest of the code ...
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
webpack(configuration);
|
||||
23
types/progress-bar-webpack-plugin/tsconfig.json
Normal file
23
types/progress-bar-webpack-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",
|
||||
"progress-bar-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/progress-bar-webpack-plugin/tslint.json
Normal file
1
types/progress-bar-webpack-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user