Skip to content

Commit

Permalink
Adds Typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Aug 7, 2022
1 parent f6d5125 commit e0b6f7d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ npm-debug.log*
.eslintcache

# build output
lib
lib/index.*

# tests
**/build
Expand Down
22 changes: 22 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Metalsmith from "metalsmith";

export default initMetadata;
export type Options = {
[key: string]: string;
};
/**
* A Metalsmith plugin to load global metadata from files
*
* @example
* ```js
* // inside metalsmith.source()
* metalsmith.use(metadata({ 'config': 'src/config.json' }))
* // inside metalsmith.directory()
* metalsmith.use(metadata({ 'config': 'config.json' }))
* // target a keypath
* metalsmith.use(metadata({ 'config.nav.items': 'navitems.yaml' }))
* ```
* @param {Options} options
* @returns {import('metalsmith').Plugin}
*/
declare function initMetadata(options?: Options): Metalsmith.Plugin;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"lib/index.js",
"lib/index.cjs"
],
"types": "lib/index.d.ts",
"scripts": {
"changelog": "auto-changelog -u date --commit-limit false --ignore-commit-pattern '^((dev|chore|ci):|Release)'",
"coverage": "nyc report --reporter=text-lcov > ./coverage.info",
Expand Down

0 comments on commit e0b6f7d

Please sign in to comment.