Skip to content

Nodejs package that is responsible for interpreting instructions on the client from the StrawCI server.

Notifications You must be signed in to change notification settings

strawci/node-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍓 StrawCI Interpreter

This package is responsible for interpreting actions in JSON format. It is made specifically for StrawCI.

👷 Constructor

const Interpreter = require("@strawci/interpreter");
const interpreter = new Interpreter();

📝 Action Body

{
    "type": "bash",
    "arg": "Command to be executed"
}

💻 Functions

// Run a single action
interpreter
    .runAction({
        type: "bash",
        arg: "echo Hello world",
    })
    .then(({ stdout, stderr }) => {
        console.log(stdout || stderr);
        console.log("Finished");
    });

// Run multiple actions
const actions = [
    { type: "bash", arg: "echo First command" },
    { type: "bash", arg: "echo Second command" },
    { type: "bash", arg: "echo Third command" },
    { type: "bash", arg: "echo Fourth command" },
];

interpreter
    .runActions(actions, (err, stdout, stderr) => {
        console.log(stdout || stderr);
    })
    .catch((e) => {
        console.error("Failed running command: " + e);
    })
    .then(() => {
        console.log("Finished.");
    });

❤️ The End

Made with Love by Sammwy

About

Nodejs package that is responsible for interpreting instructions on the client from the StrawCI server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published