@@ -2,10 +2,7 @@ const BbPromise = require('bluebird');
2
2
const fse = require ( 'fs-extra' ) ;
3
3
const path = require ( 'path' ) ;
4
4
const JSZip = require ( 'jszip' ) ;
5
- const {
6
- writeZip,
7
- addTree
8
- } = require ( './zipTree' ) ;
5
+ const { writeZip, addTree } = require ( './zipTree' ) ;
9
6
10
7
BbPromise . promisifyAll ( fse ) ;
11
8
@@ -17,10 +14,10 @@ function getRunTimeBuildPaths() {
17
14
const runtimepaths = {
18
15
'python2.7' : 'python' ,
19
16
'python3.6' : path . join ( 'python' , 'lib' , 'python3.6' , 'site-packages' ) ,
20
- 'python3.7' : path . join ( 'python' , 'lib' , 'python3.7' , 'site-packages' ) ,
17
+ 'python3.7' : path . join ( 'python' , 'lib' , 'python3.7' , 'site-packages' )
21
18
} ;
22
19
23
- let runtimes = [ ]
20
+ let runtimes = [ ] ;
24
21
25
22
// Defer to Layer config first
26
23
if ( this . options . layer . compatibleRuntimes ) {
@@ -43,22 +40,27 @@ function getRunTimeBuildPaths() {
43
40
*/
44
41
function zipRequirements ( runtimepaths ) {
45
42
const rootZip = new JSZip ( ) ;
46
- const src = path . join ( '.serverless' , 'requirements' )
43
+ const src = path . join ( '.serverless' , 'requirements' ) ;
47
44
48
- return BbPromise . each ( runtimepaths , ( runtimepath ) => addTree ( rootZip . folder ( runtimepath ) , src ) )
49
- . then ( ( ) => writeZip ( rootZip , path . join ( '.serverless' , 'pythonRequirementsLayer.zip' ) ) )
45
+ return BbPromise . each ( runtimepaths , runtimepath =>
46
+ addTree ( rootZip . folder ( runtimepath ) , src )
47
+ ) . then ( ( ) =>
48
+ writeZip ( rootZip , path . join ( '.serverless' , 'pythonRequirementsLayer.zip' ) )
49
+ ) ;
50
50
}
51
51
52
52
/**
53
53
* Creates a layer on the serverless service for the requirements zip.
54
54
* @return {Promise } empty promise
55
55
*/
56
56
function createLayers ( ) {
57
- this . serverless . service . layers [ 'pythonRequirements' ] = Object . assign ( {
57
+ this . serverless . service . layers [ 'pythonRequirements' ] = Object . assign (
58
+ {
58
59
artifact : path . join ( '.serverless' , 'pythonRequirements.zip' ) ,
59
60
name : `${ this . serverless . service . stage } -python-requirements` ,
60
- description : 'Python requirements generated by serverless-python-requirements.' ,
61
- compatibleRuntimes : [ this . serverless . service . provider . runtime ] ,
61
+ description :
62
+ 'Python requirements generated by serverless-python-requirements.' ,
63
+ compatibleRuntimes : [ this . serverless . service . provider . runtime ]
62
64
} ,
63
65
this . options . layer
64
66
) ;
0 commit comments