@netlify/config 20.17.0 → 20.18.0
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/api/site_info.js +2 -1
- package/lib/env/main.d.ts +2 -1
- package/lib/env/main.js +16 -1
- package/lib/main.js +1 -0
- package/package.json +2 -2
package/lib/api/site_info.js
CHANGED
|
@@ -92,8 +92,9 @@ const getIntegrations = async function ({ siteId, accountId, testOpts, offline,
|
|
|
92
92
|
}
|
|
93
93
|
const { host } = testOpts;
|
|
94
94
|
const baseUrl = new URL(host ? `http://${host}` : `https://api.netlifysdk.com`);
|
|
95
|
+
// use future state feature flag
|
|
95
96
|
const url = useV2Endpoint
|
|
96
|
-
? `${baseUrl}team/${accountId}/integrations/installations/meta
|
|
97
|
+
? `${baseUrl}team/${accountId}/integrations/installations/meta/${siteId}`
|
|
97
98
|
: `${baseUrl}site/${siteId}/integrations/safe`;
|
|
98
99
|
try {
|
|
99
100
|
const response = await fetch(url);
|
package/lib/env/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getEnv: ({ api, mode, config, siteInfo, accounts, addons, buildDir, branch, deployId, buildId, context, }: {
|
|
1
|
+
export declare const getEnv: ({ api, mode, config, siteInfo, accounts, addons, buildDir, branch, deployId, buildId, context, cachedEnv, }: {
|
|
2
2
|
api: any;
|
|
3
3
|
mode: any;
|
|
4
4
|
config: any;
|
|
@@ -10,4 +10,5 @@ export declare const getEnv: ({ api, mode, config, siteInfo, accounts, addons, b
|
|
|
10
10
|
deployId: any;
|
|
11
11
|
buildId: any;
|
|
12
12
|
context: any;
|
|
13
|
+
cachedEnv: any;
|
|
13
14
|
}) => Promise<any>;
|
package/lib/env/main.js
CHANGED
|
@@ -8,10 +8,11 @@ import { getGitEnv } from './git.js';
|
|
|
8
8
|
// meant so that local builds can mimic production builds
|
|
9
9
|
// TODO: add `netlify.toml` `build.environment`, after normalization
|
|
10
10
|
// TODO: add `CONTEXT` and others
|
|
11
|
-
export const getEnv = async function ({ api, mode, config, siteInfo, accounts, addons, buildDir, branch, deployId, buildId, context, }) {
|
|
11
|
+
export const getEnv = async function ({ api, mode, config, siteInfo, accounts, addons, buildDir, branch, deployId, buildId, context, cachedEnv, }) {
|
|
12
12
|
if (mode === 'buildbot') {
|
|
13
13
|
return {};
|
|
14
14
|
}
|
|
15
|
+
const internalEnv = getInternalEnv(cachedEnv);
|
|
15
16
|
const generalEnv = await getGeneralEnv({ siteInfo, buildDir, branch, deployId, buildId, context });
|
|
16
17
|
const [accountEnv, addonsEnv, uiEnv, configFileEnv] = await getUserEnv({
|
|
17
18
|
api,
|
|
@@ -28,6 +29,7 @@ export const getEnv = async function ({ api, mode, config, siteInfo, accounts, a
|
|
|
28
29
|
{ key: 'addons', values: addonsEnv },
|
|
29
30
|
{ key: 'account', values: accountEnv },
|
|
30
31
|
{ key: 'general', values: generalEnv },
|
|
32
|
+
{ key: 'internal', values: internalEnv },
|
|
31
33
|
];
|
|
32
34
|
// A hash mapping names of environment variables to objects containing the following properties:
|
|
33
35
|
// - sources: List of sources where the environment variable was found. The first element is the source that
|
|
@@ -85,6 +87,19 @@ const getGeneralEnv = async function ({ siteInfo, siteInfo: { id, name }, buildD
|
|
|
85
87
|
NEXT_TELEMETRY_DISABLED: '1',
|
|
86
88
|
});
|
|
87
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve internal environment variables (needed for the CLI).
|
|
92
|
+
* Based on the cached environment, it returns the internal environment variables.
|
|
93
|
+
* Internal environment variables are those that are set by the CLI and are not retrieved by Envelope or the API.
|
|
94
|
+
*/
|
|
95
|
+
const getInternalEnv = function (cachedEnv) {
|
|
96
|
+
return Object.entries(cachedEnv).reduce((prev, [key, { sources, value }]) => {
|
|
97
|
+
if (sources.includes('internal')) {
|
|
98
|
+
prev[key] = value;
|
|
99
|
+
}
|
|
100
|
+
return prev;
|
|
101
|
+
}, {});
|
|
102
|
+
};
|
|
88
103
|
const getDeployUrls = function ({ siteInfo: { name = DEFAULT_SITE_NAME, ssl_url: sslUrl, build_settings: { repo_url: REPOSITORY_URL = undefined } = {}, }, branch, deployId, }) {
|
|
89
104
|
return {
|
|
90
105
|
URL: sslUrl,
|
package/lib/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.18.0",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": "^14.16.0 || >=16.0.0"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "507a010535ba4028153a755b397501109fa872c9"
|
|
99
99
|
}
|