{"id":19486227,"url":"https://github.com/textbook/build-info","last_synced_at":"2026-01-21T00:07:54.850Z","repository":{"id":43818373,"uuid":"510866587","full_name":"textbook/build-info","owner":"textbook","description":"Generate build information for tracking deployments","archived":false,"fork":false,"pushed_at":"2024-07-09T21:57:26.000Z","size":432,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-16T14:40:04.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@textbook/build-info","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/textbook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"textbook"}},"created_at":"2022-07-05T19:18:18.000Z","updated_at":"2024-07-09T21:57:27.000Z","dependencies_parsed_at":"2023-01-20T08:15:11.165Z","dependency_job_id":"1eed064b-c534-40a4-a303-48eee884912e","html_url":"https://github.com/textbook/build-info","commit_stats":{"total_commits":73,"total_committers":1,"mean_commits":73.0,"dds":0.0,"last_synced_commit":"d469e233619e8cd930d0bdeebb9cad9803c2f24f"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textbook%2Fbuild-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textbook%2Fbuild-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textbook%2Fbuild-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textbook%2Fbuild-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/textbook","download_url":"https://codeload.github.com/textbook/build-info/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241592226,"owners_count":19987323,"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":[],"created_at":"2024-11-10T20:35:43.663Z","updated_at":"2026-01-21T00:07:54.843Z","avatar_url":"https://github.com/textbook.png","language":"TypeScript","funding_links":["https://ko-fi.com/textbook"],"categories":[],"sub_categories":[],"readme":"# `@textbook/build-info`\n\n[![Node.js CI][actions-badge]][actions-link]\n[![NPM release][npm-badge]][npm-link]\n[![Maintainability Rating][sonar-badge]][sonar-link]\n\nGenerate build information for tracking deployments.\n\n## Sources\n\n`buildinfo` has numerous sources, each of which is automatically enabled, if appropriate, in the following order:\n\n- **Clock** - includes the build time\n- **User** - includes the identity of the user\n- **Git** - includes the commit the build was based on and a summary of any changes from it\n- **Heroku** - includes the fact that it was built in Heroku, for which stack and from which commit\n- **GitHub Actions** - includes the build number and URL\n- **CircleCI** - includes the build number and URL\n- **Netlify** - includes the build number and URL\n\n## Usage\n\nYou can install this package using e.g. NPM:\n\n```shell\nnpm install --save-dev @textbook/build-info\n```\n\nand then use it in your scripts in `package.json`:\n\n```json5\n{\n  // ...\n  \"scripts\": {\n    // ...\n    \"build\": \"\u003cdo your build\u003e\",\n    \"postbuild\": \"buildinfo -o path/to/build-info.txt\",\n    // ...\n  }\n}\n```\n\nThis will generate a file like the following:\n\n```\nBuilt: 2022-07-07T20:17:55.213Z\nBy: jonrsharpe\nFrom: 3f27baa Refactor sources in subdirectory\n```\n\nYou can also run it without installation via [NPX]:\n\n```shell\n$ npx --package @textbook/build-info buildinfo -o path/to/file.txt\nNeed to install the following packages:\n  @textbook/build-info\nOk to proceed? (y)\n```\n\n_(you can suppress the confirmation with the `--yes` flag)_.\n\n#### Arguments\n\n- `-f`/`--format` - the format to provide data in (one of `html`, `json`, `text`; default: `text`)\n- `-h`/`--help` - show a help message and exit\n- `-o`/`--output` - the file to write data to\n- `-v`/`--version` - show the version and exit\n\n### Stdout\n\nIf you don't supply the `--output` argument (or supply the argument with the value `-`), data will be written to\nstdout, allowing redirection:\n\n```json5\n{\n  // ...\n  \"scripts\": {\n    // ...\n    \"build\": \"\u003cdo your build\u003e\",\n    \"postbuild\": \"buildinfo \u003e path/to/build-info.txt\",\n    // ...\n  }\n}\n```\n\n## Vite/Rollup plugin\n\n_Since v1.4.0._\n\nThis package also provides a Rollup plugin, which is compatible with Vite, to add an info file to the build outputs.\n\n```javascript\nimport buildInfo from \"@textbook/build-info/rollup-plugin\";\nimport { defineConfig } from \"vite\";\n\nexport default defineConfig({\n  plugins: [buildInfo({ filename: \"buildinfo.txt\" }), /* ... */],\n  // ...\n});\n```\n\n#### Options\n\n- `filename`: the name of the file to emit to the build outputs\n\n    The appropriate format will be detected from the extension:\n\n    - `.html` files get HTML format;\n    - `.json` files get JSON format;\n    - all others get text format.\n\n- `format` (optional): override extension detection, one of `\"html\"`, `\"json\"` or `\"text\"`\n\n### Compatibility\n\nThe emitted code targets Node from at least 18.3 (see `engines` field in `package.json`). It is tested on the latest\neven-numbered versions of Node (currently 18, 20 and 22) in Ubuntu (22.04) and Windows (Server 2022).\n\n## Development\n\nClone the repository, then install the dependencies using `npm install` or `npm ci`.\n\nYou can create a new build information source by implementing `Source`, and optionally extend `Cmd` or `Env` to run\nterminal commands or access environment variables respectively.\n\n### Scripts\n\nThe following scripts are provided to aid development:\n\n- `npm run lint`: Applies linting using [ESLint]\n\n- `npm run dev`: Runs the app without building it first and restarts on changes\n\n- `npm run test`: Runs tests using [Mocha], [Chai] and [Sinon])\n\n    - `npm run test:coverage`: Runs the tests with coverage using [c8]\n\n- `npm run e2e`: Builds the library with [TypeScript] and runs it, generating `out.txt`\n\n[actions-badge]: https://github.com/textbook/build-info/actions/workflows/push.yml/badge.svg\n[actions-link]: https://github.com/textbook/build-info/actions/workflows/push.yml\n[c8]: https://www.npmjs.com/package/c8\n[chai]: https://www.chaijs.com/\n[eslint]: https://eslint.org/\n[mocha]: https://mochajs.org/\n[npm-badge]: https://img.shields.io/npm/v/@textbook/build-info?logo=npm\u0026color=blue\n[npm-link]: https://www.npmjs.com/package/@textbook/build-info\n[npx]: https://docs.npmjs.com/cli/v8/commands/npx\n[sinon]: https://sinonjs.org/\n[sonar-badge]: https://sonarcloud.io/api/project_badges/measure?project=textbook_build-info\u0026metric=sqale_rating\n[sonar-link]: https://sonarcloud.io/summary/new_code?id=textbook_build-info\n[typescript]: https://www.typescriptlang.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftextbook%2Fbuild-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftextbook%2Fbuild-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftextbook%2Fbuild-info/lists"}