Estrella Build Tool
Estrella is a versatile and lightweight build tool leveraging the speed of esbuild for TypeScript and JavaScript projects. It distinguishes itself by eschewing traditional configuration files in favor of a user-defined JavaScript or TypeScript build script, providing full programmatic control over the build process. Key features include automatic rebuilds on file changes, parallel project building, and integrated TypeScript diagnostics which can be optionally enabled and customized, allowing remapping of diagnostic severity levels. The current stable version is 1.4.1, with releases occurring periodically to incorporate esbuild updates and introduce new features or fixes. Its minimal dependency footprint (primarily esbuild itself) and single-file design contribute to its fast startup times, aiming to retain esbuild's blazing performance.
Common errors
-
Parameter 'ev' implicitly has an 'any' type. TS7006
cause This TypeScript error indicates that a parameter's type could not be inferred and 'noImplicitAny' is enabled in your `tsconfig.json`.fixEstrella allows remapping TS diagnostic severities. Add a `tsrules` entry to your `build` options, e.g., `tsrules: { '7006': 'warn' }`, to treat this specific error as a warning instead of an error, or explicitly type the parameter (e.g., `ev: MouseEvent`). -
Error: Cannot find module 'estrella'
cause The 'estrella' package is not installed or not resolvable from the current working directory.fixRun `npm install -D estrella` or `yarn add -D estrella` in your project's root directory. Ensure your build script is run from a location where `node_modules` is accessible.
Warnings
- breaking The API for the `watch` function underwent a breaking change in v1.4.0. Users explicitly calling `watch` directly should review the updated API documentation or examples.
- gotcha Changes in internal handling of `define` entries within `BuildConfig` in v1.4.0 might subtly alter build behavior if relying on specific `define` configurations.
- gotcha Behavior when `run`ning a program after building it might have changed in v1.4.1. This could affect scripts that automate execution post-build.
- gotcha TypeScript diagnostics are optional and only run if a `tsconfig.json` file is present in the project directory or if `build({ tsc: true })` is explicitly set in the build script. Without these, only esbuild's basic transpilation occurs.
Install
-
npm install estrella -
yarn add estrella -
pnpm add estrella
Imports
- build
const build = require('estrella')import { build } from 'estrella' - watch
build({ watch: true })import { watch } from 'estrella' - BuildConfig
import type { BuildConfig } from 'estrella'
Quickstart
#!/usr/bin/env node
const { build } = require("estrella")
// A basic build script compiling a TypeScript entry point
// and bundling it to a specified output file.
// TypeScript diagnostics are explicitly enabled.
build({
entry: "src/main.ts",
outfile: "out/foo.js",
bundle: true,
// Pass any options to esbuild here, e.g., minify, sourcemap, platform.
// This also explicitly enables TypeScript diagnostics during the build.
tsc: true
})
// To run this script: chmod +x build.js && ./build.js -watch