@@ -14,7 +14,7 @@ const BASE_RUNTIME = "provided";
14
14
const NO_OUTPUT_CAPTURE = { stdio : [ "ignore" , process . stdout , process . stderr ] } ;
15
15
16
16
function includeInvokeHook ( serverlessVersion ) {
17
- let [ major , minor ] = serverlessVersion . split ( '.' ) ;
17
+ let [ major , minor ] = serverlessVersion . split ( "." ) ;
18
18
let majorVersion = parseInt ( major ) ;
19
19
let minorVersion = parseInt ( minor ) ;
20
20
return majorVersion === 1 && minorVersion >= 38 && minorVersion < 40 ;
@@ -28,10 +28,10 @@ class RustPlugin {
28
28
this . servicePath = this . serverless . config . servicePath || "" ;
29
29
this . hooks = {
30
30
"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 )
32
32
} ;
33
33
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 ) ;
35
35
}
36
36
this . custom = Object . assign (
37
37
{
@@ -51,17 +51,21 @@ class RustPlugin {
51
51
}
52
52
53
53
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" ) ;
55
55
const cargoRegistry = path . join ( cargoHome , "registry" ) ;
56
56
const cargoDownloads = path . join ( cargoHome , "git" ) ;
57
57
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`
65
69
] ;
66
70
const customArgs = [ ] ;
67
71
let cargoFlags = ( funcArgs || { } ) . cargoFlags || this . custom . cargoFlags ;
@@ -114,9 +118,7 @@ class RustPlugin {
114
118
const res = this . runDocker ( func . rust , cargoPackage , binary ) ;
115
119
if ( res . error || res . status > 0 ) {
116
120
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 } .`
120
122
) ;
121
123
throw new Error ( res . error ) ;
122
124
}
0 commit comments