{"id":18037559,"url":"https://github.com/jeremija/buildfile","last_synced_at":"2026-05-08T17:43:49.455Z","repository":{"id":57191279,"uuid":"164960261","full_name":"jeremija/Buildfile","owner":"jeremija","description":"Cross-platform build task executor for Node projects with a syntax similar to Makefile","archived":false,"fork":false,"pushed_at":"2019-03-18T08:54:09.000Z","size":725,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T08:44:33.219Z","etag":null,"topics":["build","buildfile","cli","command","commandline","make","makefile","node","npm","npm-scripts","parallel","run","script","sequential","serial","task","tool"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeremija.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-10T00:31:42.000Z","updated_at":"2020-09-19T09:16:34.000Z","dependencies_parsed_at":"2022-09-15T22:23:07.676Z","dependency_job_id":null,"html_url":"https://github.com/jeremija/Buildfile","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremija%2FBuildfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremija%2FBuildfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremija%2FBuildfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremija%2FBuildfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeremija","download_url":"https://codeload.github.com/jeremija/Buildfile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247267588,"owners_count":20911007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","buildfile","cli","command","commandline","make","makefile","node","npm","npm-scripts","parallel","run","script","sequential","serial","task","tool"],"created_at":"2024-10-30T13:12:27.895Z","updated_at":"2026-05-08T17:43:49.408Z","avatar_url":"https://github.com/jeremija.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# buildfile\n\n[![Build Status](https://travis-ci.com/jeremija/Buildfile.svg?branch=master)](https://travis-ci.com/jeremija/Buildfile) [![npm](https://img.shields.io/npm/v/buildfile.svg)](https://www.npmjs.com/package/buildfile)\n\nThis is a task runner utility similar to Makefile, but it does not check the\nfiles of the timestamps. It uses the familiar concept of targets, dependencies,\nand commands, but all targets are [phony][phony]. Supports wildcards using the\n`*` character.\n\nAdditionally, a `-p` flag can be used to run them in parallel.\n\nNo dependencies. That's right, only Node.JS is required.\n\nInstall with: `npm install -g buildfile`\n\nRun with: `build [target1 target2 ...]`\n\n# Why\n\nInstead of having this in `package.json`:\n\n```json\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"build\": \"npm-run-all *.build *.minify\",\n    \"clean\": \"find src/ -type f -name '*.js' | xargs rm\",\n    \"watch\": \"npm-run-all html.build css.build _watch\",\n    \"_watch\": \"npm-run-all -p *.watch\",\n    \"lint\": \"tslint --project .\",\n\n    \"js.build\": \"browserify src/client/index.tsx -p [ tsify --project .] -g [ loose-envify purge --NODE_ENV production ] -v -o build/client.js\",\n    \"js.watch\": \"watchify src/client/index.tsx -p [tsify --project .] -v -d -o build/client.js\",\n    \"js.minify\": \"terser --ecma 5 --compress -o build/client.min.js --mangle -- build/client.js\",\n\n    \"css.build\": \"node-sass -o build/ --output-style compressed src/scss/style.scss\",\n    \"css.watch\": \"node-sass -o build/ --source-map true --source-map-contents true -w src/scss/style.scss\",\n    \"html.build\": \"mustache src/views/index.json src/views/index.mustache \u003e build/index.html\",\n  },\n```\n\none can write a `Buildfile` with the following contents:\n\n```Makefile\nbuild: *.build *.minify\n\ntest:\n  jest\n\nclean:\n  find src/ -type f -name '*.js' | xargs rm\n\nwatch: *.build --parallel *.watch\n\nlint:\n  tslint --project .\n\njs.build:\n  browserify src/client/index.tsx \\\n    -p [ tsify --project .] \\\n    -g [ loose-envify purge --NODE_ENV production ] \\\n    -v -o build/client.js\njs.watch:\n  watchify src/client/index.tsx -p [tsify --project .] -v -d -o build/client.js\njs.minify:\n  terser --ecma 5 --compress -o build/client.min.js --mangle -- build/client.js\n\ncss.build:\n  node-sass -o build/ --output-style compressed src/scss/style.scss\ncss.watch:\n  node-sass -o build/ --source-map true --source-map-contents true -w src/scss/style.scss\n\nhtml.build:\n  mustache src/views/index.json src/views/index.mustache \u003e build/index.html\n```\n\nThis is easier to read, line continuation is allowed, and tasks can be executed\nin parallel via the `-p` or `--parallel` flag.\n\nTo run a target, simply type:\n\n```bash\nbuild       # runs the first target (build)\nbuild test  # runs test target\nbuild watch # runs the watch target\n```\n\nIf `buildfile` was installed locally, the provided `build` command can be run\nvia: `npx build`, or `./node_modules/.bin/build`.\n\n# Basic syntax\n\n```Makefile\ntarget: dependency\n  echo target\n\ndependency:\n  echo dependency\n```\n\nrunning `build` should run the first available target: `target`:\n\n```\n==\u003e target\n==\u003e dependency\n\u003e echo dependency\n dependency\n\u003e echo target\ntarget\n```\n\nA custom target can be run by specifying it as `build dependency`.\n\n# Advanced Syntax\n\n```Makefile\n# Contents of \"buildfile\"\n# Comments start with #\n\n# Define an environment variable\nvar1 := value1\n\n# Define an environment variable if it is not already defined\nvar2 ?= value2\n\n# Define an environment varaible from an existing variable\nvar3 := $var2\n\ntarget: dependency\n  # var1 will not be expanded, by var2 will\n  echo $$var1 $var2\n\ndependency:\n  echo  $var3 ${var4:$var3}\n```\n\nRunning `build` echoes the following:\n\n```\n$ build\n==\u003e target\n==\u003e dependency\n\u003e echo value2 value2\nvalue2 value2\n\u003e echo $var1 value2\nvalue1 value2\n```\n\n\n# Variables\n\nEnvironment variables can be set:\n\n```Makefile\necho:\n  echo $args\n```\n\n```bash\n$ build args=test\n==\u003e build\n\u003e echo test\ntest\n```\n\nThe following also works:\n\n```\nvar3 ?= value3\nvar4 := value4\n\ntest:\n  echo $myvar1\n  echo $myvar2\n  echo $var1\n  echo ${var4}\n  echo ${var1:defaultValue}\n  echo ${var1}\n  echo ${var1:${fallback}}\n  echo ${var1:$var2$var3}\n```\n\nIf a variable needs to be passed without expansion, it can be escaped with\n`$$`:\n\n - `$$var`\n - `$${var}`\n\n\n# TODO\n\n - [x] Implement basic syntax parsing\n - [x] Add ability to execute syntax in parallel\n - [x] Add support for dependent targets\n - [x] Add ability to load custom files\n - [x] Add wildcard support\n - [x] Add support command line continuation via `\\`\n - [x] Add support for different types of child_process stdio attachments\n - [x] Add support for comments beginning with `#`\n - [x] Add ability to replace environment variables\n - [x] Add ability to specify subprocess environment variables at the end\n - [x] Add ability to define env variables from within a `Buildfile`\n - [ ] Make error message during variable substitution more helpful\n\nHave an idea? Let me know!\n\n# License\n\nMIT\n\n[phony]: https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremija%2Fbuildfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeremija%2Fbuildfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremija%2Fbuildfile/lists"}