frontmatter-date-setter
v0.1.0
Published
Set YAML frontmatter file creation and modified dates using git date information
Maintainers
Readme
This package adds git file creation and modification dates to yaml frontmatter. Give it a directory and some file extensions and it will do the rest.
If a creation or modification date is already present, they will be updated if they don't match.
Example
Input
---
title: Frontmatter Date Setter
---Output
---
title: Frontmatter Date Setter
created: 2020-03-22T14:53:49.000Z
modified: 2020-03-22T14:53:49.000Z
---Installation
yarn add frontmatter-date-setter
# or
npm install frontmatter-date-setterFor CLI use you may want to install it globally
yarn global add frontmatter-date-setter
# or
npm install -g frontmatter-date-setterUsage
Node
const fds = require('frontmatter-date-setter')
fds({
directory: './tests',
fileExtension: ['.md', '.mdx'],
debug: true,
})CLI
Usage
$ frontmatter-date-setter <input>
$ fds <input>
Options
--directory, -d The directory of the files to add dates to
--fileExtension, -ext The file extensions that you wish to add dates to
--debug Turn on debugging messages
Examples
$ frontmatter-date-setter --directory="notes" --fileExtension=.md --fileExtension=.mdx
$ fds --directory="notes" --fileExtension=.md --fileExtension=.mdxCLI Example
frontmatter-date-setter --directory="notes" --fileExtension=md --fileExtension=mdx
fds --directory="tests" --fileExtension=.txt --fileExtension=.md --fileExtension=.yml --debugLicense
Made by Zander • zander.wtf • GitHub • Twitter
