@netlify/build-info 6.0.8-rc → 6.0.8
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.
- package/lib/bin.js +0 -0
- package/lib/get-build-info.d.ts +0 -2
- package/lib/get-build-info.js +0 -5
- package/package.json +4 -3
- package/lib/detect-build-system.d.ts +0 -5
- package/lib/detect-build-system.js +0 -117
package/lib/bin.js
CHANGED
|
File without changes
|
package/lib/get-build-info.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ContextOptions } from './context.js';
|
|
2
|
-
import { BuildSystem } from './detect-build-system.js';
|
|
3
2
|
import { PkgManagerFields } from './detect-package-manager.js';
|
|
4
3
|
import { WorkspaceInfo } from './workspaces.js';
|
|
5
4
|
export declare type Info = {
|
|
6
5
|
jsWorkspaces?: WorkspaceInfo;
|
|
7
6
|
packageManager?: PkgManagerFields;
|
|
8
7
|
frameworks: unknown[];
|
|
9
|
-
buildSystems?: BuildSystem[];
|
|
10
8
|
};
|
|
11
9
|
export declare const getBuildInfo: (opts: ContextOptions) => Promise<Info>;
|
package/lib/get-build-info.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { listFrameworks } from '@netlify/framework-info';
|
|
2
2
|
import { getContext } from './context.js';
|
|
3
|
-
import { detectBuildSystems } from './detect-build-system.js';
|
|
4
3
|
import { detectPackageManager } from './detect-package-manager.js';
|
|
5
4
|
import { getWorkspaceInfo } from './workspaces.js';
|
|
6
5
|
export const getBuildInfo = async (opts) => {
|
|
@@ -24,9 +23,5 @@ export const getBuildInfo = async (opts) => {
|
|
|
24
23
|
info.jsWorkspaces = workspaceInfo;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
const buildSystems = await detectBuildSystems(context.projectDir, context.rootDir);
|
|
28
|
-
if (buildSystems.length > 0) {
|
|
29
|
-
info.buildSystems = buildSystems;
|
|
30
|
-
}
|
|
31
26
|
return info;
|
|
32
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build-info",
|
|
3
|
-
"version": "6.0.8
|
|
3
|
+
"version": "6.0.8",
|
|
4
4
|
"description": "Build info utility",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Netlify Inc.",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@netlify/framework-info": "^9.5.
|
|
33
|
+
"@netlify/framework-info": "^9.5.3",
|
|
34
34
|
"@npmcli/map-workspaces": "^2.0.0",
|
|
35
35
|
"find-up": "^6.3.0",
|
|
36
36
|
"read-pkg": "^7.1.0",
|
|
@@ -51,5 +51,6 @@
|
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": "^14.16.0 || >=16.0.0"
|
|
54
|
-
}
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "b33663b6af4bd9acb552af1d17673679acb2ef75"
|
|
55
56
|
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { findUpSync } from 'find-up';
|
|
4
|
-
export const detectBuildSystems = async (baseDir, rootDir) => {
|
|
5
|
-
const buildTools = Object.keys(BUILD_SYSTEMS);
|
|
6
|
-
const buildSystems = await Promise.all(buildTools.map(async (tool) => await BUILD_SYSTEMS[tool](baseDir, rootDir)));
|
|
7
|
-
return buildSystems.reduce((res, tool) => {
|
|
8
|
-
if (tool) {
|
|
9
|
-
res.push(tool);
|
|
10
|
-
}
|
|
11
|
-
return res;
|
|
12
|
-
}, []);
|
|
13
|
-
};
|
|
14
|
-
const BUILD_SYSTEMS = {
|
|
15
|
-
nx: async (baseDir, rootDir) => {
|
|
16
|
-
const nx = ['nx.json'];
|
|
17
|
-
const nxConfigPath = lookFor(nx, baseDir, rootDir);
|
|
18
|
-
if (nxConfigPath) {
|
|
19
|
-
const pkgJson = getPkgJson(nxConfigPath);
|
|
20
|
-
const { devDependencies } = pkgJson;
|
|
21
|
-
return Promise.resolve({
|
|
22
|
-
name: 'nx',
|
|
23
|
-
version: devDependencies?.nx,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
lerna: async (baseDir, rootDir) => {
|
|
28
|
-
const lerna = ['lerna.json'];
|
|
29
|
-
const lernaConfigPath = lookFor(lerna, baseDir, rootDir);
|
|
30
|
-
if (lernaConfigPath) {
|
|
31
|
-
const pkgJson = getPkgJson(lernaConfigPath);
|
|
32
|
-
const { devDependencies } = pkgJson;
|
|
33
|
-
return Promise.resolve({
|
|
34
|
-
name: 'lerna',
|
|
35
|
-
version: devDependencies?.lerna,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
turbo: async (baseDir, rootDir) => {
|
|
40
|
-
const turbo = ['turbo.json'];
|
|
41
|
-
const turboConfigPath = lookFor(turbo, baseDir, rootDir);
|
|
42
|
-
if (turboConfigPath) {
|
|
43
|
-
const pkgJson = getPkgJson(turboConfigPath);
|
|
44
|
-
const { devDependencies } = pkgJson;
|
|
45
|
-
return Promise.resolve({
|
|
46
|
-
name: 'turbo',
|
|
47
|
-
version: devDependencies?.turbo,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
rush: async (baseDir, rootDir) => {
|
|
52
|
-
const rush = ['rush.json'];
|
|
53
|
-
const rushConfigPath = lookFor(rush, baseDir, rootDir);
|
|
54
|
-
if (rushConfigPath) {
|
|
55
|
-
const pkgJson = getPkgJson(rushConfigPath);
|
|
56
|
-
const { devDependencies } = pkgJson;
|
|
57
|
-
return Promise.resolve({
|
|
58
|
-
name: 'rush',
|
|
59
|
-
version: devDependencies?.rush,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
lage: async (baseDir, rootDir) => {
|
|
64
|
-
const lage = ['lage.config.js'];
|
|
65
|
-
const lageConfigPath = lookFor(lage, baseDir, rootDir);
|
|
66
|
-
if (lageConfigPath) {
|
|
67
|
-
const pkgJson = getPkgJson(lageConfigPath);
|
|
68
|
-
const { devDependencies } = pkgJson;
|
|
69
|
-
return Promise.resolve({
|
|
70
|
-
name: 'lage',
|
|
71
|
-
version: devDependencies?.lage,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
pants: async (baseDir, rootDir) => {
|
|
76
|
-
const pants = ['pants.toml'];
|
|
77
|
-
const pantsConfigPath = lookFor(pants, baseDir, rootDir);
|
|
78
|
-
if (pantsConfigPath) {
|
|
79
|
-
return Promise.resolve({
|
|
80
|
-
name: 'pants',
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
buck: async (baseDir, rootDir) => {
|
|
85
|
-
const buck = ['.buckconfig', 'BUCK'];
|
|
86
|
-
const buckConfigPath = lookFor(buck, baseDir, rootDir);
|
|
87
|
-
if (buckConfigPath) {
|
|
88
|
-
return Promise.resolve({
|
|
89
|
-
name: 'buck',
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
gradle: async (baseDir, rootDir) => {
|
|
94
|
-
const gradle = ['build.gradle'];
|
|
95
|
-
const gradleConfigPath = lookFor(gradle, baseDir, rootDir);
|
|
96
|
-
if (gradleConfigPath) {
|
|
97
|
-
return Promise.resolve({
|
|
98
|
-
name: 'gradle',
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
bazel: async (baseDir, rootDir) => {
|
|
103
|
-
const bazel = ['.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel'];
|
|
104
|
-
const bazelConfigPath = lookFor(bazel, baseDir, rootDir);
|
|
105
|
-
if (bazelConfigPath) {
|
|
106
|
-
return Promise.resolve({
|
|
107
|
-
name: 'bazel',
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
const lookFor = (configFile, baseDir, rootDir) => {
|
|
113
|
-
return findUpSync(configFile, { cwd: baseDir, stopAt: rootDir });
|
|
114
|
-
};
|
|
115
|
-
const getPkgJson = (configPath) => {
|
|
116
|
-
return JSON.parse(readFileSync(path.join(path.dirname(configPath), 'package.json'), 'utf-8'));
|
|
117
|
-
};
|