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 🙏

© 2026 – Pkg Stats / Ryan Hefner

heat-templates

v0.2.4

Published

heat-templates

Readme

heat-templates

JavaScript generator for OpenStack Heat orchestration templates.

Installation

$ npm i heat-templates

Usage

Simple example

Input file template.js

const {Template, Server} = require('heat-templates');

const server = Server({
  image: 'ubuntu',
  flavor: 'm1.small'
});

Template().add(server).printYAML();

Run it

$ node template.js

Output

heat_template_version: '2015-04-30'
resources:
  server-b0df-8402:
    type: 'OS::Nova::Server'
    properties:
      flavor: m1.small
      image: ubuntu

More complex example

Server configuration with attached volume and network port with assigned floating IP address

const {Template, Server, Volume, Port, FloatingIP} = require('heat-templates');

const version = '2015-04-30';
const description = 'foo-template';

const template = Template(version, description);

const server = Server({
  id: 'foo-server',
  image: 'debian',
  flavor: 'm1.medium',
  keyPair: 'foo-key-pair'
});

const volume = Volume({
  id: 'foo-volume',
  name: 'bar-volume',
  size: 512
});

const port = Port({
  id: 'foo-port',
  network: 'foo-network',
  subnetwork: 'foo-subnetwork',
  securityGroups: ['foo-security-group']
});

const floatingIP = FloatingIP({
  id: 'foo-floating-ip',
  network: 'foo-public-network'
});

port.attachFloatingIP(floatingIP);

server.attachVolume(volume, '/dev/vdi').attachPort(port);

template.add(server).printYAML();

Output

heat_template_version: '2015-04-30'
description: foo-template
resources:
  foo-server:
    type: 'OS::Nova::Server'
    properties:
      name: foo-server
      flavor: m1.medium
      image: debian
      key_name: foo-key-pair
      networks:
        - port:
            get_resource: foo-port
  foo-volume-attachment:
    type: 'OS::Cinder::VolumeAttachment'
    properties:
      volume_id:
        get_resource: foo-volume
      instance_uuid:
        get_resource: foo-server
      mountpoint: /dev/vdi
  foo-volume:
    type: 'OS::Cinder::Volume'
    properties:
      name: bar-volume
      size: 512
  foo-port:
    type: 'OS::Neutron::Port'
    properties:
      security_groups:
        - foo-security-group
      network: foo-network
      fixed_ips:
        - subnet: foo-subnetwork
  foo-floating-ip:
    type: 'OS::Neutron::FloatingIP'
    properties:
      port_id:
        get_resource: foo-port
      floating_network: foo-public-network

Networks

Network and subnetwork connected to the external network through the router and its interface

const {Template, Network, Subnetwork, Router, RouterInterface} = require('heat-templates');

const network = Network({id: 'test-net'});

const subnetwork = Subnetwork({
  id: 'test-subnet',
  cidr: '10.0.0.0/24',
  dns: ['8.8.8.8'],
  network
});

const router = Router({
  id: 'test-router',
  network: 'ext-net'
});

const routerInterface = RouterInterface({
  id: 'test-router-interface',
  subnetwork,
  router
});

Template().add(routerInterface).printYAML();

Output

heat_template_version: '2015-04-30'
resources:
  test-router-interface:
    type: 'OS::Neutron::RouterInterface'
    properties:
      subnet:
        get_resource: test-subnet
      router:
        get_resource: test-router
  test-subnet:
    type: 'OS::Neutron::Subnet'
    properties:
      network:
        get_resource: test-net
      cidr: 10.0.0.0/24
      dns_nameservers:
        - 8.8.8.8
  test-net:
    type: 'OS::Neutron::Net'
  test-router:
    type: 'OS::Neutron::Router'
    properties:
      external_gateway_info:
        network: ext-net

Components

The currently available components are Server, Volume, VolumeAttachment, Network, Subnetwork, Port, FloatingIP, Router, RouterInterface and SecurityGroup.

All components inherit from base Component and their constructors take properties map object as the first argument. Parameter schemas can be found in their getSchema methods.

Already existing resources can be referenced using strings with their OpenStack IDs.

Library works even on node 0.8 but requires ES6 Object.assign and Set polyfills.

Launching stacks

One of the ways to launch a stack is to use an OpenStack client (python-openstackclient===2.3.0 from pip)

$ node template.js > template.yaml
$ openstack stack create -t template.yaml test-stack

License

MIT