import * as plugins from './mod.plugins.js'; import { logger } from '../gitzone.logging.js'; export const run = async () => { const smartInteract = new plugins.smartinteract.SmartInteract([ { name: `oldPackageName`, message: `Whats the name of the OLD package?`, type: `input`, default: ``, validate: (stringInput) => { return stringInput !== '' && !process.env.CI; }, }, { name: `newPackageName`, message: `Whats the name of the NEW package?`, type: `input`, default: ``, validate: (stringInput) => { return stringInput !== '' && !process.env.CI; }, }, ]); const answerBucket = await smartInteract.runQueue(); const oldPackageName = answerBucket.getAnswerFor(`oldPackageName`); const newPackageName = answerBucket.getAnswerFor(`newPackageName`); logger.log('info', `Deprecating package ${oldPackageName} in favour of ${newPackageName}`); const smartshellInstance = new plugins.smartshell.Smartshell({ executor: 'bash', }); await smartshellInstance.exec( `npm deprecate ${oldPackageName}@* ` + `"${oldPackageName} has been deprecated in favour of ${newPackageName} - please upgrade asap!!!"` ); };