@@ -5,6 +5,7 @@ import fs from 'fs-extra';
55import debugLib from 'debug' ;
66import cosmiconfig from 'cosmiconfig' ;
77
8+ import thisPkg from '../package' ;
89import { getVisitor , track } from './util/track' ;
910import hrMillis from './util/hrMillis' ;
1011import handlerCode from './handlerCode' ;
@@ -351,7 +352,7 @@ class ServerlessIOpipePlugin {
351352 throw new Error ( err ) ;
352353 }
353354 }
354- getConfigFromCosmi ( ) {
355+ getConfig ( ) {
355356 const { token } = this . getOptions ( ) ;
356357 const { config : cosmi = { } } =
357358 cosmiconfig ( 'iopipe' , {
@@ -364,10 +365,13 @@ class ServerlessIOpipePlugin {
364365 . join ( '' )
365366 . defaultTo ( '' )
366367 . value ( ) ;
367- const inlineConfigObject = _ . pickBy ( _ . assign ( { } , cosmi , { token } ) ) ;
368- const inlineConfig = _ . isEmpty ( inlineConfigObject )
369- ? ''
370- : JSON . stringify ( inlineConfigObject ) ;
368+ const inlineConfigObject = _ . pickBy (
369+ _ . assign ( { } , cosmi , {
370+ token,
371+ installMethod : `${ thisPkg . name } @${ thisPkg . version } `
372+ } )
373+ ) ;
374+ const inlineConfig = JSON . stringify ( inlineConfigObject ) ;
371375 return {
372376 requireLines,
373377 inlineConfig
@@ -376,7 +380,7 @@ class ServerlessIOpipePlugin {
376380 createFiles ( ) {
377381 const debug = createDebugger ( 'createFiles' ) ;
378382 debug ( 'Creating file' ) ;
379- const { inlineConfig, requireLines } = this . getConfigFromCosmi ( ) ;
383+ const { inlineConfig, requireLines } = this . getConfig ( ) ;
380384 const { handlerDir } = this . getOptions ( ) ;
381385 const iopipeInclude = `${ requireLines } const iopipe = require('${ this . getInstalledPackageName ( ) } ')(${ inlineConfig } );` ;
382386 this . funcs . forEach ( ( func , index ) => {
0 commit comments