(spinner: Ora)
| 8 | const platforms: Platform[] = ["github", "bitbucket", "gitlab"]; |
| 9 | |
| 10 | export default async function initCICD(spinner: Ora) { |
| 11 | const initializers = getPlatformInitializers(spinner); |
| 12 | |
| 13 | const init = await confirm({ |
| 14 | message: "Would you like to use Lingo.dev in your CI/CD?", |
| 15 | }); |
| 16 | |
| 17 | if (!init) { |
| 18 | spinner.warn( |
| 19 | "CI/CD not initialized. To set it up later, see docs: https://lingo.dev/ci", |
| 20 | ); |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | const selectedPlatforms: Platform[] = await checkbox({ |
| 25 | message: "Please select CI/CD platform(s) you want to use:", |
| 26 | choices: platforms.map((platform) => ({ |
| 27 | name: initializers[platform].name, |
| 28 | value: platform, |
| 29 | checked: initializers[platform].isEnabled(), |
| 30 | })), |
| 31 | }); |
| 32 | |
| 33 | for (const platform of selectedPlatforms) { |
| 34 | await initializers[platform].init(); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | function getPlatformInitializers(spinner: Ora) { |
| 39 | return { |
no test coverage detected