File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
packages/app/src/app/store/providers/Utils/create-zip Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,40 @@ export function createPackageJSON(
7676) {
7777 const name = slugify ( sandbox . title || sandbox . id ) ;
7878 const version = `0.0.${ sandbox . version } ` ;
79+
80+ const packageJSONModule = sandbox . modules . find (
81+ m => m . directoryShortid == null && m . title === 'package.json'
82+ ) ;
83+
84+ try {
85+ if ( packageJSONModule ) {
86+ const packageJSON = JSON . parse ( packageJSONModule . code || '' ) ;
87+
88+ return JSON . stringify (
89+ {
90+ ...packageJSON ,
91+ name,
92+ description : packageJSON . description || sandbox . description ,
93+ version,
94+ dependencies : { ...dependencies , ...packageJSON . dependencies } ,
95+ devDependencies : {
96+ ...devDependencies ,
97+ ...packageJSON . devDependencies ,
98+ } ,
99+ scripts : {
100+ ...scripts ,
101+ ...packageJSON . scripts ,
102+ } ,
103+ ...( extra || { } ) ,
104+ } ,
105+ null ,
106+ ' '
107+ ) ;
108+ }
109+ } catch ( e ) {
110+ /* fallback */
111+ }
112+
79113 const npmDependencies =
80114 typeof sandbox . npmDependencies . toJS === 'function'
81115 ? sandbox . npmDependencies . toJS ( )
You can’t perform that action at this time.
0 commit comments