@netlify/config 23.0.7 → 23.0.9
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/main.js
CHANGED
|
@@ -5,12 +5,12 @@ interface AutoInstallOptions {
|
|
|
5
5
|
siteId: string;
|
|
6
6
|
accountId: string;
|
|
7
7
|
token: string;
|
|
8
|
-
|
|
8
|
+
buildDir: string;
|
|
9
9
|
integrations: IntegrationResponse[];
|
|
10
10
|
offline: boolean;
|
|
11
11
|
testOpts: any;
|
|
12
12
|
mode: ModeOption;
|
|
13
13
|
extensionApiBaseUrl: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token,
|
|
15
|
+
export declare function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token, buildDir, integrations, offline, testOpts, mode, extensionApiBaseUrl, }: AutoInstallOptions): Promise<IntegrationResponse[]>;
|
|
16
16
|
export {};
|
|
@@ -3,10 +3,16 @@ import { join } from 'path';
|
|
|
3
3
|
import { getIntegrations } from '../../api/site_info.js';
|
|
4
4
|
import { fetchAutoInstallableExtensionsMeta, installExtension } from './utils.js';
|
|
5
5
|
function getPackageJSON(directory) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
try {
|
|
7
|
+
const require = createRequire(join(directory, 'package.json'));
|
|
8
|
+
return require('./package.json');
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// Gracefully fail if no package.json found in buildDir
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
8
14
|
}
|
|
9
|
-
export async function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token,
|
|
15
|
+
export async function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token, buildDir, integrations, offline, testOpts = {}, mode, extensionApiBaseUrl, }) {
|
|
10
16
|
if (!featureFlags?.auto_install_required_extensions) {
|
|
11
17
|
return integrations;
|
|
12
18
|
}
|
|
@@ -14,7 +20,7 @@ export async function handleAutoInstallExtensions({ featureFlags, siteId, accoun
|
|
|
14
20
|
console.error("Failed to auto install extension(s): Missing 'accountId'", {
|
|
15
21
|
accountId,
|
|
16
22
|
siteId,
|
|
17
|
-
|
|
23
|
+
buildDir,
|
|
18
24
|
offline,
|
|
19
25
|
mode,
|
|
20
26
|
});
|
|
@@ -24,7 +30,7 @@ export async function handleAutoInstallExtensions({ featureFlags, siteId, accoun
|
|
|
24
30
|
console.error("Failed to auto install extension(s): Missing 'siteId'", {
|
|
25
31
|
accountId,
|
|
26
32
|
siteId,
|
|
27
|
-
|
|
33
|
+
buildDir,
|
|
28
34
|
offline,
|
|
29
35
|
mode,
|
|
30
36
|
});
|
|
@@ -34,17 +40,17 @@ export async function handleAutoInstallExtensions({ featureFlags, siteId, accoun
|
|
|
34
40
|
console.error("Failed to auto install extension(s): Missing 'token'", {
|
|
35
41
|
accountId,
|
|
36
42
|
siteId,
|
|
37
|
-
|
|
43
|
+
buildDir,
|
|
38
44
|
offline,
|
|
39
45
|
mode,
|
|
40
46
|
});
|
|
41
47
|
return integrations;
|
|
42
48
|
}
|
|
43
|
-
if (!
|
|
44
|
-
console.error("Failed to auto install extension(s): Missing '
|
|
49
|
+
if (!buildDir) {
|
|
50
|
+
console.error("Failed to auto install extension(s): Missing 'buildDir'", {
|
|
45
51
|
accountId,
|
|
46
52
|
siteId,
|
|
47
|
-
|
|
53
|
+
buildDir,
|
|
48
54
|
offline,
|
|
49
55
|
mode,
|
|
50
56
|
});
|
|
@@ -54,22 +60,29 @@ export async function handleAutoInstallExtensions({ featureFlags, siteId, accoun
|
|
|
54
60
|
console.error("Failed to auto install extension(s): Running as 'offline'", {
|
|
55
61
|
accountId,
|
|
56
62
|
siteId,
|
|
57
|
-
|
|
63
|
+
buildDir,
|
|
58
64
|
offline,
|
|
59
65
|
mode,
|
|
60
66
|
});
|
|
61
67
|
return integrations;
|
|
62
68
|
}
|
|
63
69
|
try {
|
|
64
|
-
const packageJson = getPackageJSON(
|
|
70
|
+
const packageJson = getPackageJSON(buildDir);
|
|
65
71
|
if (!packageJson?.dependencies ||
|
|
66
72
|
typeof packageJson?.dependencies !== 'object' ||
|
|
67
73
|
Object.keys(packageJson?.dependencies)?.length === 0) {
|
|
68
74
|
return integrations;
|
|
69
75
|
}
|
|
70
76
|
const autoInstallableExtensions = await fetchAutoInstallableExtensionsMeta();
|
|
71
|
-
const
|
|
72
|
-
|
|
77
|
+
const enabledExtensionSlugs = new Set((integrations ?? []).map(({ slug }) => slug));
|
|
78
|
+
const extensionsToInstallCandidates = autoInstallableExtensions.filter(({ slug }) => !enabledExtensionSlugs.has(slug));
|
|
79
|
+
const extensionsToInstall = extensionsToInstallCandidates.filter(({ packages }) => {
|
|
80
|
+
for (const pkg of packages) {
|
|
81
|
+
if (packageJson?.dependencies && Object.hasOwn(packageJson.dependencies, pkg)) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
73
86
|
});
|
|
74
87
|
if (extensionsToInstall.length === 0) {
|
|
75
88
|
return integrations;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.9",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"license": "MIT",
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@iarna/toml": "^2.2.5",
|
|
62
|
-
"@netlify/api": "^14.0.
|
|
63
|
-
"@netlify/headers-parser": "^9.0.
|
|
64
|
-
"@netlify/redirect-parser": "^15.0.
|
|
62
|
+
"@netlify/api": "^14.0.3",
|
|
63
|
+
"@netlify/headers-parser": "^9.0.1",
|
|
64
|
+
"@netlify/redirect-parser": "^15.0.2",
|
|
65
65
|
"chalk": "^5.0.0",
|
|
66
66
|
"cron-parser": "^4.1.0",
|
|
67
67
|
"deepmerge": "^4.2.2",
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
"p-locate": "^6.0.0",
|
|
80
80
|
"path-type": "^6.0.0",
|
|
81
81
|
"tomlify-j0.4": "^3.0.0",
|
|
82
|
-
"validate-npm-package-name": "^
|
|
82
|
+
"validate-npm-package-name": "^5.0.0",
|
|
83
83
|
"yargs": "^17.6.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@types/node": "^
|
|
86
|
+
"@types/node": "^18.0.0",
|
|
87
87
|
"ava": "^5.0.0",
|
|
88
88
|
"c8": "^10.0.0",
|
|
89
89
|
"has-ansi": "^6.0.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"engines": {
|
|
95
95
|
"node": ">=18.14.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "44309b889269b8555b19127ed9988bc5972cb4ec"
|
|
98
98
|
}
|