All Projects → fkrauthan → nss-run

fkrauthan / nss-run

Licence: MIT license
nss-run (not so simple run) is a very simplistic build tool.

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to nss-run

Air
☁️ Live reload for Go apps
Stars: ✭ 5,257 (+37450%)
Mutual labels:  task-runner, build-tool
rote
Automate everything.
Stars: ✭ 66 (+371.43%)
Mutual labels:  task-runner, build-tool
Task
A task runner / simpler Make alternative written in Go
Stars: ✭ 4,282 (+30485.71%)
Mutual labels:  task-runner, build-tool
Realize
Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.
Stars: ✭ 4,162 (+29628.57%)
Mutual labels:  task-runner, build-tool
Mmake
Mmake is a small program which wraps make to provide additional functionality, such as user-friendly help output, remote includes, and eventually more. It otherwise acts as a pass-through to standard make.
Stars: ✭ 1,593 (+11278.57%)
Mutual labels:  task-runner, build-tool
makesure
Simple task/command runner with declarative goals and dependencies
Stars: ✭ 230 (+1542.86%)
Mutual labels:  task-runner, build-tool
Mask
🎭 A CLI task runner defined by a simple markdown file
Stars: ✭ 495 (+3435.71%)
Mutual labels:  task-runner, build-tool
alfred
(v0.2) Even Batman needs a little help. Task runner. Automator. Build system.
Stars: ✭ 62 (+342.86%)
Mutual labels:  task-runner, build-tool
Ygor
Task toolkit. For when `npm run` isn't enough and everything else is too much.
Stars: ✭ 69 (+392.86%)
Mutual labels:  task-runner, build-tool
Doit
task management & automation tool
Stars: ✭ 972 (+6842.86%)
Mutual labels:  task-runner, build-tool
Cargo Make
Rust task runner and build tool.
Stars: ✭ 895 (+6292.86%)
Mutual labels:  task-runner, build-tool
gow
Missing watch mode for Go commands. Watch Go files and execute a command like "go run" or "go test"
Stars: ✭ 343 (+2350%)
Mutual labels:  task-runner, build-tool
Foy
A simple, light-weight and modern task runner for general purpose.
Stars: ✭ 157 (+1021.43%)
Mutual labels:  task-runner, build-tool
alfons
🚀 Task runner for Lua and MoonScript.
Stars: ✭ 17 (+21.43%)
Mutual labels:  task-runner, build-tool
cdkdx
Zero-config CLI for aws cdk development
Stars: ✭ 31 (+121.43%)
Mutual labels:  build-tool
meteor-graphql
Compiler plugin that supports GraphQL files in Meteor
Stars: ✭ 56 (+300%)
Mutual labels:  build-tool
Textrude
Code generation from YAML/JSON/CSV models via SCRIBAN templates
Stars: ✭ 79 (+464.29%)
Mutual labels:  build-tool
make
The Ultimate Makefile to compile all your C, C++, Assembly and Fortran projects
Stars: ✭ 41 (+192.86%)
Mutual labels:  build-tool
arelo
a simple auto reload (live reload) utility
Stars: ✭ 54 (+285.71%)
Mutual labels:  task-runner
kotlin-plugin-generated
A Kotlin compiler plugin that annotates Kotlin-generated methods for improved coverage reports
Stars: ✭ 33 (+135.71%)
Mutual labels:  build-tool

nss-run npm version

nss-run (not so simple run) is a very simplistic build tool.

You can find the source code on github.

Instead of something like gulp or grunt where you are required to execute all your build steps thru plugins nss-run just gives you a easy way to call any external tool without having to find a special plugin first.

In version >=0.2 the style of this plugin got changed from being sync to async (through Promise) only. This change allows way more complex tasks. In most cases it should be very simply to migrate. Please take a look at the UPGRADE documentation!

Get started

Install globally (for a command line script):

npm install nss-run -g

or

yarn global add nss-run

Install in your project (to use nss-run api inside your nss-runfile.js):

npm install nss-run --save-dev

or

yarn add nss-run --dev

If you want to use Babel (6.x)

npm install babel-core babel-preset-env babel-register --save-dev

or

yarn add babel-core babel-preset-env babel-register --dev

