Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/netlify/build-info
Build info utility
https://github.com/netlify/build-info
Last synced: 7 days ago
JSON representation
Build info utility
- Host: GitHub
- URL: https://github.com/netlify/build-info
- Owner: netlify
- License: mit
- Archived: true
- Created: 2021-03-26T16:52:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-10T08:49:16.000Z (about 2 years ago)
- Last Synced: 2024-08-02T12:23:49.246Z (3 months ago)
- Language: JavaScript
- Size: 1.52 MB
- Stars: 5
- Watchers: 3
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
> ## !important Notice
>
> This repository was moved into the mono repository of [github.com/netlify/build](https://github.com/netlify/build)
> The package name and the versions are preserved![![Build](https://github.com/netlify/build-info/workflows/Build/badge.svg)](https://github.com/netlify/build-info/actions)
[![Node](https://img.shields.io/node/v/@netlify/build-info.svg?logo=node.js)](https://www.npmjs.com/package/@netlify/build-info)# Build Info
Build information detection utility.
The purpose of this lib is to, given a project and a configuration, return a set of useful data for our build system.
Currently it's used to detect:- [`jsWorkspaces`](https://docs.npmjs.com/cli/v7/using-npm/workspaces)
- [`frameworks`](https://github.com/netlify/framework-info)But it's possible to extend it in the future to extract other bits of information, such as the heuristics present in the
[`build-image`](https://github.com/netlify/build-image/blob/xenial/run-build-functions.sh#L214).# Example (Node.js)
```js
import { getBuildInfo } from '@netlify/build-info'console.log(await getBuildInfo({ projectDir: 'path/to/site', rootDir: '/project/root/dir' }))
// {
// jsWorkspaces: {
// isRoot: false,
// packages: [
// 'path/to/site',
// 'path/to/component/library'
// 'path/to/utility/library'
// ]
// },
// frameworks: [
// {
// name: 'gatsby',
// category: 'static_site_generator',
// dev: {
// commands: ['gatsby develop'],
// port: 8000
// },
// build: {
// commands: ['gatsby build'],
// directory: 'public'
// },
// env: { GATSBY_LOGGER: 'yurnalist' },
// plugins: []
// }
// ]
// }console.log(await getBuildInfo({ projectDir: '/project/root/dir' }))
// {
// jsWorkspaces: {
// isRoot: true,
// packages: [
// 'path/to/site',
// 'path/to/component/library'
// 'path/to/utility/library'
// ]
// },
// frameworks: []
// }
```# Example (CLI)
```bash
$ build-info /project/root/dir
{
jsWorkspaces: {
isRoot: true,
packages: [
'path/to/site',
'path/to/component/library'
'path/to/utility/library'
]
},
frameworks: []
}$ build-info path/to/site --rootDir /project/root/dir
{
jsWorkspaces: {
isRoot: false,
packages: [
'path/to/site',
'path/to/component/library'
'path/to/utility/library'
]
},
frameworks: [
{
name: 'gatsby',
category: 'static_site_generator',
dev: {
commands: ['gatsby develop'],
port: 8000
},
build: {
commands: ['gatsby build'],
directory: 'public'
},
env: { GATSBY_LOGGER: 'yurnalist' },
plugins: []
}
]
}
```## Contributors
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to set up and work on this repository. Thanks
for contributing!