Skip to content

Commit

Permalink
Enhanced types and rename default export to 'remove'
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Nov 30, 2022
1 parent de2aad5 commit 8950b05
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ coverage.info
.nyc_output

# build output
lib
lib/*.*js
18 changes: 18 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Plugin } from 'metalsmith';

export default remove;
export type Options = {
patterns: string[];
};
/**
*
* @typedef {Object} Options
* @property {String[]} patterns
*/
/**
* A Metalsmith plugin to remove files from the build
*
* @param {String|String[]|Options} [options] One or more [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming))
* @return {import('metalsmith').Plugin}
*/
declare function remove(options?: string | string[] | Options): Plugin;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.2.1",
"description": "A Metalsmith plugin to remove files from the build",
"keywords": [
"ignore",
"remove",
"metalsmith-plugin",
"metalsmith"
],
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const debug = debugLib('@metalsmith/remove')
* @param {String|String[]|Options} [options] One or more [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming))
* @return {import('metalsmith').Plugin}
*/
function initRemove(options) {
function remove(options) {
return function remove(files, metalsmith, done) {
if ('string' == typeof options) {
options = [options]
Expand All @@ -36,4 +36,4 @@ function initRemove(options) {
}
}

export default initRemove
export default remove

0 comments on commit 8950b05

Please sign in to comment.