@netlify/build-info
Advanced tools
Comparing version 1.1.0 to 1.1.1
# 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 @@ |
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9843
95
77
0