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

centric

v0.13.1

Published

A programmable automation server

Downloads

11

Readme

Centric Server

A programmable automation server

license npm version

Installation

Install centric

$ npm install -g centric

Option 1 - Use centic scaffold

centric scaffold will create a basic centric project with examples that you can modify to suit your needs.

  • Run the below command in the folder you want to create the project.
$ centric scaffold
  • After that, start the server using the command:
$ centric start

And your done!

Option 2 - Create the files yourself

Folder Structure for a centric project.

    .
    ├── services               # Service Files
    ├── tasks                  # Task Files
    ├── config.js              # Configuration file

Services

The services folder contains all your projects service files. A service file has the following signature.

module.exports = async function ({ config }) {
  // Service Logic goes here...
  const testLogging = function () {
    console.log('this is a test')
  }

  return { testLogging }
}

Services are useful for any logic you wish to share between tasks (like a database connection).

Creating a new task

Create a new file in the tasks folder that matches the following signature.

The name of the task in the centric web interface is equivalent to the name of the task file name.

module.exports = {
  description: 'task description', // Viewable in the web UI
  locks: null,
  defaultData: function () {
    // Return the default data for the task.
    // This will be the default "taskData" in the run method.
    return {}
  },
  run: async function ({ config, services, opData, saveOpData, taskData, saveTaskData, logInfo, logWarning, logError, isCancelled }) {
    // Run method is called when the task is executed.
    // Logic for the task goes here.
  }
}

The run method provides following listed parameters:

| Argument | Description | | --- | --- | | config | configuration exported from config.js | | services | object containing all exported values from all service files | | opData | Current running task's operation-data. | | saveOpData | Method to be called to save the curremt operation data. | | taskData | Task data of the current running task. | | saveTaskData | Method to be called to save the current running task data. | | logInfo | logInfo is method to log the info entry showing information log of the operation. | | logWarning | logWarning is method to log the warnings entry showing warnings of the operation. | | logError | logError is method to log the errors entry showing errors of the operation. | | isCancelled | Method to check whether the task is active for running or has been cancelled. |

The screen-shot below shows the list of tasks under the tasks folder. Tasks

Schedule a task

Go to the tasks list page and click over the task item for which need to schedule a task and follow the following steps:

  1. Enable the task

  2. Click the Create Schedule button

Tasks-Schedule

  1. Create Schdule form page will be displayed.

Add new schedule:

| Field | Description | | --- | --- | | Name | Name of the schedule | | cronTime | Time interval to determine how often to run the task | | enabled? | Enable or disable this schedule | | data | Set the tasks operation data when started with this schedule |

  1. Click the Save button. Tasks-Schedule

Creating a new user

Select Users menu from home page, users list page looks like Users

To create new user click over "CREATE USER" button and add the detail of the user to be created.

Task History

The task processed are listed in the history menu under sidemenu list. History

  • It provides the list of task operations processed with following details.
    • Operation Number.
    • Task name of respective operation.
    • Status of the operation (i.e) Completed, Terminated, Active, Failed, Cancelled.
    • Run date of the operation.
    • Entry count: The number of logs written while the processing of the task operation.
    • Last entry message and data.

Dashboard

The dashboard page provides the list of currently running task detail.

Dashboard