@netlify/build-info
TypeScript icon, indicating that this package has built-in type declarations

7.13.2 • Public • Published

Build Info

Build info is the core part of detecting settings and heuristics about the users code. The library is platform agnostic to be used in our React UI, Node.js CLI and build system.

It provides a layered approach to detecting the following information:

  1. Package Manager
  2. Workspaces (pnpm, yarn, npm)
  3. Build Systems
  4. Frameworks
  5. Build Settings

How to use it: First of all, you need to create a FileSystem that works for your platform. For Node.js we ship already one that can be used: For other platforms, a file system needs to implement the FileSystem interface:

import { FileSystem } from '@netlify/build-info'

export class WebFS extends FileSystem {
  // ...
}

After that the core piece is the Project that needs to be initialized with a file system, the base directory and an optional repository root.

It is important to note that setting a node version is important for some frameworks to load the correct plugins.

const project = new Project(fs, baseDir, root).setEnvironment(process.env).setNodeVersion(process.version)

after that on the project, we can call multiple methods like getBuildSettings which is running all the other steps as well.

Example (CLI)

# will use the current working directory as base directory
$ build-info

$ build-info /project/root/dir

$ build-info path/to/site --rootDir /project/root/dir

Contributors

Please see CONTRIBUTING.md for instructions on how to set up and work on this repository. Thanks for contributing!

Readme

Keywords

none

Package Sidebar

Install

npm i @netlify/build-info

Weekly Downloads

92,411

Version

7.13.2

License

MIT

Unpacked Size

318 kB

Total Files

290

Last publish

Collaborators

  • youvalv
  • berdav
  • vitaliyr
  • smnh
  • denar90
  • kathmbeck
  • rj-netlify
  • akardet
  • pieh
  • hrishikeshk
  • sarahetter
  • orinokai
  • ericap
  • seanroberts
  • skn0tt
  • mikewen
  • biilmann
  • marcus.netlify
  • jgantunes
  • eduardoboucas
  • netlify-bot
  • nasiba
  • ascorbic