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

atomix

v1.0.2

Published

Atom feed generator that takes JSON input

Downloads

1

Readme

Atomix

Atomix is an Atom generator that takes a simple JSON format as input. It was created because Atom is cumbersome to edit directly.

Atomix does not attempt to implement all features of Atom. Instead, it attempts to be easy to use for simple use cases.

Usage

npm install atomix
./node_modules/.bin/atomix [spec-file]

You can either specify one input file on the command line or give no arguments. If you give no command line arguments, Atomix will read the JSON spec from standard in.

The generated Atom feed will be written to standard out.

Specification format

The specification JSON looks like this:

{
	"feed": {
		<Feed-global data>
	},
	"posts": [
		<List of posts>
	]
}

Feed-global data

{
	"title": <string>,
	"description": <string>,
	"link": <url>,
	"image": <url>,
	"author": {
		"name": <string>,
		"email": <string>
	}
}

List of posts

The "posts" element is a list of post items. A post item looks like this:

{
	"link": <relative url>,
	"thumbnail": <relative url>,
	"title": <string>,
	"shortdesc": <string>,
	"date": <timestamp>
}

The <relative url> fields above will be resolved by the generator based on the URL given in the "link" field of the feed global data. This way, you can keep links to posts on your site short and sweet and independent of your hosting URL in the specification file, while having them be absolute in the generated Atom feed. If you need to refer to a post outside of your site, simply put in an absolute URL.

The format of the "date" field is what Date.parse accepts, which means it accepts typical date formats you see on computers, for example:

  • RFC3339 formatted dates, the standard date format in Atom feeds: 2015-09-30T11:00:00.123Z
  • Other ISO 8601 formatted dates: 2015-09-30 11:00:00.123Z (But not, apparently, 2009-W53-7 or 20150930)
  • RFC2822 formatted dates: Fri, 21 Nov 1997 09:55:06 -0600

Full example

Given the following JSON input:

{
	"feed": {
		"title": "Feed title",
		"description": "Description",
		"link": "http://example.com",
		"author": {
			"name": "Example Com",
			"email": "[email protected]"
		}
	},
	"posts": [
		{
			"link": "first-post",
			"title": "First Post!",
			"shortdesc": "First!"
		}
	]
}

Atomix will output this Atom feed:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Feed title</title>
	<link>http://example.com</link>
	<updated>2015-09-30T10:19:15Z</updated>
	<author>
		<name>Example Com</name>
		<email>[email protected]</email>
	</author>
	<link rel="alternate" href="http://example.com"/>
	<subtitle>Description</subtitle>
	<generator>Feed for Node.js</generator>
	<entry>
		<title type="html"><![CDATA[First Post!]]></title>
		<id>http://example.com/first-post</id>
		<link href="http://example.com/first-post">
		</link>
		<updated>2015-09-30T10:19:15Z</updated>
		<summary type="html"><![CDATA[First!]]></summary>
	</entry>
</feed>