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

mercury-bot

v3.3.0

Published

Mercury is a bot for managing in-code static translations

Downloads

15

Readme


How Mercury works

The bot looks for a mercury.json manifest file in a repository's root. It then locates the source files and keeps them updated with Smartling by using its API and making Pull Requests. Please refer to the Mercury consumer integration runbook and FAQ.

Mercury screenshot

How to setup the bot in your organization

Mercury is available as npm module and needs to be configured to run with github and smartling API tokens.

Here is a code example:

const mercury = require('mercury-bot');

const config = {
  github: {
    apiTokens: [
      { operation: 'read', value: 'token-1234567890' },
      { operation: 'write', value: 'token-0987654321' }
    ],
    owner: 'mercurybot',
    branch: 'mercury'
  },
  smartling: {
    userIdentifier: 'userId-1234567890',
    userSecret: 'userSecret-0987654321'
  },
  repositories: {
    'github-org': ['repo1', 'repo2']
  }
};

const app = mercury({ config });

// Optional event handlers
app.on('error', console.log);
app.on('action', console.log);
app.on('result', console.log);

// Run
app.run(() => process.exit(0));

API

Init mercury({ config })

config is an object that requires the following structure:

|name|type|mandatory|description| |----|----|---------|-----------| |github|object|yes|Github config| |github.apiTokens|object|yes|Github API Tokens. You need at least one read token and one write token| |github.apiTokens[index].operation|string|yes|Can be either read or write| |github.apiTokens[index].value|string|yes|The token| |github.owner|string|yes|The github user associated with the token| |github.branch|string|yes|The branch that the bot will use to make Pull Requests on his fork| |repositories|object|yes|The repositories mercury needs to watch and manage| |repositories[index]|array of strings|yes|The github org that contains the repos to watch| |repositories[index][item]|string|yes|The github repo to watch| |smartling|object|yes|The smartling config| |smartling.userIdentifier|string|yes|The smartling UserId| |smartling.userSecret|string|yes|The smartling UserSecret| |bucketsCount|number|no|Buckets count. The current bucket is selected based on the current UTC hour. The value must be between 1 and 24. The default value is 1|

mercury.on(eventName, payload)

Event handler for connecting to a logger. The following events are emitted:

|name|payload object props|description| |----|--------------------|-----------| |action|{ message}|The message contains a description of the performed action| |error|{ error, errorType, details }|The error is a javascript Error object containing the whole stacktrace. The errorType is a string identifier for the error, and the details contains all the state of the performed actions for the current repository for further investigation| |result|{ message, resultType }|The message contains a description of the performed action, the resultType is an identifier for the current action|

License

MIT