| 23 | }; |
| 24 | |
| 25 | function shouldSetBrowsers(isInteractive) { |
| 26 | if (!isInteractive) { |
| 27 | return Promise.resolve(true); |
| 28 | } |
| 29 | |
| 30 | const question = { |
| 31 | type: 'confirm', |
| 32 | name: 'shouldSetBrowsers', |
| 33 | message: |
| 34 | chalk.yellow("We're unable to detect target browsers.") + |
| 35 | `\n\nWould you like to add the defaults to your ${chalk.bold( |
| 36 | 'package.json' |
| 37 | )}?`, |
| 38 | initial: true, |
| 39 | }; |
| 40 | |
| 41 | return prompts(question).then(answer => answer.shouldSetBrowsers); |
| 42 | } |
| 43 | |
| 44 | function checkBrowsers(dir, isInteractive, retry = true) { |
| 45 | const current = browserslist.loadConfig({ path: dir }); |