npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

postmaker

v1.0.0

Published

Standalone article generator for self-hosted, flat file blogs

Downloads

4

Readme

postmaker

The Markdown article generator.

Installation

Install with Yarn...

yarn global add postmaker

...or NPM...

npm install -g postmaker

Usage

Postmaker generates articles through its command-line interface or through a programmatic JavaScript API. Details on how to access the Postmaker interface are below:

Command-Line Interface

The easiest way to get started with Postmaker is by running it through the CLI. Run the postmaker command to generate a Markdown article with front matter data at a given location:

postmaker 'name of the article' -c category -t tag1,tag2,tag3 -p ./src/articles

You can also use it in NPM/Yarn scripts:

{
  "scripts": {
    "generate": "postmaker -p ./src/articles"
  }
}

Running yarn generate 'YOUR ARTICLE NAME' will invoke postmaker and generate your article.

Configuration

Postmaker can also read a .postmakerc file from the current directory, any parent directory, or in any one of the following locations:

  • ~/.config/postmakerc
  • ~/.config/postmaker/postmakerc
  • /etc/postmakerc
  • /etc/postmaker/postmakerc

This is a JSON file that provides defaults for the command-line tool. An example use case is for a project that always generates articles into a certain directory. To prevent having to write -p ./src/articles each time, you could write a .postmakerc config like so:

{
  "path": "./src/articles"
}

Now, every time you invoke postmaker, you can When using it in package.json scripts, make sure you prefix with the binstub path:

{
  "scripts": {
    "generate": "node_modules/.bin/postmaker -p ./src/articles"
  }
}

JavaScript API

Postmaker also exposes a JS API that lets you work with newly generated posts programatically.

To generate a new Post and write it to disk, the easiest method is to use the Postmaker.create() function:

import postmaker from "postmaker"

const post = postmaker.create({
  title: 'name of my post',
  category: 'gbs',
  tags: ['one', 'two']
  path: './src/articles'
})

This creates a new article and writes to disk, using the Post class to store data and make transformations. Most of the library's functionality is implemented in the Post class. Instead of using Postmaker.create(), which will try to write the file to disk before returning the Post object back, you can also instantiate the Post object and manipulate its behavior before writing to disk:

import { Post } from "postmaker"

const post = new Post({
  title: 'name of my post',
  category: 'gbs',
  tags: ['one', 'two']
  path: './src/articles'
})

// ... do some other logic ...

post.write()

Contributing

You can contribute to the development of postmaker by filing an issue report if you're having some trouble using the library/CLI, or submitting a pull request if you have code to fix a particular issue. We accept all contributions that follow our code of conduct.