1 | const chalk = require('chalk')
|
2 | const upToDate = require('./up-to-date')
|
3 | const latestBlinkCli = require('./latest-blink-cli')
|
4 |
|
5 | const oldVersion = 'You are using an older version of blink-cli'
|
6 | const getBlinkCli = ' Install the latest version'
|
7 | const installCmd = ' npm i -g @tremorvideo/blink-cli'
|
8 |
|
9 | module.exports = async ({ pkg }) => {
|
10 | const warnings = []
|
11 | const details = []
|
12 | const latest = await latestBlinkCli(pkg)
|
13 | if (upToDate(pkg.version, latest)) {
|
14 | details.push(chalk`You are using blink-cli version ${pkg.version} {green (up to date)}`)
|
15 | } else {
|
16 | details.push(chalk`You are using blink-cli version ${pkg.version} {red (not up to date)}`)
|
17 | warnings.push(chalk`${oldVersion}\n${getBlinkCli} (v${latest})\n{italic.gray ${installCmd}}`)
|
18 | }
|
19 | return { warnings, details }
|
20 | }
|