Skip to content

Commit

Permalink
chore: update README.md example to use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Aug 7, 2022
1 parent 0b2ce47 commit 7c96ca4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test/fixtures/**
.nyc_output/**
package-lock.json
package-lock.json
lib
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ yarn add @metalsmith/metadata
Pass the options to `Metalsmith#use`. The options object is in the format `{ 'metadata.key': 'path/to/(file.ext|dir)' }`. Relative file/directory paths are resolved to `metalsmith.directory()`. Directory option keys will include direct children of the directory, see [Mapping nested metadata directories](#mapping-nested-metadata-directories) for creating nested directory structures.

```js
const Metalsmith = require('metalsmith')
const metadata = require('@metalsmith/metadata')
import Metalsmith from 'metalsmith'
import metadata from '@metalsmith/metadata'

const __dirname = dirname(new URL(import.meta.url).pathname)

Metalsmith(__dirname)
.use(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lint": "eslint --cache --fix \"{src,test}/**/*.js\"",
"lint:check": "eslint --cache --fix-dry-run \"{src,test}/**/*.js\"",
"release": "release-it .",
"build": "microbundle --target node --no-sourcemap -f cjs,esm --strict",
"build": "microbundle --target node --no-sourcemap -f cjs,esm --strict --generateTypes=false",
"pretest": "npm run build",
"test": "nyc mocha -t 5000"
},
Expand Down

0 comments on commit 7c96ca4

Please sign in to comment.