class NpmDeprecate { private static readonly execSync = require ( 'child_process' ) . execSync ; static perform ( date , versions ) { NpmDeprecate . login ( ) ; if ( versions . length === 1 && /^\d+$/ . test ( versions [ 0 ] ) ) { NpmDeprecate . deprecateMajorVersion ( versions [ 0 ] , date ) ; } else { versions . forEach ( version => NpmDeprecate . deprecateExactVersion ( version , date ) ) ; NpmDeprecate . removeNextTag ( ) ; } } private static login ( ) { if ( NpmDeprecate . execSync ( `npm whoami` ) !== 'oblique' ) { NpmDeprecate . execSync ( 'npm login' ) ; } } private static deprecateMajorVersion ( version , date ) { NpmDeprecate . execSync ( `npm deprecate @oblique/oblique@${ version }.x "Oblique ${ version } has reached its End Of Life on ${ date }"` ) ; } private static deprecateExactVersion ( version , date ) { NpmDeprecate . execSync ( `npm deprecate @oblique/oblique@${ version } "Oblique ${ version . split ( '.' ) [ 0 ] } has been released on ${ date }"` ) ; } private static removeNextTag ( ) { NpmDeprecate . execSync ( `npm dist-tag rm @oblique/oblique next` ) ; } } NpmDeprecate . perform ( process . argv [ 2 ] , process . argv . slice ( 3 ) ) ;