Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

choreographic

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

choreographic

Simple framework for single-run scripts.

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
decreased by-13.51%
Maintainers
1
Weekly downloads
 
Created
Source

Choreographic

Prepackaged application services and behaviors for single-run scripts. Services provided by fable. The key elements:

  • settings/configuratin
  • logging
  • reading files of common formats (csv, text)
  • writing files to the execution-specific rundata folder

Specifically, I kept writing a bunch of these one-off scripts that do tasks like importing a set of data. Or mutating a set of records. Or exercising a set of endpoints. And at times, had to pull in data multiple iterations or on different servers.

When using traditional application services for this, it can be rough. If I were to, say, import 50,000 records and wanted to log anomalies as well as some surrounding data. And, there are 20,000 anomalies.

After running the thing a bunch of times, the log file is fricken enormous. And if I'm running it against qa, staging and production based on shifting config it gets even trickier.

Using This Thing

So you want to Choreograph something:

1. Install the Package:

~/Code/someawesomescript: npm i --save choreographic

2. Write Your Awesome Script:

const libChoreographic = require('choreographic');

const _ScriptHost = new libChoreographic({ "ImportantSettingValue":"I am an important setting!" });

_ScriptHost.log.info('My script is running!');

// Do some important stuff
_ScriptHost.log.error(`There are settings like [ImportantSettingsValue] you can use [${_ScriptHost.settings.ImportantSettingValue}].`);

3. Run Your Awesome Script:

~/Code/someawesomescript: node index.js
2023-04-24T23:43:31.849Z [info] (ScriptHost): Starting up script host [/Users/steven/Code/someawesomescript/rundata/ScriptHost-Run-2023-04-24-16-43-31-833/ScriptHost-Run-2023-04-24-16-43-31-833.log] for ScriptHost...
2023-04-24T23:43:31.855Z [info] (ScriptHost): My script is running!
2023-04-24T23:43:31.855Z [error] (ScriptHost): There are settings like [ImportantSettingsValue] you can use [I am an important setting!].

~/Code/someawesomescript:

4. But Wait, There's More!

After running the script, there will also be a rundata folder:

~/Code/someawesomescript: ls -l rundata/
drwxr-xr-x  3 steven  staff  96 Apr 24 16:42 ScriptHost-Run-2023-04-24-16-42-11-581
drwxr-xr-x  3 steven  staff  96 Apr 24 16:42 ScriptHost-Run-2023-04-24-16-42-31-419
drwxr-xr-x  3 steven  staff  96 Apr 24 16:43 ScriptHost-Run-2023-04-24-16-43-31-833

And in this case the script has been run three times. There is a log file in each folder. Each time you execute the script, it has a new folder for itself.

If you want the prefix to not be ScriptHost, it just uses the common fable settings format for application name:

{
	"Product": "MyProductName"
}

Documentation Yet to Write

  • read common format files
  • write a file to the current rundata folder

Keywords

FAQs

Package last updated on 25 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc