@origraph/twitter-import
v0.1.3
Published
Plugin to origraph.js for importing twitter data
Downloads
12
Readme
origraph-twitter-import
Plugin to origraph.js for importing twitter data
Installation and Usage
Basic use in the browser
This will make the window.origraph
global available to your scripts, and you can access the plugin through window.origraph.plugins['twitter-import']
:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/origraph.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/origraphTwitterImport.umd.js"></script>
Server-side apps or pre-bundled browser apps
Installation:
npm install origraph @origraph/twitter-import
Usage:
const origraph = require('origraph');
const origraphTwitterImport = require('@origraph/twitter-import');
Using this as a template for other plugins
This is meant as a pretty simple template for writing other origraph data import plugins. To create your own, you'll mostly need to:
- Create your own repository, ideally named
origraph-your-plugin-name
- Copy over all the contents of this repository (except, of course, the
.git
directory) - Edit (or re-
init
)package.json
appropriately (using the@origraph/your-plugin-name
scoping) - Set up Travis / Coveralls
- Rename / edit files in
src
, and replace thetest
s with your own (basicTests.js
is a good one to leave intact / a good place to start if you're new to testing) - Update the contents of the
hooks
directory appropriately
Building and Publishing
For testing purposes, register for Twitter developer credentials, and create a test/credentials.json
file that looks like this (this should never be committed):
{
"consumerKey": " ... ",
"consumerSecret": " ... ",
"accessToken": " ... ",
"accessTokenSecret": " ... "
}
You should also add these as environment variables to Travis CI (as TWITTER_consumerKey
, TWITTER_consumerSecret
, etc).
- Update the version number in
package.json
npm run build
npm run test
git commit -a -m "commit message"
git push
- (Verify Travis CI doesn't fail)
git tag -a #.#.# -m "tag annotation"
git push --tags
npm publish --access public
- Edit / document the release on Github (optional)
How people can use your published plugin
If you follow the above directions, you should be able to include your plugin in the browser in the same ways that this plugin is used (including the browser CDN and the npm install @origraph/your-plugin-name
routes).