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

@kibibit/announce-it

v3.0.1

Published

Announcing your Releases

Downloads

13

Readme

How to install

Install this package as a dev dependency:

npm install --save-dev @kibibit/announce-it

How to use

Intended to run after a new release in your continues integration

Twitter Setup

You have to create a Developer Account on Twitter.

  • Create an App
  • From your apps list go to your app Details
  • Select the Keys and tokens tab
  • You'll need all 4 variables available in that page:
    • API key
    • API secret key
    • Access token
    • Access token secret

As a command line tool

  • You need to pass the following parameters by either ENV parameters or calling the cli with these as cli params:

    • TWITTER_CONSUMER_KEY = API key
    • TWITTER_CONSUMER_SECRET = API secret key
    • TWITTER_ACCESS_TOKEN_KEY = Access token
    • TWITTER_ACCESS_TOKEN_SECRET = Access token secret
    • branch = the current branch

    As CLI params:

    ./node_modules/.bin/announce-it --CONSUMER_KEY <key> --CONSUMER_SECRET <secret> --ACCESS_TOKEN_KEY <key> --ACCESS_TOKEN_SECRET <secret> --branch <branchName>

    Both ENV parameters and the CLI arguments have the same names. If a parameter is found in both places, the CLI argument will be used.

  • You can add a dedicated script in your package.json file:

    // ...
    "scripts": {
      // ...
      "announce": "announce-it"
    }
    // ...
  • If executed with @semanic-release/exec:

    because of a current issue with @semantic-release/exec, you need to pass the current branch directly

    "release": {
      "branches": [ /* ... */ ]
      // ...
      "success": [
        "@semantic-release/github",
        [
          "@semantic-release/exec",
          {
            "successCmd": "npm start -- --branch $TRAVIS_BRANCH"
          }
        ]
      ],
    }
      // ...
    // ...
  • If installed as a project dependency, you can run with npx:

    # should be ran inside your project
    # npx
    npx announce-it
    
    # directly 
    ./node_modules/.bin/announce-it
  • If installed globally, you can run it from within any node package with the correct setup

As a node module

import { KbAnnounceIt, PackageDetails } from '@kibibit/announce-it';

const announceIt = new KbAnnounceIt({
  accessTokenKey: 'TWITTER_ACCESS_KEY',
  accessTokenSecret: 'TWITTER_ACCESS_SECRET',
  consumerKey: 'TWITTER_CONSUMER_KEY',
  consumerSecret: 'TWITTER_CONSUMER_SECRET',
  branch: 'CURRENT_BRANCH'
});

const myPackage: PackageDetails = require('./package');

// get generated tweet
const tweet: string = announceIt.generateTweet(myPackage);

console.log('going to tweet: ', tweet);

// publish tweet to twitter
announceIt.announceRelease(myPackage);

Defining your Templates

Inside your package.json file, add an announcements object with tweet property.

You can then create your own tweet message template that will be posted to twitter.

{
  "name": "my-package",
  "version": "2.4.3",
  // ...
  "announcements": {
    "tweet": "Version <%= version %> of <%= package %> is live! <%= npmpage %>"
  },
}

The tweet template is generated with Lodash template.

You can use these variables:

  • Package name: <%= package %>
  • Version number: <%= version %>
  • Package description: <%= description %>
  • Package author: <%= author %>
  • Homepage link: <%= homepage %>
  • Package page on npm: <%= npmpage %>

Contributing

If you have suggestions for how announce-it could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

For more, check out the Contributing Guide.

Contributors

Thanks goes to our contributors! (emoji key):

Library logo is made by Freepik from www.flaticon.com and licensed by CC 3.0 BY

License

MIT © 2019 Gil Tichon [email protected]