@kibibit/announce-it v1.1.0-next.8
How to install
Install this package as a dev dependency:
npm install --save-dev @kibibit/announce-itHow 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 tokenstab - 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.jsonfile:// ... "scripts": { // ... "announce": "announce-it" } // ... - If executed with @semanic-release/exec:
// ... "plugins": // ... [ "@semantic-release/exec", { "success": "npm run announce -- --branch ${options.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-itIf 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);- Use these Token as environment variables in this fashion:
CONSUMER_KEY= API keyCONSUMER_SECRET= API secret keyACCESS_TOKEN_KEY= Access tokenACCESS_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):
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
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago