JSPM

  • Created
  • Published
  • Downloads 158512
  • Score
    100M100P100Q171463F
  • License MIT

Build info utility

Package Exports

  • @netlify/build-info

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@netlify/build-info) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Node

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 only used to detect workspaces, however one can easily extend it to detected other things such as package managers used, or other pieces of info not given by @netlify/framework-info and most likely only kept within build-image.

Example (Node.js)

const { getBuildInfo } = require('./src/main')

(async () => {
  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'
  //     ]
  //   }
  // }

  console.log(await getBuildInfo({ projectDir: '/project/root/dir' }))
  // {
  //   jsWorkspaces: {
  //     isRoot: true,
  //     packages: [
  //       'path/to/site',
  //       'path/to/component/library'
  //       'path/to/utility/library'
  //     ]
  //   }
  // }
})();

Example (CLI)

$ build-info /project/root/dir
{
  jsWorkspaces: {
    isRoot: true,
    packages: [
      'path/to/site',
      'path/to/component/library'
      'path/to/utility/library'
    ]
  }
}

$ build-info path/to/site --rootDir /project/root/dir
{
  jsWorkspaces: {
    isRoot: false,
    packages: [
      'path/to/site',
      'path/to/component/library'
      'path/to/utility/library'
    ]
  }
}

Contributors

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