@netlify/config 23.0.9 → 23.0.11

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/log/logger.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import figures from 'figures';
2
- import { serializeObject } from './serialize.js';
2
+ import { serializeObject } from '../../lib/log/serialize.js';
3
3
  import { THEME } from './theme.js';
4
4
  export const logsAreBuffered = (logs) => {
5
5
  return logs !== undefined && 'stdout' in logs;
@@ -1 +1 @@
1
- export function serializeObject(object: any): any;
1
+ export declare const serializeObject: (object: object) => string;
@@ -1,4 +1,4 @@
1
- import { dump } from 'js-yaml';
1
+ import { stringify } from 'yaml';
2
2
  export const serializeObject = function (object) {
3
- return dump(object, { noRefs: true, sortKeys: true, lineWidth: Number.POSITIVE_INFINITY }).trimEnd();
3
+ return stringify(object, { sortMapEntries: true }).trimEnd();
4
4
  };
package/lib/main.js CHANGED
@@ -113,6 +113,7 @@ export const resolveConfig = async function (opts) {
113
113
  testOpts,
114
114
  offline,
115
115
  mode,
116
+ debug,
116
117
  });
117
118
  const mergedIntegrations = await mergeIntegrations({
118
119
  apiIntegrations: updatedIntegrations,
@@ -11,6 +11,7 @@ interface AutoInstallOptions {
11
11
  testOpts: any;
12
12
  mode: ModeOption;
13
13
  extensionApiBaseUrl: string;
14
+ debug?: boolean;
14
15
  }
15
- export declare function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token, buildDir, integrations, offline, testOpts, mode, extensionApiBaseUrl, }: AutoInstallOptions): Promise<IntegrationResponse[]>;
16
+ export declare function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token, buildDir, integrations, offline, testOpts, mode, extensionApiBaseUrl, debug, }: AutoInstallOptions): Promise<IntegrationResponse[]>;
16
17
  export {};
@@ -12,58 +12,29 @@ function getPackageJSON(directory) {
12
12
  return {};
13
13
  }
14
14
  }
15
- export async function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token, buildDir, integrations, offline, testOpts = {}, mode, extensionApiBaseUrl, }) {
16
- if (!featureFlags?.auto_install_required_extensions) {
15
+ export async function handleAutoInstallExtensions({ featureFlags, siteId, accountId, token, buildDir, integrations, offline, testOpts = {}, mode, extensionApiBaseUrl, debug = false, }) {
16
+ if (!featureFlags?.auto_install_required_extensions_v2) {
17
17
  return integrations;
18
18
  }
19
- if (!accountId) {
20
- console.error("Failed to auto install extension(s): Missing 'accountId'", {
21
- accountId,
22
- siteId,
23
- buildDir,
24
- offline,
25
- mode,
26
- });
27
- return integrations;
28
- }
29
- if (!siteId) {
30
- console.error("Failed to auto install extension(s): Missing 'siteId'", {
31
- accountId,
32
- siteId,
33
- buildDir,
34
- offline,
35
- mode,
36
- });
37
- return integrations;
38
- }
39
- if (!token) {
40
- console.error("Failed to auto install extension(s): Missing 'token'", {
41
- accountId,
42
- siteId,
43
- buildDir,
44
- offline,
45
- mode,
46
- });
47
- return integrations;
48
- }
49
- if (!buildDir) {
50
- console.error("Failed to auto install extension(s): Missing 'buildDir'", {
51
- accountId,
52
- siteId,
53
- buildDir,
54
- offline,
55
- mode,
56
- });
57
- return integrations;
58
- }
59
- if (offline) {
60
- console.error("Failed to auto install extension(s): Running as 'offline'", {
61
- accountId,
62
- siteId,
63
- buildDir,
64
- offline,
65
- mode,
66
- });
19
+ if (!accountId || !siteId || !token || !buildDir || offline) {
20
+ const reason = !accountId
21
+ ? 'Missing accountId'
22
+ : !siteId
23
+ ? 'Missing siteId'
24
+ : !token
25
+ ? 'Missing token'
26
+ : !buildDir
27
+ ? 'Missing buildDir'
28
+ : 'Running as offline';
29
+ if (debug) {
30
+ console.error(`Failed to auto install extension(s): ${reason}`, {
31
+ accountId,
32
+ siteId,
33
+ buildDir,
34
+ offline,
35
+ mode,
36
+ });
37
+ }
67
38
  return integrations;
68
39
  }
69
40
  try {
@@ -34,11 +34,17 @@ export const installExtension = async ({ netlifyToken, accountId, slug, hostSite
34
34
  * @returns Array of extensions with their associated packages
35
35
  */
36
36
  export async function fetchAutoInstallableExtensionsMeta() {
37
- const url = new URL(`/meta/auto-installable`, process.env.EXTENSION_API_BASE_URL ?? EXTENSION_API_BASE_URL);
38
- const response = await fetch(url.toString());
39
- if (!response.ok) {
40
- throw new Error(`Failed to fetch extensions meta`);
37
+ try {
38
+ const url = new URL(`/meta/auto-installable`, process.env.EXTENSION_API_BASE_URL ?? EXTENSION_API_BASE_URL);
39
+ const response = await fetch(url.toString());
40
+ if (!response.ok) {
41
+ throw new Error(`Failed to fetch extensions meta`);
42
+ }
43
+ const data = await response.json();
44
+ return data;
45
+ }
46
+ catch (error) {
47
+ console.error(`Failed to fetch auto-installable extensions meta: ${error.message}`, error);
48
+ return [];
41
49
  }
42
- const data = await response.json();
43
- return data;
44
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/config",
3
- "version": "23.0.9",
3
+ "version": "23.0.11",
4
4
  "description": "Netlify config module",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -73,17 +73,17 @@
73
73
  "find-up": "^7.0.0",
74
74
  "indent-string": "^5.0.0",
75
75
  "is-plain-obj": "^4.0.0",
76
- "js-yaml": "^4.0.0",
77
76
  "map-obj": "^5.0.0",
78
77
  "omit.js": "^2.0.2",
79
78
  "p-locate": "^6.0.0",
80
79
  "path-type": "^6.0.0",
81
80
  "tomlify-j0.4": "^3.0.0",
82
81
  "validate-npm-package-name": "^5.0.0",
82
+ "yaml": "^2.8.0",
83
83
  "yargs": "^17.6.0"
84
84
  },
85
85
  "devDependencies": {
86
- "@types/node": "^18.0.0",
86
+ "@types/node": "^18.19.111",
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": "44309b889269b8555b19127ed9988bc5972cb4ec"
97
+ "gitHead": "e663c8f1a5667e6737c689c33f7cabd6b2a98774"
98
98
  }