Skip to content

Commit

Permalink
Adds Typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Dec 7, 2022
1 parent 4dd20fc commit b5d43c7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ npm-debug.log*
coverage.info
test/fixtures/*/build
node_modules
lib
lib/index.*js
21 changes: 21 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Plugin } from 'metalsmith';
export default drafts;
export type Options = {
/**
* Consider files without `draft` key drafts. Defaults to `false`.
*/
default?: boolean;
/**
* Include drafts in the build output. Defaults to `false`.
*/
include?: boolean;
};
/**
* Metalsmith plugin to hide drafts from the output.
*
* @example
* metalsmith.use(drafts()) // same as { include: false }
* metalsmith.use(drafts(true)) // same as { include: true }
* metalsmith.use(drafts({ default: false, include: false })) // same as default
*/
declare function drafts(options?: Options | boolean): Plugin;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"lint": "eslint --fix .",
"lint:check": "eslint --fix-dry-run .",
"release": "release-it .",
"build": "microbundle --target node --no-sourcemap -f cjs,esm --strict --types",
"build": "microbundle --target node --no-sourcemap -f cjs,esm --strict --generateTypes=false",
"pretest": "npm run build",
"test": "nyc mocha"
},
Expand Down

0 comments on commit b5d43c7

Please sign in to comment.