File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as path from 'node:path' ;
12import type { Hook } from '@oclif/core' ;
23import debug from 'debug' ;
34
4- const hook : Hook < 'prerun' > = async ( opts ) => {
5- // If JSON flag is enabled, silence debug logging
6- if ( opts . Command . prototype . jsonEnabled ( ) ) {
5+ const hook : Hook < 'prerun' > = async function ( this : Hook . Context , { Command } ) {
6+ if ( Command . prototype . jsonEnabled ( ) ) {
77 debug . disable ( ) ;
88 }
9+
10+ if ( Command . id === 'update' ) {
11+ const isNpm = this . config . root . split ( path . sep ) . includes ( 'node_modules' ) ;
12+
13+ if ( isNpm ) {
14+ this . warn ( 'The update command is not supported for npm installations.' ) ;
15+ this . log ( '\nTo update to the latest, run:\n' ) ;
16+ this . log ( ' npm install -g @herodevs/cli@latest\n' ) ;
17+ this . log ( '\nTo update to a specific version, run:\n' ) ;
18+ this . log ( ' npm install -g @herodevs/cli@<version>\n' ) ;
19+
20+ process . exit ( 0 ) ;
21+ }
22+ }
923} ;
1024
1125export default hook ;
You can’t perform that action at this time.
0 commit comments