Scriptastic is a simple build script engine.
Installing locally is important to ensure the project's build script is always run with the project's referenced version of scriptastic. This will help prevent potential inconsistencies between build.
npm i -D scriptastic
Installing globally is optional, but recommended for convenience. Scriptastic will always run the local project version when available, meaning it is safe to use globally without any potential inconsistencies.
npm i -g scriptastic
When working with a typecsript build script, Scriptastic will automatically attempt to transpile the script so you don't need to. In order to do so, one of the following optional dependencies will need to be installed.
Note: None of these are needed if the script is written in javascript.
Strongly recommended, as the script will be run in memory.
npm i -D ts-node
npm i -D typescript
Scriptastic's cli is scri
. Simply running scri
will run the default
task. Adding a task name as an argument will run that particular task. Example: scri build
will run the build
task.
scri build
npx scri build
node node_modules/.bin/scri build
Create a script in the root of the project directory. The file can be scri.ts
or scri.js
. The javascript file is prioritized when available incase transpiling is handled outside of scriptastic.
Start the build script by importing scriptastic.
import { scri } from "scriptastic";
Tasks are the core of the build system. Tasks can be as granular as needed.
This will create a task named clean
.
scri.task("clean")
.does(() => {
console.log("Build artifacts are removed");
});
Dependencies are run before the current task. By default, the task will only run when all dependencies are successful.
This will create a task named build
with a dependency on the clean
task.
scri.task("build")
.dependsOn("clean")
.does(() => {
console.log("Project is built");
});
Scriptastic will prioritize running from the locally installed project regardless of where it was executed. This will help prevent inconsistencies between build environments, while encouraged to be executed globally for convenience.
I have always had a problem with my project being written in typescript, but needing to write my build script in javascript. Yes, many build scripts can be written in typescript, but they typically need to be transpiled before running, effectively needing to build the build script. Scriptastic takes care of transpiling, making this step nearly non-existent to the user.
Don't like seeing an error about a thrown error? Too much or too little information about the error is shown? Control exactly how errors are displayed. We know errors will happen, so scriptastic allow you to control the flow and display of said errors.
Scriptastic was built with the intention of being used in typescript, so everything is included to do so.
Scriptastic only has a few dependencies, and these dependencies are mostly for convenience, like displaying console output in color.