npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dev-kas/buildfile

v1.0.0

Published

A lightweight, cross-platform build automation tool with a simple DSL. The modern alternative to Makefiles.

Readme

Buildfile

License Version

Buildfile is a lightweight, cross-platform build automation tool designed to replace Makefiles in JavaScript/TypeScript projects (and beyond).

It features a simple, readable DSL (Domain Specific Language) that handles cross-platform path resolution, environment variables, and binary execution automatically. No more writing rm -rf for Unix and del for Windows.

📦 Installation

Global Installation

Install it globally to use the build command anywhere:

npm i -g @dev-kas/buildfile

Run via npx

Alternatively, run it without installation:

npx @dev-kas/buildfile [task]

🚀 Quick Start

Create a file named Buildfile in the root of your project:

// Buildfile
const DIST = path("./dist")
const SRC  = path("./src")

// Automatically handles platform differences (node.exe vs node)
tool node {
    windows: "node.exe"
    any:     "node"
}

task clean {
    echo("Cleaning build artifacts...")
    rm(DIST, force: true)
}

task build depends clean {
    echo("Building project...")
    // "tsc" is strictly interpreted as a command here
    exec("tsc") 
}

task start depends build {
    // Uses the 'node' tool defined above
    node(path("${DIST}/index.js"))
}

task default depends start {
    echo("Done!")
}

Run a task:

build start
# or simply 'build' to run the 'default' task

📚 Language Reference

The Buildfile language is designed to look like a mix of JavaScript and a shell script.

Variables

  • const: Immutable variables.
  • let: Mutable variables.
  • env: Sets a process environment variable.
const VERSION = "1.0.0"
let retries = 3

// Sets process.env.PORT, accessible by child processes
env PORT = 8080 

Tasks

Tasks are the core building blocks. They can depend on other tasks, ensuring they run in the correct order.

// Basic task
task setup {
    mkdir("dist")
}

// Task with dependency (runs 'setup' first)
task build depends setup {
    echo("Building...")
}

// Task with multiple dependencies
task deploy depends (build, test) {
    echo("Deploying...")
}

Tools (Cross-Platform Binaries)

The tool keyword solves the "it works on my machine" problem. You define a tool once, and map it to different binaries based on the OS or Architecture.

tool python {
    windows: "py.exe"
    unix:    "python3"
    // Specific architecture support
    [linux, arm64]: "python3-arm" 
}

task run-script {
    // You can now call 'python' like a function
    python("script.py")
}

When you call python(...), Buildfile checks your OS and executes the correct binary.

Platform Blocks

If you need specific logic for a platform that isn't just swapping a binary, use plat or arch blocks.

plat windows {
    echo("Running on Windows")
} else {
    echo("Running on Unix-like system")
}

arch arm64 {
    echo("Running on Apple Silicon or ARM")
}

🛠 API Reference (Built-in Functions)

These functions are available globally in any Buildfile.

File System

path(segments...)

Resolves a path relative to the Buildfile's directory. Handles Windows backslashes automatically.

const p = path("src", "main.ts") 
// Windows: "C:\Project\src\main.ts"
// Linux:   "/app/src/main.ts"

glob(pattern)

Finds files matching a pattern. Returns an array of absolute paths.

const files = glob("src/**/*.ts")

rm(target, options?)

Removes files or directories.

  • force: (boolean) If true, performs a recursive delete (like rm -rf).
rm("./dist", force: true)

mkdir(path)

Creates a directory recursively (like mkdir -p).

mkdir("dist/logs")

Execution & Output

echo(messages...)

Prints to standard output.

echo("Build started", "v1.0")

warn(messages...)

Prints yellow text to standard error.

warn("Deprecation warning")

exec(command, args..., options?)

Executes a shell command synchronously.

  • args: (Named Argument) An array of additional arguments (useful if constructing args dynamically).
// Simple
exec("git", "status")

// With dynamic args
const flags = ["--verbose", "--dry-run"]
exec("npm", "install", args: flags)

Template Literals

Strings support variable interpolation using ${VAR}.

const OUT = "bin"
echo("Output directory: ${OUT}")

⌨️ CLI Usage

Usage: build [options] [task]

Arguments:
  task               The task to run (default: "default")

Options:
  -f, --file <path>  Path to a specific Buildfile (default: searches CWD and parents)
  -V, --version      Output the version number
  -h, --help         Display help for command

🤝 Contributing

We love contributions! Please see CONTRIBUTING.md for details on how to set up the local development environment, understand the interpreter architecture, and submit Pull Requests.

🤖 AI / LLM Context

Using Cursor, Copilot, or ChatGPT to write your Buildfile?

We have provided a dedicated context file to teach AI models the specific syntax of this DSL. Feed them LLMs.md (or @LLMs.md in Cursor) to make them instant experts in writing valid Buildfiles.


License

MIT © dev-kas