@@ -14,7 +14,7 @@ const BASE_RUNTIME = "provided";
1414const NO_OUTPUT_CAPTURE = { stdio : [ "ignore" , process . stdout , process . stderr ] } ;
1515
1616function includeInvokeHook ( serverlessVersion ) {
17- let [ major , minor ] = serverlessVersion . split ( '.' ) ;
17+ let [ major , minor ] = serverlessVersion . split ( "." ) ;
1818 let majorVersion = parseInt ( major ) ;
1919 let minorVersion = parseInt ( minor ) ;
2020 return majorVersion === 1 && minorVersion >= 38 && minorVersion < 40 ;
@@ -28,10 +28,10 @@ class RustPlugin {
2828 this . servicePath = this . serverless . config . servicePath || "" ;
2929 this . hooks = {
3030 "before:package:createDeploymentArtifacts" : this . build . bind ( this ) ,
31- "before:deploy:function:packageFunction" : this . build . bind ( this ) ,
31+ "before:deploy:function:packageFunction" : this . build . bind ( this )
3232 } ;
3333 if ( includeInvokeHook ( serverless . version ) ) {
34- this . hooks [ ' before:invoke:local:invoke' ] = this . build . bind ( this ) ;
34+ this . hooks [ " before:invoke:local:invoke" ] = this . build . bind ( this ) ;
3535 }
3636 this . custom = Object . assign (
3737 {
@@ -51,17 +51,21 @@ class RustPlugin {
5151 }
5252
5353 runDocker ( funcArgs , cargoPackage , binary ) {
54- const cargoHome = process . env . CARGO_HOME || ( path . join ( homedir ( ) , ".cargo" ) ) ;
54+ const cargoHome = process . env . CARGO_HOME || path . join ( homedir ( ) , ".cargo" ) ;
5555 const cargoRegistry = path . join ( cargoHome , "registry" ) ;
5656 const cargoDownloads = path . join ( cargoHome , "git" ) ;
5757 const defaultArgs = [
58- 'run' ,
59- '--rm' ,
60- '-t' ,
61- '-e' , `BIN=${ binary } ` ,
62- `-v` , `${ this . servicePath } :/code` ,
63- `-v` , `${ cargoRegistry } :/root/.cargo/registry` ,
64- `-v` , `${ cargoDownloads } :/root/.cargo/git` ,
58+ "run" ,
59+ "--rm" ,
60+ "-t" ,
61+ "-e" ,
62+ `BIN=${ binary } ` ,
63+ `-v` ,
64+ `${ this . servicePath } :/code` ,
65+ `-v` ,
66+ `${ cargoRegistry } :/root/.cargo/registry` ,
67+ `-v` ,
68+ `${ cargoDownloads } :/root/.cargo/git`
6569 ] ;
6670 const customArgs = [ ] ;
6771 let cargoFlags = ( funcArgs || { } ) . cargoFlags || this . custom . cargoFlags ;
@@ -114,9 +118,7 @@ class RustPlugin {
114118 const res = this . runDocker ( func . rust , cargoPackage , binary ) ;
115119 if ( res . error || res . status > 0 ) {
116120 this . serverless . cli . log (
117- `Dockerized Rust build encountered an error: ${ res . error } ${
118- res . status
119- } .`
121+ `Dockerized Rust build encountered an error: ${ res . error } ${ res . status } .`
120122 ) ;
121123 throw new Error ( res . error ) ;
122124 }
0 commit comments