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

heroku-mitosis

v1.3.3

Published

A package to make copies of heroku apps for reviewing purposes

Downloads

117

Readme

Heroku Mitosis

A package for creating copies of heroku applications through the CLI, using Heroku's app schema as a base.

Designed to be used mainly as a part of your CI pipeline to create review apps.

Tasks

setup task

Sets up or updates an application

Arguments

| Name | Description | | ----------- | ----------------------------------------------------------------- | | --tarball | The public tarball url that contains the application source code. | | --name | The application name. | | --apiKey | Heroku API key |

Description

If the application exists
  1. Updates the application using the tarball, outputting the deployment logs.
If the application does not exist
  1. Creates an application based on the app.json on the root of the application.
  2. Waits for the app to be fully provisioned, outputting the deployment logs.
  3. Adds collaborators, if any. (see: Custom app.json properties)
  4. Adds the application to a particular pipeline stage. (see: Custom app.json properties)

destroy task

Destroys an application by its name

Arguments

| Name | Description | | ---------- | --------------------- | | --name | The application name. | | --apiKey | Heroku API key |

Example - GitLab CI

In here we use some of the readily available CI variables: CI_BUILD_REF_SLUG, CI_BUILD_REF_NAME, plus some user defined variables: GITLAB_TOKEN and HEROKU_API_KEY. More here.

This will create an app with the name of the branch as the application name. Using a prefix would be recommended. Keep in mind Heroku limits the maximum amount of characters on the application name (to 32, apparently), and this is not handled by this package.

review:
  stage: review
  when: manual # or auto
  script:
    - npx heroku-mitosis setup --name=$CI_BUILD_REF_SLUG --tarball=https://gitlab.com/namespace/project/repository/$CI_BUILD_REF_SLUG/archive.tar?private_token=$GITLAB_TOKEN --apiKey=$HEROKU_API_KEY
  environment:
    name: review/$CI_BUILD_REF_NAME
    url: https://$CI_BUILD_REF_SLUG.herokuapp.com
    on_stop: stop_review
  only:
    - branches
  except:
    - master
    - development

stop_review:
  stage: review
  script:
    - npx heroku-mitosis destroy --name=$CI_BUILD_REF_SLUG --apiKey=$HEROKU_API_KEY
  when: manual
  environment:
    name: review/$CI_BUILD_REF_NAME
    action: stop

Custom app.json properties

There are a few custom properties that are not part of the app.json schema that are under the __mitosis namespace. These add automation of commonly used Heroku features. Currently, these are:

  "__mitosis": {
    "pipeline": {
      // Adds this app to an already existent pipeline named foo. The Heroku account must have access to it.
      "name": "foo",

      // The stage coupling in the pipeline this app is added to. With review, it behaves as it would with the github integration. Possible values: :"test", "review", "development", "staging", "production"
      "stage": "review"
    },
    "collaborators": [
      // You may add additional users that will have access to this app. The users must already exist in Heroku.
      "[email protected]",
      "[email protected]"
    ],
    "features": [
      // Additional Heroku features can be enabled here. Possible features should be available here: https://devcenter.heroku.com/categories/labs
      "runtime-dyno-metadata"
    ]
  }
Notes

Remember to clean up your unused environments, be a good sport and don't abuse heroku's free resources!