Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@netlify/build-info

Package Overview
Dependencies
Maintainers
15
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/build-info - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

8

CHANGELOG.md
# Changelog
### [1.1.1](https://www.github.com/netlify/build-info/compare/v1.1.0...v1.1.1) (2021-04-07)
### Bug Fixes
* **context:** make projectDir resolution based on rootDir ([#26](https://www.github.com/netlify/build-info/issues/26)) ([2a965b4](https://www.github.com/netlify/build-info/commit/2a965b4c973c7e3f0867a321422eb40dcfd82926))
* **package.json:** add main entrypoint ([#30](https://www.github.com/netlify/build-info/issues/30)) ([cc55a9e](https://www.github.com/netlify/build-info/commit/cc55a9e6da9a3be6d6a33c74f38ab35796e9e882))
## [1.1.0](https://www.github.com/netlify/build-info/compare/v1.0.0...v1.1.0) (2021-04-05)

@@ -4,0 +12,0 @@

3

package.json
{
"name": "@netlify/build-info",
"version": "1.1.0",
"version": "1.1.1",
"description": "Build info utility",
"main": "./src/main.js",
"bin": {

@@ -6,0 +7,0 @@ "build-info": "./src/bin.js"

[![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 Info
Update me!
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`](https://docs.npmjs.com/cli/v7/using-npm/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](https://github.com/netlify/framework-info) and most likely only kept within [`build-image`](https://github.com/netlify/build-image/blob/xenial/run-build-functions.sh#L214).
# Example (Node.js)
```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)
```bash
$ 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

@@ -9,0 +74,0 @@

@@ -19,5 +19,7 @@ const { resolve } = require('path')

const getContext = async function ({ projectDir = cwd(), rootDir } = {}) {
const getContext = async function ({ projectDir = cwd(), rootDir = '' } = {}) {
// Get the absolute dirs for both project and root
const absoluteProjectDir = resolve(cwd(), projectDir)
// We resolve the projectDir from the rootDir
const absoluteProjectDir = resolve(rootDir, projectDir)
// If a relative absolute path is given we rely on cwd
const absoluteRootDir = rootDir ? resolve(cwd(), rootDir) : undefined

@@ -24,0 +26,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc