netlify-cli 17.23.4 → 17.23.6
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/dist/commands/build/build.d.ts.map +1 -1
- package/dist/commands/build/build.js +6 -12
- package/dist/commands/deploy/deploy.d.ts.map +1 -1
- package/dist/commands/deploy/deploy.js +10 -13
- package/dist/commands/dev/dev-exec.d.ts.map +1 -1
- package/dist/commands/dev/dev-exec.js +3 -6
- package/dist/commands/dev/dev.d.ts.map +1 -1
- package/dist/commands/dev/dev.js +3 -3
- package/dist/commands/env/env-clone.d.ts.map +1 -1
- package/dist/commands/env/env-clone.js +3 -105
- package/dist/commands/env/env-get.d.ts.map +1 -1
- package/dist/commands/env/env-get.js +3 -9
- package/dist/commands/env/env-import.d.ts.map +1 -1
- package/dist/commands/env/env-import.js +2 -25
- package/dist/commands/env/env-list.d.ts.map +1 -1
- package/dist/commands/env/env-list.js +14 -17
- package/dist/commands/env/env-set.d.ts.map +1 -1
- package/dist/commands/env/env-set.js +1 -33
- package/dist/commands/env/env-unset.d.ts.map +1 -1
- package/dist/commands/env/env-unset.js +2 -34
- package/dist/commands/functions/functions-create.js +2 -3
- package/dist/commands/integration/deploy.d.ts.map +1 -1
- package/dist/commands/integration/deploy.js +5 -2
- package/dist/commands/serve/serve.js +1 -1
- package/dist/commands/sites/sites-create-template.d.ts.map +1 -1
- package/dist/commands/sites/sites-create-template.js +13 -2
- package/dist/lib/exec-fetcher.d.ts +1 -1
- package/dist/lib/exec-fetcher.d.ts.map +1 -1
- package/dist/lib/exec-fetcher.js +2 -3
- package/dist/lib/functions/registry.js +1 -1
- package/dist/lib/functions/runtimes/js/index.d.ts +7 -5
- package/dist/lib/functions/runtimes/js/index.d.ts.map +1 -1
- package/dist/lib/functions/runtimes/js/index.js +4 -3
- package/dist/lib/functions/server.d.ts.map +1 -1
- package/dist/lib/functions/server.js +10 -11
- package/dist/lib/geo-location.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/functions/functions.d.ts +3 -3
- package/dist/utils/functions/functions.d.ts.map +1 -1
- package/dist/utils/functions/functions.js +0 -3
- package/dist/utils/gh-auth.js +1 -1
- package/dist/utils/live-tunnel.d.ts.map +1 -1
- package/dist/utils/live-tunnel.js +5 -1
- package/dist/utils/proxy.d.ts.map +1 -1
- package/dist/utils/proxy.js +3 -4
- package/dist/utils/read-repo-url.d.ts +1 -1
- package/dist/utils/read-repo-url.d.ts.map +1 -1
- package/dist/utils/sites/utils.d.ts +2 -2
- package/dist/utils/sites/utils.d.ts.map +1 -1
- package/dist/utils/sites/utils.js +1 -0
- package/functions-templates/go/hello-world/go.mod +1 -1
- package/functions-templates/javascript/scheduled-function/package.json +1 -1
- package/functions-templates/javascript/submission-created/package.json +1 -1
- package/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/functions-templates/typescript/hello-world/package-lock.json +38 -121
- package/functions-templates/typescript/hello-world/package.json +2 -2
- package/functions-templates/typescript/scheduled-function/package.json +2 -2
- package/npm-shrinkwrap.json +2823 -2836
- package/package.json +26 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAMxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C;;GAEG;AAEH,eAAO,MAAM,YAAY;;;;;UAWxB,CAAA;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAMxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C;;GAEG;AAEH,eAAO,MAAM,YAAY;;;;;UAWxB,CAAA;AAED,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,kBAoCtE,CAAA"}
|
|
@@ -15,14 +15,6 @@ export const checkOptions = ({ cachedConfig: { siteInfo = {} }, token }) => {
|
|
|
15
15
|
error('Could not find the access token. Please run netlify login.');
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'command' implicitly has an 'any' type.
|
|
19
|
-
const injectEnv = async function (command, { api, buildOptions, context, siteInfo }) {
|
|
20
|
-
const isUsingEnvelope = siteInfo && siteInfo.use_envelope;
|
|
21
|
-
const { env } = buildOptions.cachedConfig;
|
|
22
|
-
if (isUsingEnvelope) {
|
|
23
|
-
buildOptions.cachedConfig.env = await getEnvelopeEnv({ api, context, env, siteInfo });
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
18
|
export const build = async (options, command) => {
|
|
27
19
|
const { cachedConfig, siteInfo } = command.netlify;
|
|
28
20
|
command.setAnalyticsPayload({ dry: options.dry });
|
|
@@ -45,10 +37,12 @@ export const build = async (options, command) => {
|
|
|
45
37
|
});
|
|
46
38
|
if (!options.offline) {
|
|
47
39
|
checkOptions(buildOptions);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
buildOptions.cachedConfig.env = await getEnvelopeEnv({
|
|
41
|
+
api: command.netlify.api,
|
|
42
|
+
context: options.context,
|
|
43
|
+
env: buildOptions.cachedConfig.env,
|
|
44
|
+
siteInfo,
|
|
45
|
+
});
|
|
52
46
|
}
|
|
53
47
|
const { exitCode } = await runBuild(buildOptions);
|
|
54
48
|
exit(exitCode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/deploy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAgCxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/deploy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAgCxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAouB5C,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,kBAmHvE,CAAA"}
|
|
@@ -14,7 +14,7 @@ import { featureFlags as edgeFunctionsFeatureFlags } from '../../lib/edge-functi
|
|
|
14
14
|
import { normalizeFunctionsConfig } from '../../lib/functions/config.js';
|
|
15
15
|
import { BACKGROUND_FUNCTIONS_WARNING } from '../../lib/log.js';
|
|
16
16
|
import { startSpinner, stopSpinner } from '../../lib/spinner.js';
|
|
17
|
-
import { chalk, error, exit, getToken, log, logJson,
|
|
17
|
+
import { NETLIFYDEV, NETLIFYDEVERR, NETLIFYDEVLOG, chalk, error, exit, getToken, log, logJson, warn, } from '../../utils/command-helpers.js';
|
|
18
18
|
import { DEFAULT_DEPLOY_TIMEOUT } from '../../utils/deploy/constants.js';
|
|
19
19
|
import { deploySite } from '../../utils/deploy/deploy-site.js';
|
|
20
20
|
import { getEnvelopeEnv } from '../../utils/env/index.js';
|
|
@@ -566,9 +566,8 @@ siteId,
|
|
|
566
566
|
// @ts-expect-error TS(7031) FIXME: Binding element 'workingDir' implicitly has an 'an... Remove this comment to see the full error message
|
|
567
567
|
workingDir, }) => {
|
|
568
568
|
const alias = options.alias || options.branch;
|
|
569
|
-
const isUsingEnvelope = siteData && siteData.use_envelope;
|
|
570
569
|
// if a context is passed besides dev, we need to pull env vars from that specific context
|
|
571
|
-
if (
|
|
570
|
+
if (options.context && options.context !== 'dev') {
|
|
572
571
|
command.netlify.cachedConfig.env = await getEnvelopeEnv({
|
|
573
572
|
api,
|
|
574
573
|
context: options.context,
|
|
@@ -593,16 +592,14 @@ workingDir, }) => {
|
|
|
593
592
|
deployFolder,
|
|
594
593
|
functionsFolder,
|
|
595
594
|
});
|
|
596
|
-
const siteEnv =
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
})
|
|
605
|
-
: siteData?.build_settings?.env;
|
|
595
|
+
const siteEnv = await getEnvelopeEnv({
|
|
596
|
+
api,
|
|
597
|
+
context: options.context,
|
|
598
|
+
env: command.netlify.cachedConfig.env,
|
|
599
|
+
raw: true,
|
|
600
|
+
scope: 'functions',
|
|
601
|
+
siteInfo: siteData,
|
|
602
|
+
});
|
|
606
603
|
const functionsConfig = normalizeFunctionsConfig({
|
|
607
604
|
functionsConfig: config.functions,
|
|
608
605
|
projectRoot: site.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-exec.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/dev-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,OAAO,QAAe,MAAM,WAAW,YAAY,WAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"dev-exec.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/dev-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,OAAO,QAAe,MAAM,WAAW,YAAY,WAAW,WAAW,kBAWrF,CAAA;AAED,eAAO,MAAM,oBAAoB,YAAa,WAAW,gBAerC,CAAA"}
|
|
@@ -3,12 +3,9 @@ import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.js';
|
|
|
3
3
|
import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.js';
|
|
4
4
|
export const devExec = async (cmd, options, command) => {
|
|
5
5
|
const { api, cachedConfig, config, site, siteInfo } = command.netlify;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
env = await getDotEnvVariables({ devConfig: { ...config.dev }, env, site });
|
|
11
|
-
injectEnvVariables(env);
|
|
6
|
+
const withEnvelopeEnvVars = await getEnvelopeEnv({ api, context: options.context, env: cachedConfig.env, siteInfo });
|
|
7
|
+
const withDotEnvVars = await getDotEnvVariables({ devConfig: { ...config.dev }, env: withEnvelopeEnvVars, site });
|
|
8
|
+
injectEnvVariables(withDotEnvVars);
|
|
12
9
|
await execa(cmd, command.args.slice(1), {
|
|
13
10
|
stdio: 'inherit',
|
|
14
11
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/dev.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/dev.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,YAAY,EAAE,MAAM,WAAW,CAAA;AA0BhD,OAAO,WAAW,MAAM,oBAAoB,CAAA;AA4D5C,eAAO,MAAM,GAAG,YAAmB,YAAY,WAAW,WAAW,kBA0JpE,CAAA;AAED,eAAO,MAAM,gBAAgB,YAAa,WAAW,gBA8GpD,CAAA"}
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -6,9 +6,9 @@ import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContextWithEdgeAcce
|
|
|
6
6
|
import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.js';
|
|
7
7
|
import { startFunctionsServer } from '../../lib/functions/server.js';
|
|
8
8
|
import { printBanner } from '../../utils/banner.js';
|
|
9
|
-
import { BANG,
|
|
9
|
+
import { BANG, NETLIFYDEV, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, log, normalizeConfig, } from '../../utils/command-helpers.js';
|
|
10
10
|
import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.js';
|
|
11
|
-
import { getDotEnvVariables, getSiteInformation, injectEnvVariables
|
|
11
|
+
import { UNLINKED_SITE_MOCK_ID, getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.js';
|
|
12
12
|
import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.js';
|
|
13
13
|
import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
|
|
14
14
|
import { getLiveTunnelSlug, startLiveTunnel } from '../../utils/live-tunnel.js';
|
|
@@ -84,7 +84,7 @@ export const dev = async (options, command) => {
|
|
|
84
84
|
siteID: site.id ?? UNLINKED_SITE_MOCK_ID,
|
|
85
85
|
});
|
|
86
86
|
env[BLOBS_CONTEXT_VARIABLE] = { sources: ['internal'], value: encodeBlobsContext(blobsContext) };
|
|
87
|
-
if (!options.offline
|
|
87
|
+
if (!options.offline) {
|
|
88
88
|
env = await getEnvelopeEnv({ api, context: options.context, env, siteInfo });
|
|
89
89
|
log(`${NETLIFYDEVLOG} Injecting environment variable values for ${chalk.yellow('all scopes')}`);
|
|
90
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-clone.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"env-clone.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAkD5C,eAAO,MAAM,QAAQ,YAAmB,YAAY,WAAW,WAAW,qBAuCzE,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { chalk, error as logError
|
|
2
|
-
import { translateFromEnvelopeToMongo, translateFromMongoToEnvelope } from '../../utils/env/index.js';
|
|
1
|
+
import { chalk, log, error as logError } from '../../utils/command-helpers.js';
|
|
3
2
|
// @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
|
|
4
3
|
const safeGetSite = async (api, siteId) => {
|
|
5
4
|
try {
|
|
@@ -10,41 +9,12 @@ const safeGetSite = async (api, siteId) => {
|
|
|
10
9
|
return { error };
|
|
11
10
|
}
|
|
12
11
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Copies the env from a site configured with Envelope to a site not configured with Envelope
|
|
15
|
-
* @returns {Promise<boolean>}
|
|
16
|
-
*/
|
|
17
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
18
|
-
const envelopeToMongo = async ({ api, siteFrom, siteTo }) => {
|
|
19
|
-
const envelopeVariables = await api.getEnvVars({ accountId: siteFrom.account_slug, siteId: siteFrom.id });
|
|
20
|
-
const envFrom = translateFromEnvelopeToMongo(envelopeVariables);
|
|
21
|
-
if (Object.keys(envFrom).length === 0) {
|
|
22
|
-
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`);
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
const envTo = siteTo.build_settings.env || {};
|
|
26
|
-
// Merge from site A to site B
|
|
27
|
-
const mergedEnv = {
|
|
28
|
-
...envTo,
|
|
29
|
-
...envFrom,
|
|
30
|
-
};
|
|
31
|
-
// Apply environment variable updates
|
|
32
|
-
await api.updateSite({
|
|
33
|
-
siteId: siteTo.id,
|
|
34
|
-
body: {
|
|
35
|
-
build_settings: {
|
|
36
|
-
env: mergedEnv,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
12
|
/**
|
|
43
13
|
* Copies the env from a site configured with Envelope to a different site configured with Envelope
|
|
44
14
|
* @returns {Promise<boolean>}
|
|
45
15
|
*/
|
|
46
16
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
47
|
-
const
|
|
17
|
+
const cloneEnvVars = async ({ api, siteFrom, siteTo }) => {
|
|
48
18
|
const [envelopeFrom, envelopeTo] = await Promise.all([
|
|
49
19
|
api.getEnvVars({ accountId: siteFrom.account_slug, siteId: siteFrom.id }),
|
|
50
20
|
api.getEnvVars({ accountId: siteTo.account_slug, siteId: siteTo.id }),
|
|
@@ -72,64 +42,6 @@ const envelopeToEnvelope = async ({ api, siteFrom, siteTo }) => {
|
|
|
72
42
|
}
|
|
73
43
|
return true;
|
|
74
44
|
};
|
|
75
|
-
/**
|
|
76
|
-
* Copies the env from a site not configured with Envelope to a different site not configured with Envelope
|
|
77
|
-
* @returns {Promise<boolean>}
|
|
78
|
-
*/
|
|
79
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
80
|
-
const mongoToMongo = async ({ api, siteFrom, siteTo }) => {
|
|
81
|
-
const [{ build_settings: { env: envFrom = {} }, }, { build_settings: { env: envTo = {} }, },] = [siteFrom, siteTo];
|
|
82
|
-
if (Object.keys(envFrom).length === 0) {
|
|
83
|
-
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`);
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
// Merge from site A to site B
|
|
87
|
-
const mergedEnv = {
|
|
88
|
-
...envTo,
|
|
89
|
-
...envFrom,
|
|
90
|
-
};
|
|
91
|
-
// Apply environment variable updates
|
|
92
|
-
await api.updateSite({
|
|
93
|
-
siteId: siteTo.id,
|
|
94
|
-
body: {
|
|
95
|
-
build_settings: {
|
|
96
|
-
env: mergedEnv,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
return true;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Copies the env from a site not configured with Envelope to a site configured with Envelope
|
|
104
|
-
* @returns {Promise<boolean>}
|
|
105
|
-
*/
|
|
106
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
107
|
-
const mongoToEnvelope = async ({ api, siteFrom, siteTo }) => {
|
|
108
|
-
const envFrom = siteFrom.build_settings.env || {};
|
|
109
|
-
const keysFrom = Object.keys(envFrom);
|
|
110
|
-
if (Object.keys(envFrom).length === 0) {
|
|
111
|
-
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`);
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
const accountId = siteTo.account_slug;
|
|
115
|
-
const siteId = siteTo.id;
|
|
116
|
-
const envelopeTo = await api.getEnvVars({ accountId, siteId });
|
|
117
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'key' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
118
|
-
const envVarsToDelete = envelopeTo.filter(({ key }) => keysFrom.includes(key));
|
|
119
|
-
// delete marked env vars in parallel
|
|
120
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'key' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
121
|
-
await Promise.all(envVarsToDelete.map(({ key }) => api.deleteEnvVar({ accountId, siteId, key })));
|
|
122
|
-
// hit create endpoint
|
|
123
|
-
const body = translateFromMongoToEnvelope(envFrom);
|
|
124
|
-
try {
|
|
125
|
-
await api.createEnvVars({ accountId, siteId, body });
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
129
|
-
throw error.json ? error.json.msg : error;
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
};
|
|
133
45
|
export const envClone = async (options, command) => {
|
|
134
46
|
const { api, site } = command.netlify;
|
|
135
47
|
if (!site.id && !options.from) {
|
|
@@ -152,21 +64,7 @@ export const envClone = async (options, command) => {
|
|
|
152
64
|
logError(`Can't find site with id ${chalk.bold(siteId.to)}. Please make sure the site exists.`);
|
|
153
65
|
return false;
|
|
154
66
|
}
|
|
155
|
-
|
|
156
|
-
let method;
|
|
157
|
-
if (!siteFrom.use_envelope && !siteTo.use_envelope) {
|
|
158
|
-
method = mongoToMongo;
|
|
159
|
-
}
|
|
160
|
-
else if (!siteFrom.use_envelope && siteTo.use_envelope) {
|
|
161
|
-
method = mongoToEnvelope;
|
|
162
|
-
}
|
|
163
|
-
else if (siteFrom.use_envelope && !siteTo.use_envelope) {
|
|
164
|
-
method = envelopeToMongo;
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
method = envelopeToEnvelope;
|
|
168
|
-
}
|
|
169
|
-
const success = await method({ api, siteFrom, siteTo });
|
|
67
|
+
const success = await cloneEnvVars({ api, siteFrom, siteTo });
|
|
170
68
|
if (!success) {
|
|
171
69
|
return false;
|
|
172
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-get.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,MAAM,SAAgB,MAAM,WAAW,YAAY,WAAW,WAAW,+
|
|
1
|
+
{"version":3,"file":"env-get.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,MAAM,SAAgB,MAAM,WAAW,YAAY,WAAW,WAAW,+BA+BrF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chalk,
|
|
1
|
+
import { chalk, log, logJson } from '../../utils/command-helpers.js';
|
|
2
2
|
import { AVAILABLE_CONTEXTS, getEnvelopeEnv } from '../../utils/env/index.js';
|
|
3
3
|
export const envGet = async (name, options, command) => {
|
|
4
4
|
const { context, scope } = options;
|
|
@@ -9,14 +9,8 @@ export const envGet = async (name, options, command) => {
|
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
const { siteInfo } = cachedConfig;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
env = await getEnvelopeEnv({ api, context, env, key: name, scope, siteInfo });
|
|
15
|
-
}
|
|
16
|
-
else if (context !== 'dev' || scope !== 'any') {
|
|
17
|
-
error(`To specify a context or scope, please run ${chalk.yellow('netlify open:admin')} to open the Netlify UI and opt in to the new environment variables experience from Site settings`);
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
12
|
+
const env = await getEnvelopeEnv({ api, context, env: cachedConfig.env, key: name, scope, siteInfo });
|
|
13
|
+
// @ts-expect-error TS(7053) - Element implicitly has an 'any' type
|
|
20
14
|
const { value } = env[name] || {};
|
|
21
15
|
// Return json response for piping commands
|
|
22
16
|
if (options.json) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-import.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-import.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"env-import.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-import.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AA2C5C,eAAO,MAAM,SAAS,aAAoB,MAAM,WAAW,YAAY,WAAW,WAAW,+BAyC5F,CAAA"}
|
|
@@ -3,34 +3,12 @@ import AsciiTable from 'ascii-table';
|
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
4
|
import { exit, log, logJson } from '../../utils/command-helpers.js';
|
|
5
5
|
import { translateFromEnvelopeToMongo, translateFromMongoToEnvelope } from '../../utils/env/index.js';
|
|
6
|
-
/**
|
|
7
|
-
* Updates the imported env in the site record
|
|
8
|
-
* @returns {Promise<object>}
|
|
9
|
-
*/
|
|
10
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
11
|
-
const importIntoMongo = async ({ api, importedEnv, options, siteInfo }) => {
|
|
12
|
-
const { env = {} } = siteInfo.build_settings;
|
|
13
|
-
const siteId = siteInfo.id;
|
|
14
|
-
const finalEnv = options.replaceExisting ? importedEnv : { ...env, ...importedEnv };
|
|
15
|
-
// Apply environment variable updates
|
|
16
|
-
await api.updateSite({
|
|
17
|
-
siteId,
|
|
18
|
-
body: {
|
|
19
|
-
build_settings: {
|
|
20
|
-
// Only set imported variables if --replaceExisting or otherwise merge
|
|
21
|
-
// imported ones with the current environment variables.
|
|
22
|
-
env: finalEnv,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return finalEnv;
|
|
27
|
-
};
|
|
28
6
|
/**
|
|
29
7
|
* Saves the imported env in the Envelope service
|
|
30
8
|
* @returns {Promise<object>}
|
|
31
9
|
*/
|
|
32
10
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
33
|
-
const
|
|
11
|
+
const importDotEnv = async ({ api, importedEnv, options, siteInfo }) => {
|
|
34
12
|
// fetch env vars
|
|
35
13
|
const accountId = siteInfo.account_slug;
|
|
36
14
|
const siteId = siteInfo.id;
|
|
@@ -84,8 +62,7 @@ export const envImport = async (fileName, options, command) => {
|
|
|
84
62
|
return false;
|
|
85
63
|
}
|
|
86
64
|
const { siteInfo } = cachedConfig;
|
|
87
|
-
const
|
|
88
|
-
const finalEnv = await importIntoService({ api, importedEnv, options, siteInfo });
|
|
65
|
+
const finalEnv = await importDotEnv({ api, importedEnv, options, siteInfo });
|
|
89
66
|
// Return new environment variables of site if using json flag
|
|
90
67
|
if (options.json) {
|
|
91
68
|
logJson(finalEnv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-list.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-list.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAMxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAiC5C,eAAO,MAAM,OAAO,YAAmB,YAAY,WAAW,WAAW,+
|
|
1
|
+
{"version":3,"file":"env-list.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-list.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAMxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAiC5C,eAAO,MAAM,OAAO,YAAmB,YAAY,WAAW,WAAW,+BA0ExE,CAAA"}
|
|
@@ -3,7 +3,7 @@ import AsciiTable from 'ascii-table';
|
|
|
3
3
|
import { isCI } from 'ci-info';
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import logUpdate from 'log-update';
|
|
6
|
-
import { chalk,
|
|
6
|
+
import { chalk, log, logJson } from '../../utils/command-helpers.js';
|
|
7
7
|
import { AVAILABLE_CONTEXTS, getEnvelopeEnv, getHumanReadableScopes } from '../../utils/env/index.js';
|
|
8
8
|
const MASK_LENGTH = 50;
|
|
9
9
|
const MASK = '*'.repeat(MASK_LENGTH);
|
|
@@ -30,25 +30,22 @@ export const envList = async (options, command) => {
|
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
const { env, siteInfo } = cachedConfig;
|
|
33
|
-
|
|
34
|
-
let environment = env;
|
|
35
|
-
if (isUsingEnvelope) {
|
|
36
|
-
environment = await getEnvelopeEnv({ api, context, env, scope, siteInfo });
|
|
37
|
-
}
|
|
38
|
-
else if (context !== 'dev' || scope !== 'any') {
|
|
39
|
-
error(`To specify a context or scope, please run ${chalk.yellow('netlify open:admin')} to open the Netlify UI and opt in to the new environment variables experience from Site settings`);
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
33
|
+
let environment = await getEnvelopeEnv({ api, context, env, scope, siteInfo });
|
|
42
34
|
// filter out general sources
|
|
43
|
-
environment = Object.fromEntries(Object.entries(environment).filter(
|
|
35
|
+
environment = Object.fromEntries(Object.entries(environment).filter(
|
|
36
|
+
// @ts-expect-error TS(18046) - 'variable' is of type 'unknown'
|
|
37
|
+
([, variable]) => variable.sources[0] !== 'general' && variable.sources[0] !== 'internal'));
|
|
44
38
|
// Return json response for piping commands
|
|
45
39
|
if (options.json) {
|
|
46
|
-
const envDictionary = Object.fromEntries(
|
|
40
|
+
const envDictionary = Object.fromEntries(
|
|
41
|
+
// @ts-expect-error TS(18046) - 'variable' is of type 'unknown'
|
|
42
|
+
Object.entries(environment).map(([key, variable]) => [key, variable.value]));
|
|
47
43
|
logJson(envDictionary);
|
|
48
44
|
return false;
|
|
49
45
|
}
|
|
50
46
|
if (options.plain) {
|
|
51
47
|
const plaintext = Object.entries(environment)
|
|
48
|
+
// @ts-expect-error TS(18046) - 'variable' is of type 'unknown'
|
|
52
49
|
.map(([key, variable]) => `${key}=${variable.value}`)
|
|
53
50
|
.join('\n');
|
|
54
51
|
log(plaintext);
|
|
@@ -56,8 +53,8 @@ export const envList = async (options, command) => {
|
|
|
56
53
|
}
|
|
57
54
|
const forSite = `for site ${chalk.green(siteInfo.name)}`;
|
|
58
55
|
const contextType = AVAILABLE_CONTEXTS.includes(context) ? 'context' : 'branch';
|
|
59
|
-
const withContext =
|
|
60
|
-
const withScope =
|
|
56
|
+
const withContext = `in the ${chalk.magenta(options.context)} ${contextType}`;
|
|
57
|
+
const withScope = scope === 'any' ? '' : `and ${chalk.yellow(options.scope)} scope`;
|
|
61
58
|
if (Object.keys(environment).length === 0) {
|
|
62
59
|
log(`No environment variables set ${forSite} ${withContext} ${withScope}`);
|
|
63
60
|
return false;
|
|
@@ -66,10 +63,10 @@ export const envList = async (options, command) => {
|
|
|
66
63
|
const count = Object.keys(environment).length;
|
|
67
64
|
log(`${count} environment variable${count === 1 ? '' : 's'} ${forSite} ${withContext} ${withScope}`);
|
|
68
65
|
if (isCI) {
|
|
69
|
-
log(getTable({ environment, hideValues: false, scopesColumn:
|
|
66
|
+
log(getTable({ environment, hideValues: false, scopesColumn: true }));
|
|
70
67
|
return false;
|
|
71
68
|
}
|
|
72
|
-
logUpdate(getTable({ environment, hideValues: true, scopesColumn:
|
|
69
|
+
logUpdate(getTable({ environment, hideValues: true, scopesColumn: true }));
|
|
73
70
|
const { showValues } = await inquirer.prompt([
|
|
74
71
|
{
|
|
75
72
|
type: 'confirm',
|
|
@@ -81,7 +78,7 @@ export const envList = async (options, command) => {
|
|
|
81
78
|
if (showValues) {
|
|
82
79
|
// since inquirer adds a prompt, we need to account for it when printing the table again
|
|
83
80
|
log(ansiEscapes.eraseLines(3));
|
|
84
|
-
logUpdate(getTable({ environment, hideValues: false, scopesColumn:
|
|
81
|
+
logUpdate(getTable({ environment, hideValues: false, scopesColumn: true }));
|
|
85
82
|
log(`${chalk.cyan('?')} Show values? ${chalk.cyan('Yes')}`);
|
|
86
83
|
}
|
|
87
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-set.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"env-set.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAyG5C,eAAO,MAAM,MAAM,QAAe,MAAM,SAAS,MAAM,WAAW,YAAY,WAAW,WAAW,+BAkCnG,CAAA"}
|
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
import { chalk, error, log, logJson } from '../../utils/command-helpers.js';
|
|
2
2
|
import { AVAILABLE_CONTEXTS, AVAILABLE_SCOPES, translateFromEnvelopeToMongo } from '../../utils/env/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Updates the env for a site record with a new key/value pair
|
|
5
|
-
* @returns {Promise<object>}
|
|
6
|
-
*/
|
|
7
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
8
|
-
const setInMongo = async ({ api, key, siteInfo, value }) => {
|
|
9
|
-
const { env = {} } = siteInfo.build_settings;
|
|
10
|
-
const newEnv = {
|
|
11
|
-
...env,
|
|
12
|
-
[key]: value,
|
|
13
|
-
};
|
|
14
|
-
// Apply environment variable updates
|
|
15
|
-
await api.updateSite({
|
|
16
|
-
siteId: siteInfo.id,
|
|
17
|
-
body: {
|
|
18
|
-
build_settings: {
|
|
19
|
-
env: newEnv,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
return newEnv;
|
|
24
|
-
};
|
|
25
3
|
/**
|
|
26
4
|
* Updates the env for a site configured with Envelope with a new key/value pair
|
|
27
5
|
* @returns {Promise<object | boolean>}
|
|
@@ -122,18 +100,8 @@ export const envSet = async (key, value, options, command) => {
|
|
|
122
100
|
return false;
|
|
123
101
|
}
|
|
124
102
|
const { siteInfo } = cachedConfig;
|
|
125
|
-
let finalEnv;
|
|
126
103
|
// Get current environment variables set in the UI
|
|
127
|
-
|
|
128
|
-
finalEnv = await setInEnvelope({ api, siteInfo, key, value, context, scope, secret });
|
|
129
|
-
}
|
|
130
|
-
else if (context || scope) {
|
|
131
|
-
error(`To specify a context or scope, please run ${chalk.yellow('netlify open:admin')} to open the Netlify UI and opt in to the new environment variables experience from Site settings`);
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
finalEnv = await setInMongo({ api, siteInfo, key, value });
|
|
136
|
-
}
|
|
104
|
+
const finalEnv = await setInEnvelope({ api, siteInfo, key, value, context, scope, secret });
|
|
137
105
|
if (!finalEnv) {
|
|
138
106
|
return false;
|
|
139
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-unset.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-unset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"env-unset.d.ts","sourceRoot":"","sources":["../../../src/commands/env/env-unset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAIxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AA6D5C,eAAO,MAAM,QAAQ,QAAe,MAAM,WAAW,YAAY,WAAW,WAAW,+BAsBtF,CAAA"}
|
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
import { chalk,
|
|
1
|
+
import { chalk, log, logJson } from '../../utils/command-helpers.js';
|
|
2
2
|
import { AVAILABLE_CONTEXTS, translateFromEnvelopeToMongo } from '../../utils/env/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Deletes a given key from the env of a site record
|
|
5
|
-
* @returns {Promise<object>}
|
|
6
|
-
*/
|
|
7
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
8
|
-
const unsetInMongo = async ({ api, key, siteInfo }) => {
|
|
9
|
-
// Get current environment variables set in the UI
|
|
10
|
-
const { build_settings: { env = {} }, } = siteInfo;
|
|
11
|
-
const newEnv = env;
|
|
12
|
-
// Delete environment variable from current variables
|
|
13
|
-
delete newEnv[key];
|
|
14
|
-
// Apply environment variable updates
|
|
15
|
-
await api.updateSite({
|
|
16
|
-
siteId: siteInfo.id,
|
|
17
|
-
body: {
|
|
18
|
-
build_settings: {
|
|
19
|
-
env: newEnv,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
return newEnv;
|
|
24
|
-
};
|
|
25
3
|
/**
|
|
26
4
|
* Deletes a given key from the env of a site configured with Envelope
|
|
27
5
|
* @returns {Promise<object>}
|
|
@@ -82,17 +60,7 @@ export const envUnset = async (key, options, command) => {
|
|
|
82
60
|
return false;
|
|
83
61
|
}
|
|
84
62
|
const { siteInfo } = cachedConfig;
|
|
85
|
-
|
|
86
|
-
if (siteInfo.use_envelope) {
|
|
87
|
-
finalEnv = await unsetInEnvelope({ api, context, siteInfo, key });
|
|
88
|
-
}
|
|
89
|
-
else if (context) {
|
|
90
|
-
error(`To specify a context, please run ${chalk.yellow('netlify open:admin')} to open the Netlify UI and opt in to the new environment variables experience from Site settings`);
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
finalEnv = await unsetInMongo({ api, siteInfo, key });
|
|
95
|
-
}
|
|
63
|
+
const finalEnv = await unsetInEnvelope({ api, context, siteInfo, key });
|
|
96
64
|
// Return new environment variables of site if using json flag
|
|
97
65
|
if (options.json) {
|
|
98
66
|
logJson(finalEnv);
|
|
@@ -313,7 +313,7 @@ const downloadFromURL = async function (command, options, argumentName, function
|
|
|
313
313
|
const res = await fetch(downloadUrl);
|
|
314
314
|
const finalName = path.basename(name, '.js') === functionName ? `${nameToUse}.js` : name;
|
|
315
315
|
const dest = fs.createWriteStream(path.join(fnFolder, finalName));
|
|
316
|
-
res.body
|
|
316
|
+
res.body?.pipe(dest);
|
|
317
317
|
}
|
|
318
318
|
catch (error_) {
|
|
319
319
|
throw new Error(`Error while retrieving ${downloadUrl} ${error_}`);
|
|
@@ -393,7 +393,6 @@ const installDeps = async ({ functionPackageJson, functionPath, functionsDir })
|
|
|
393
393
|
* @param {'edge' | 'serverless'} funcType
|
|
394
394
|
*/
|
|
395
395
|
// @ts-expect-error TS(7006) FIXME: Parameter 'command' implicitly has an 'any' type.
|
|
396
|
-
// eslint-disable-next-line max-params
|
|
397
396
|
const scaffoldFromTemplate = async function (command, options, argumentName, functionsDir, funcType) {
|
|
398
397
|
// pull the rest of the metadata from the template
|
|
399
398
|
const chosenTemplate = await pickTemplate(options, funcType);
|
|
@@ -460,7 +459,7 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
|
|
|
460
459
|
spinner.succeed(`Installed dependencies for ${name}`);
|
|
461
460
|
}
|
|
462
461
|
if (funcType === 'edge') {
|
|
463
|
-
registerEFInToml(name, command.netlify);
|
|
462
|
+
await registerEFInToml(name, command.netlify);
|
|
464
463
|
}
|
|
465
464
|
await installAddons(command, addons, path.resolve(functionPath));
|
|
466
465
|
await handleOnComplete({ command, onComplete });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/integration/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAUxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAS5C,wBAAgB,cAAc,CAAC,WAAW,KAAA,EAAE,YAAY,KAAA,OAOvD;AA0FD,wBAAsB,mBAAmB,CAAC,UAAU,KAAA,EAAE,MAAM,KAAA,EAAE,SAAS,KAAA,EAAE,sBAAsB,KAAA,EAAE,KAAK,KAAA,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/integration/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAUxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAS5C,wBAAgB,cAAc,CAAC,WAAW,KAAA,EAAE,YAAY,KAAA,OAOvD;AA0FD,wBAAsB,mBAAmB,CAAC,UAAU,KAAA,EAAE,MAAM,KAAA,EAAE,SAAS,KAAA,EAAE,sBAAsB,KAAA,EAAE,KAAK,KAAA,iBA0ErG;AAED,wBAAsB,iBAAiB,CAErC,UAAU,KAAA,EAEV,OAAO,KAAA,EAEP,MAAM,KAAA,EAEN,SAAS,KAAA,EAET,sBAAsB,KAAA,EAEtB,KAAK,KAAA,EAEL,qBAAqB,KAAA,iBA4HtB;AA4BD,eAAO,MAAM,gBAAgB,0BA6B5B,CAAA;AAED,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,kBAkEvE,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { env, exit } from 'process';
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'js-y... Remove this comment to see the full error message
|
|
6
6
|
import yaml from 'js-yaml';
|
|
7
7
|
import fetch from 'node-fetch';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { getBuildOptions } from '../../lib/build.js';
|
|
10
|
-
import {
|
|
10
|
+
import { chalk, getToken, log } from '../../utils/command-helpers.js';
|
|
11
11
|
import { getSiteInformation } from '../../utils/dev.js';
|
|
12
12
|
import { checkOptions } from '../build/build.js';
|
|
13
13
|
import { deploy as siteDeploy } from '../deploy/deploy.js';
|
|
@@ -137,14 +137,17 @@ export async function registerIntegration(workingDir, siteId, accountId, localIn
|
|
|
137
137
|
log(chalk.red(`There was an error registering the integration:`));
|
|
138
138
|
log();
|
|
139
139
|
log(chalk.red(`-----------------------------------------------`));
|
|
140
|
+
// @ts-expect-error TS(18046) - 'body' is of type 'unknown'
|
|
140
141
|
log(chalk.red(body.msg));
|
|
141
142
|
log(chalk.red(`-----------------------------------------------`));
|
|
142
143
|
log();
|
|
143
144
|
log(chalk.red(`Please try again. If the problem persists, please contact support.`));
|
|
144
145
|
exit(1);
|
|
145
146
|
}
|
|
147
|
+
// @ts-expect-error TS(18046) - 'body' is of type 'unknown'
|
|
146
148
|
log(chalk.green(`Successfully registered the integration with the slug: ${body.slug}`));
|
|
147
149
|
const updatedIntegrationConfig = yaml.dump({
|
|
150
|
+
// @ts-expect-error TS(18046) - 'body' is of type 'unknown'
|
|
148
151
|
config: { name, description, slug: body.slug, scopes, integrationLevel },
|
|
149
152
|
});
|
|
150
153
|
const filePath = resolve(workingDir, 'integration.yaml');
|
|
@@ -26,7 +26,7 @@ export const serve = async (options, command) => {
|
|
|
26
26
|
framework: '#static',
|
|
27
27
|
};
|
|
28
28
|
let { env } = cachedConfig;
|
|
29
|
-
if (!options.offline
|
|
29
|
+
if (!options.offline) {
|
|
30
30
|
env = await getEnvelopeEnv({ api, context: options.context, env, siteInfo });
|
|
31
31
|
log(`${NETLIFYDEVLOG} Injecting environment variable values for ${chalk.yellow('all scopes')}`);
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sites-create-template.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/sites-create-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAcxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAK5C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"sites-create-template.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/sites-create-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAcxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAK5C,eAAO,MAAM,cAAc,8BAe1B,CAAA;AAqCD,eAAO,MAAM,mBAAmB,eAAsB,MAAM,WAAW,YAAY,WAAW,WAAW,uBA6LxG,CAAA"}
|