@@ -63,6 +63,7 @@ class Compile {
6363 compileFunction ( functionObject ) {
6464 return new Promise ( ( resolve ) => {
6565 const projectPath = path . normalize ( this . sqz . vars . project . path ) ;
66+ const projectRuntime = this . sqz . vars . project . runtime ;
6667 const source = path . join ( functionObject . path , 'src' ) ;
6768 const output = path . join ( projectPath , '.build' , this . compileType , 'functions' , functionObject . identifier ) ;
6869
@@ -86,17 +87,26 @@ class Compile {
8687
8788 if ( this . compileType === 'cloud' ) {
8889 const treeData = JSON . parse ( fs . readFileSync ( path . join ( projectPath , '.build' , 'tree.json' ) ) ) ;
89- _ . forEach ( treeData . functions [ functionObject . name ] . packages , ( obj ) => {
90- const functionPackagesHook = path . join ( projectPath , 'lib' , 'hooks' , 'commands' , 'compile' , this . compileType , 'package.yml' ) ;
91-
92- compileCmds = _ . concat (
93- compileCmds ,
94- this . sqz . yaml . parse ( functionPackagesHook , Object . assign ( options , {
95- pkg : obj . pkg ,
96- version : obj . version
97- } ) )
98- ) ;
99- } ) ;
90+
91+ if ( projectRuntime === 'nodejs' ) {
92+ const packagesData = {
93+ license : 'UNLICENSED' ,
94+ dependencies : { }
95+ } ;
96+
97+ _ . forEach ( treeData . functions [ functionObject . name ] . packages , ( obj ) => {
98+ packagesData . dependencies [ obj . pkg ] = obj . version ;
99+ } ) ;
100+
101+ fs . writeFileSync ( path . join ( output , 'package.json' ) , JSON . stringify ( packagesData , null , 2 ) ) ;
102+ }
103+
104+ const functionPackagesHook = path . join ( projectPath , 'lib' , 'hooks' , 'commands' , 'compile' , this . compileType , 'package.yml' ) ;
105+
106+ compileCmds = _ . concat (
107+ compileCmds ,
108+ this . sqz . yaml . parse ( functionPackagesHook , options )
109+ ) ;
100110 }
101111
102112 if ( ! _ . isEmpty ( compileCmds ) ) {
0 commit comments