mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for license-checker-webpack-plugin (#34149)
This commit is contained in:
parent
201832cb23
commit
dbea0b6b8e
73
types/license-checker-webpack-plugin/index.d.ts
vendored
Normal file
73
types/license-checker-webpack-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
// Type definitions for license-checker-webpack-plugin 0.0
|
||||
// Project: https://github.com/Microsoft/license-checker-webpack-plugin#readme
|
||||
// Definitions by: Joel Spadin <https://github.com/ChaosinaCan>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare class LicenseCheckerWebpackPlugin extends Plugin {
|
||||
constructor(options: LicenseCheckerWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace LicenseCheckerWebpackPlugin {
|
||||
interface Dependency {
|
||||
name: string;
|
||||
version: string;
|
||||
repository: string;
|
||||
licenseName: string;
|
||||
licenseText: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Regular expression that matches the file paths of dependencies to check.
|
||||
*/
|
||||
filter?: RegExp;
|
||||
|
||||
/**
|
||||
* SPDX expression with allowed licenses.
|
||||
*
|
||||
* Default: `"(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT)"`
|
||||
*/
|
||||
allow?: string;
|
||||
|
||||
/**
|
||||
* Array of dependencies to ignore, in the format `["<dependency name>@<version range>"]`.
|
||||
* For example, `["assignment@^2.0.0"]`.
|
||||
*
|
||||
* Default: `[]`
|
||||
*/
|
||||
ignore?: string[];
|
||||
|
||||
/**
|
||||
* Object of dependencies to override, in the format `{"<dependency name>@<version range>": { ... }}`.
|
||||
* For example, `{"assignment@^2.0.0": { licenseName: "MIT" }}`.
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
override?: Record<string, Partial<Dependency>>;
|
||||
|
||||
/**
|
||||
* Whether to emit errors instead of warnings.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
emitError?: boolean;
|
||||
|
||||
/**
|
||||
* Path to a `.ejs` template, or function that will generate the contents
|
||||
* of the third-party notices file.
|
||||
*/
|
||||
outputWriter?: string | ((dependencies: Dependency[]) => string);
|
||||
|
||||
/**
|
||||
* Name of the third-party notices file with all licensing information.
|
||||
*
|
||||
* Default: `"ThirdPartyNotices.txt"`
|
||||
*/
|
||||
outputFilename?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = LicenseCheckerWebpackPlugin;
|
||||
@ -0,0 +1,24 @@
|
||||
import * as path from 'path';
|
||||
import LicenseCheckerWebpackPlugin = require('license-checker-webpack-plugin');
|
||||
|
||||
// $ExpectType LicenseCheckerWebpackPlugin
|
||||
new LicenseCheckerWebpackPlugin({
|
||||
allow: "(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT)",
|
||||
ignore: ["@microsoft/*"],
|
||||
override: {
|
||||
"assignment@2.0.0": { licenseName: "MIT" },
|
||||
"intersection-observer@0.5.0": { licenseName: "MIT" },
|
||||
"querystring-es3@0.2.1": { licenseName: "MIT" }
|
||||
},
|
||||
emitError: true,
|
||||
outputWriter: path.resolve(__dirname, "customTemplate.ejs"),
|
||||
outputFilename: "ThirdPartyNotices.txt"
|
||||
});
|
||||
|
||||
// $ExpectType LicenseCheckerWebpackPlugin
|
||||
new LicenseCheckerWebpackPlugin({
|
||||
filter: /.*/,
|
||||
outputWriter: (dependencies) => {
|
||||
return dependencies.map(d => `${d.name} ${d.licenseName}`).join('\n');
|
||||
},
|
||||
});
|
||||
23
types/license-checker-webpack-plugin/tsconfig.json
Normal file
23
types/license-checker-webpack-plugin/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"license-checker-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/license-checker-webpack-plugin/tslint.json
Normal file
1
types/license-checker-webpack-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user