Create a nss-runfile.js (if you don't wanna use babel) / nss-runfile.babel.js (if you wanna use babel)

import { task, taskGroup, runTask, run } from "nss-run";

task("create:component", function (name) {
    console.log("Component with name " + name + " created");
});

task("lint", function () {
    return runTask("lint:test")
        .then(function () {
            return runTask("lint:source");
        });
});

taskGroup("lint:test", ["lint:test:unit", "lint:test:integration"]);

task("lint:test:unit", function () {
    return run("eslint ./test/unit");
});

// With ES6 Arrow functions you can do this
task("lint:test:integration", () => run("eslint ./test/integration"));

// And with babel (enabling async/await) you can also do this
task("lint:source", async () => {
    await run("eslint ./src");
    // Do something else here
});

Run:

nss-run create:component test
nss-run lint
nss-run lint:test
nss-run lint:test:unit

Tips:

  • ./node_modules/.bin/ is included into PATH when running commands by nss-run api method
  • Executing nss-run command without arguments displays list of all available tasks (+ description if available)
  • nss-run will automatic require babel-register if it can not find a nss-runfile.js but a nss-runfile.babel.js before including the runfile.

Why nss-run?

Is there really a need for a new build tool? We already have Grunt, Gulp, npm scripts, Makefile, runjs and many more.

Gulp and Grunt are very complex and require special plugins to run the tools that make our nodejs development environment.

Makefiles require you to install a tool outside of the nodejs ecosystem which makes getting started with a project harder then it needs to be.

npm scripts in my opinion are creating to much clutter within your package.json Your dependency file should not need to know how to build your project.

runjs is already going into the right direction (and this tool is heavily inspired by runjs). But some of the design decisions (it is to simple) makes it hard to be used for bigger projects where you just need a bit more flexibility in terms of how you wanna organize your tasks. In addition the design to make it all synchronize can cause a lot conflicts with existing nodejs libraries that might not support synchronized execution (e.g. some file parsers).

nss-run provides you with an very simple way to execute command line tools, npm installed tools as well as writing custom Javascript and using any npm library to create your own simple processing. No need to wait until a plugin makes your favorite tool available thru your build tool. I tried to combine my favorite part of gulp (the task definition system) and the simplicity of runjs to create a simpel (but not so simple ;)) build tool for any project size.

API

import { task, taskGroup, runTask, run } from "nss-run";

task(name, cb[, options])

Register a new task with the given name (do not use spaces in your name). If the task is going to be called the provided callback will be executed. A task might return a Promise to wait for async code to complete. Otherwise the task will be finished as soon as the callback returns.

Options:

{
    description: ..., // provide a description for this task for the task list output (String)
    hidden: ..., // Hide this task from the task list output (true/false) - default: false
}

Examples:

task("test", function () {
    // my task logic here
});
task("test", function () {
    // my task logic here
}, {
    description: "My test description"
});

taskGroup(name, tasksToExecute[, options])

Registers a new task (do not use spaces in your task name) that when called automatic calls all provided task names in a sequence (tasksToExecute has to be a string array). If you provide within the tasksToExecute array a array of strings the tasks in that sub array are going to be executed in parallel before proceeding with the next sequence item. The options are the same as the options for task.

Options:

{
    description: ..., // provide a description for this task for the task list output (String)
    hidden: ..., // Hide this task from the task list output (true/false) - default: false
}

Examples:

taskGroup("test", ["task1", "task2", "task3"]);
taskGroup("test", ["task1", "task2", "task3"], {
    description: "This task will call first task1, then task2 and last task3"
});
taskGroup("test", [["task1", "task2"], "task3"]);

runTask(name[, arg1[, ...]])

This will execute a registered task with the given name. All arguments you pass after the name will be directly passed thru to the tasks function callback. This method will always return a Promise that you should use to find out if the tasks has finished.

Examples:

runTask("lint");
runTask("lint", true, "my-second-argument");

run(cmd[, options])

Run given command as a child process and log the call in the output. It will always return a promise.

Options:

{
    cwd: ..., // current working directory (String)
    canFail: ..., // should promise be failed if program execution failed/returned error (true/false) - default: false
    stream: ..., // directly log the process output (true/false) - default: true
    env: ..., // environment variables to be passed down to the command (object)
    autoAnswer: ... // an array of auto answer objects to automatic answer interactive shell questions (array of Auto Answer Object's)
}

Auto Answer Object:

    search: ..., // the text to search for in the commands output (String)
    answer: ..., // the answer either a string or a function that either returns the answer string or a Promise (String|Function)
    hide: ..., // hide the answer in the terminal output if streaming is enabled (true/false) - default: false

Examples:

run("rm -rf ./lib");
run("http-server .").then((stdout) => {
    log(stdout);
}).catch((error) => {
    throw error;
});
run("http-server .", { stream: false }).then((stdout) => {
    log(stdout);
}).catch((error) => {
    throw error;
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].