npm.io
1.0.7 • Published 5 years ago

nuxt-content-hooks-git

Licence
MIT
Version
1.0.7
Deps
2
Size
11 kB
Vulns
8
Weekly
0
Stars
2
DeprecatedThis package is deprecated

nuxt-content-hooks-git

npm version Linux macOS Windows compatible Build status Coverage status Dependency status Renovate enabled
Open in Gitpod Buy Me a Coffee PayPal Patreon

nuxt-content hooks that replace or add createdAt and updatedAt dates based on the git history.

There is also a Nuxt.js module that does the same thing and is probably cleaner to use.

Install

# npm
$ npm install nuxt-content-hooks-git

# Yarn
$ yarn add nuxt-content-hooks-git

Usage

Add the hooks to your hooks config:

import nuxtContentHooksGit from 'nuxt-content-hooks-git'

export default {
  hooks: {
    ...
    ...nuxtContentHooksGit(),
  },
}

This will replace doc.createdAt and doc.updatedAt with the dates from the Git log.

It is also possible to not override the values but instead specify the field names like this:

import nuxtContentHooksGit from 'nuxt-content-hooks-git'

export default {
  hooks: {
    ...
    ...nuxtContentHooksGit({ createdAtName: 'gitCreatedAt', updatedAtName: 'gitUpdatedAt' }),
  },
}

Then you can access them via doc.gitCreatedAt and doc.gitUpdatedAt.

Contribute

Are you missing something or want to contribute? Feel free to file an issue or a pull request!

Support

Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:

Buy Me a Coffee  If you want to send me a one time donation. The coffee is pretty good .
PayPal  Also for one time donations if you like PayPal.
Patreon  Here you can support me regularly, which is great so I can steadily work on projects.

Thanks a lot for your support!

License

MIT License Sebastian Landwehr