()
| 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 | })) |
no test coverage detected