MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / main

Function main

scripts/web-env/index.ts:161–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159 }
160 for (const project of missingProjects) {
161 console.log(`- ${project}: skip, the Vercel project does not exist yet`);
162 }
163 for (const [file, value] of defaults)
164 console.log(`- ${file}: ${options.name}=${JSON.stringify(value)}`);
165 console.log(
166 `- 1Password: ${vaultEnvironments.length > 0 ? `update ${vaultEnvironments.join(' and ')} fields` : 'skip'}`
167 );
168 console.log(
169 `- Deployments: ${
170 deployableEnvironments.length > 0
171 ? 'ask after environment updates'
172 : 'not applicable for development'
173 }`
174 );
175
176 if (options.dryRun) {
177 console.log('\nDry run complete; nothing changed.');
178 return;
179 }
180 if (!(await confirm('\nApply these changes?'))) {
181 console.log('Cancelled; nothing changed.');
182 return;
183 }
184
185 for (const [relativeFile, value] of defaults) {
186 setEnvDefault(path.join(repoRoot, relativeFile), options.name, value);
187 }
188
189 for (const environment of environments) {
190 const value = values[environment];
191 if (!value) throw new Error(`Missing ${environment} value.`);
192 for (const context of contexts) {
193 console.log(`Setting ${context.project}/${environment}...`);
194 setVariable(context, environment, options.name, value, sensitive);
195 }
196 }
197 if (vault) {
198 for (const environment of vaultEnvironments) {
199 const value = values[environment];
200 if (!value) throw new Error(`Missing ${environment} value.`);
201 console.log(`Updating 1Password ${environment} copy...`);
202 await setVaultValue(vault, options.name, value, environment);
203 }
204 }
205
206 if (
207 deployableEnvironments.length > 0 &&
208 (await confirm(
209 `\nEnvironment changes only take effect in new deployments. Redeploy ${deployableEnvironments.join(' and ')} now?`
210 ))
211 ) {
212 for (const environment of deployableEnvironments) {
213 console.log(`Redeploying ${environment} in each Vercel project...`);
214 const deployments = await Promise.all(
215 contexts.map(async context => ({
216 project: context.project,
217 url: await redeployLatest(context, environment),
218 }))

Callers 1

index.tsFile · 0.70

Calls 15

parseOptionsFunction · 0.85
askSensitivityFunction · 0.85
resolveVercelContextsFunction · 0.85
resolveVaultFunction · 0.85
collectValuesFunction · 0.85
collectDefaultsFunction · 0.85
setEnvDefaultFunction · 0.85
setVariableFunction · 0.85
setVaultValueFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected