File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ var path = require('path')
44var execSync = require ( 'child_process' ) . execSync
55var Common = require ( './Common' )
66var cst = require ( '../constants' )
7+ var which = require ( './tools/which' )
78
89var PM2_ROOT = path . join ( __dirname , '..' )
910
@@ -29,17 +30,25 @@ module.exports = {
2930 } ,
3031
3132 install : function ( ) {
33+ var pm = which ( 'npm' ) ? 'npm' : which ( 'bun' ) ? 'bun' : null
34+ if ( ! pm ) {
35+ throw new Error ( 'npm or bun is required to install OpenTelemetry packages' )
36+ }
3237 Common . printOut ( cst . PREFIX_MSG + 'Installing OpenTelemetry tracing packages...' )
33- execSync ( 'npm install --no-save ' + OTEL_PACKAGES . join ( ' ' ) , {
38+ execSync ( pm + ' install --no-save ' + OTEL_PACKAGES . join ( ' ' ) , {
3439 cwd : PM2_ROOT ,
3540 stdio : 'inherit'
3641 } )
3742 Common . printOut ( cst . PREFIX_MSG + 'OpenTelemetry tracing packages installed successfully' )
3843 } ,
3944
4045 uninstall : function ( ) {
46+ var pm = which ( 'npm' ) ? 'npm' : which ( 'bun' ) ? 'bun' : null
47+ if ( ! pm ) {
48+ throw new Error ( 'npm or bun is required to uninstall OpenTelemetry packages' )
49+ }
4150 Common . printOut ( cst . PREFIX_MSG + 'Removing OpenTelemetry tracing packages...' )
42- execSync ( 'npm uninstall --no-save ' + OTEL_PACKAGES . join ( ' ' ) , {
51+ execSync ( pm + ' remove --no-save ' + OTEL_PACKAGES . join ( ' ' ) , {
4352 cwd : PM2_ROOT ,
4453 stdio : 'inherit'
4554 } )
You can’t perform that action at this time.
0 commit comments