import * as chalk from 'chalk'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; const DEPRECATION_CHECK_FILE = '.lastdeprecationcheck'; const _24hours = 24 * 60 * 60 * 1000; export function checkDeprecation(): void { const file = path.join(os.homedir(), `.ocp/${DEPRECATION_CHECK_FILE}`); if (fs.existsSync(file)) { const stat = fs.statSync(file); const now = new Date(); if (now.getTime() - stat.mtime.getTime() < _24hours) { return; } } console.log( chalk.yellow( '\n' + '┌──────────────────────────────────────────────────────────────────────────────┐\n' + '│ │\n' + '│ ⚠ OCP CLI v1.x is deprecated and will no longer receive updates. │\n' + '│ │\n' + '│ Please migrate to OCP CLI v2: │\n' + '│ https://docs.developers.optimizely.com/optimizely-connect-platform/ │\n' + '│ docs/ocp-cli-v2-migration │\n' + '│ │\n' + '└──────────────────────────────────────────────────────────────────────────────┘\n' ) ); fs.writeFileSync(file, new Date().toISOString()); }