Skip to content
Announcing your Releases
Branch: next
Clone or download
Thatkookooguy tests: move to using snapshot and fix coverage (#36)
* tests: move to snapshot and fix coverage

* refactor: extract testable parts from cli file

* tests: add jest-stare as a test reporter

We might choose something else later on but this looked like a decent one for now

* remove uninstalled reporter
Latest commit 85c2e9d May 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/as-a-node-module CR fix typo Apr 2, 2019
src
types
.all-contributorsrc Update @ZimGil as a contributor Mar 31, 2019
.env.example feat(tweet): initial implementation Mar 31, 2019
.gitignore tests: move to using snapshot and fix coverage (#36) May 15, 2019
.hound.yml feat(ci): add linter, hound and lint files (#18) Apr 2, 2019
.travis.yml chore(tests): integrate jest for tests and add coverage reporting (#8) Apr 1, 2019
LICENSE
README.md chore: Add Greenkeeper badge 🌴 (#23) May 14, 2019
greenkeeper.json chore: Add Greenkeeper badge 🌴 (#23) May 14, 2019
jest.config.js
package.json tests: move to using snapshot and fix coverage (#36) May 15, 2019
tsconfig.json chore(tests): integrate jest for tests and add coverage reporting (#8) Apr 1, 2019
tslint.json feat(ci): add linter, hound and lint files (#18) Apr 2, 2019

README.md

@kibibit/announce-it

Announcing your application releases on social media


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 can add a dedicated script in your package.json file:
    // ...
    "scripts": {
      // ...
      "announce": "announce-it"
    }
    // ...
  • 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'
});

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);
  • Use these Token as environment variables in this fashion:
  • CONSUMER_KEY = API key
  • CONSUMER_SECRET = API secret key
  • ACCESS_TOKEN_KEY = Access token
  • ACCESS_TOKEN_SECRET = Access token secret

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):

Gil Tichon
Gil Tichon

🚇 💻 📆
Neil Kalman
Neil Kalman

🚇 🤔

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

License

MIT © 2019 Gil Tichon ZimGil@kibibit.io

You can’t perform that action at this time.