@netlify/build-info 5.1.1-rc.2 → 5.1.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ export declare class BuildInfo {
2
+ repositoryRoot: string;
3
+ constructor(
4
+ /** This is an absolute path to the repository */
5
+ repositoryRoot?: string,
6
+ /** Is a relative path from the repository root to the sub packages (mostly used inside mono repositories) */
7
+ packagePath?: string);
8
+ toJSON(): {};
9
+ }
@@ -0,0 +1,27 @@
1
+ export class BuildInfo {
2
+ repositoryRoot;
3
+ constructor(
4
+ /** This is an absolute path to the repository */
5
+ repositoryRoot = process.cwd(),
6
+ /** Is a relative path from the repository root to the sub packages (mostly used inside mono repositories) */
7
+ packagePath) {
8
+ // const absoluteProjectDir = resolve(rootDir, projectDir)
9
+ // // If a relative absolute path is given we rely on cwd
10
+ // const absoluteRootDir = rootDir ? resolve(cwd(), rootDir) : undefined
11
+ // // We only pass through the root dir if it was provided and is actually different
12
+ // // from the project dir
13
+ // const validRootDir = absoluteRootDir && absoluteRootDir !== absoluteProjectDir ? absoluteRootDir : undefined
14
+ // // If rootDir equals projectDir we'll be getting the projectDir package.json
15
+ // // Later on if we also need the projectDir package.json we can check for it
16
+ // // and only perform one resolution
17
+ // const rootPackageJson = await getPackageJson(rootDir || projectDir)
18
+ // return {
19
+ // projectDir: absoluteProjectDir,
20
+ // rootDir: validRootDir,
21
+ // rootPackageJson,
22
+ // }
23
+ }
24
+ toJSON() {
25
+ return {};
26
+ }
27
+ }
package/lib/core.js CHANGED
@@ -6,7 +6,7 @@ export const buildInfo = async function (context) {
6
6
  const jsWorkspaces = workspaceInfo ? { jsWorkspaces: workspaceInfo } : {};
7
7
  const frameworks = await listFrameworks({ projectDir: context.projectDir });
8
8
  if (Object.keys(context.rootPackageJson).length > 0) {
9
- jsWorkspaces.packageManager = detectPackageManager(context.projectDir);
9
+ jsWorkspaces.packageManager = await detectPackageManager(context.projectDir);
10
10
  }
11
11
  return { ...jsWorkspaces, frameworks };
12
12
  };
@@ -46,8 +46,10 @@ export const detectPackageManager = async (cwd) => {
46
46
  // return the found package manager
47
47
  if (lockFilePath) {
48
48
  const lockFile = basename(lockFilePath);
49
- if (lockFileMap[lockFile].forceEnvironment !== 'false') {
50
- return lockFileMap[lockFile];
49
+ const pkgM = lockFileMap[lockFile];
50
+ // check if it not got disabled
51
+ if (!(pkgM.forceEnvironment && process.env[pkgM.forceEnvironment] === 'false')) {
52
+ return pkgM;
51
53
  }
52
54
  }
53
55
  const pkgPaths = await findUpMultiple('package.json', { cwd });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build-info",
3
- "version": "5.1.1-rc.2",
3
+ "version": "5.1.1-rc.3",
4
4
  "description": "Build info utility",
5
5
  "type": "module",
6
6
  "exports": "./lib/main.js",