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

@citation-js/create-plugin

v0.3.0

Published

Template for Citation.js plugins

Downloads

9

Readme

plugin-template

Template for Citation.js plugins

Usage

Initiating the template

mkdir your-plugin
cd your-plugin

npm init @citation-js/plugin
# or 'npx @citation-js/create-plugin'

This triggers a few questions:

  • package name: The name of the package as you want to publish it on npm
  • version: The current version. I recommend 0.0.0, then you can run npm version major, minor or patch when the first version is ready
  • description: Something like "Citation.js plugin for ..."
  • entry point: You can leave this empty, unless you have some specific ideas. It gets filled in later with a more specific default
  • test command: You can leave this empty as well
  • git repository: If you are putting this in a Git repository, you can put the URL here
  • keywords: Comma-separated list of keywords, if you want to you can include citation-js and the format the plugin is for
  • author: Your name, optionally followed by <email> and/or (website)
  • license: Most current plugins are MIT-licensed, but that's your decision
  • Is this OK?: Yes, unless you made a mistake of course
  • What should the plugin scope name (csl, doi, bibtex) be? Up to you, but try to keep it simple, like pubmed for PubMed and PubMed Central Identifiers

This generates a file structure:

.
├── .gitignore
├── .travis.yml         # Configuration for my CI of choice, Travis CI
├── babel.config.js     # Configuration for the Babel build tool
├── package.json        # package manifest for npm/Node
├── README.md
├── src
│   ├── config.js       # Defines default config options
│   ├── index.js        # Registers the plugin
│   ├── input.js        # Defines input formats
│   └── output.js       # Defines output formats
└── test
    └── suite.js        # test suite

Now, run:

npm install

This installs the necessary development tools.

Editing source files

  • If your plugin only defines input or output formats, you can remove the other file and references to that file from index.js.
  • If you do not need configuration, you can remove the file and remove references to the file from index.js and input.js.
  • input.js contains an example format with an identifier that gets parsed into an API URL, the result of which
  • More documentation and links can be found in comments in the source files.
  • The code style is StandardJS. Linting can be done with npm run lint and simple style issues can be corrected with npm run lint -- --fix

Testing

  • An easy way to test while developing is with the following code:
const core = require('@citation-js/core') // Get Citation.js
require('@babel/register')                // Make sure you can use modern features
require('./src/')                         // Load the plugin you are working on

// If you are using synchronous functions
const data = core.Cite(input, options)
// ...

// If you are using asynchronous functions
core.Cite.async(input, options)
    .then(data => /* ... */)
    .catch(console.error)
  • To write proper tests, see test/suite.js, which includes comments