File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 47
47
"@strapi/design-system" : " 2.0.0-rc.11" ,
48
48
"@strapi/icons" : " 2.0.0-rc.11" ,
49
49
"@strapi/utils" : " 5.2.0" ,
50
+ "adm-zip" : " ^0.5.16" ,
50
51
"chalk" : " ^4.1.2" ,
51
52
"cli-table" : " ^0.3.6" ,
52
53
"commander" : " ^8.3.0" ,
Original file line number Diff line number Diff line change 3
3
import isEmpty from 'lodash/isEmpty' ;
4
4
import fs from 'fs' ;
5
5
import util from 'util' ;
6
- import childProcess from "child_process" ;
6
+ import AdmZip from 'adm-zip' ;
7
+
7
8
import difference from '../utils/getObjectDiff' ;
8
9
import { logMessage } from '../utils' ;
9
10
@@ -73,13 +74,12 @@ export default () => ({
73
74
* @returns {void }
74
75
*/
75
76
zipConfigFiles : async ( ) => {
76
- const fileName = `config-${ new Date ( ) . toJSON ( ) } .zip` ;
77
- childProcess . execSync ( `zip -r ${ fileName } *` , {
78
- cwd : strapi . config . get ( 'plugin.config-sync.syncDir' ) ,
79
- } ) ;
80
- const fullFilePath = `${ strapi . config . get ( 'plugin.config-sync.syncDir' ) } ${ fileName } ` ;
81
- const base64Data = fs . readFileSync ( fullFilePath , { encoding : 'base64' } ) ;
82
- fs . unlinkSync ( fullFilePath ) ;
77
+ const fileName = `config-sync-${ new Date ( ) . toJSON ( ) } .zip` ;
78
+
79
+ const zip = new AdmZip ( ) ;
80
+ zip . addLocalFolder ( strapi . config . get ( 'plugin.config-sync.syncDir' ) ) ;
81
+ const base64Data = zip . toBuffer ( ) . toString ( 'base64' ) ;
82
+
83
83
return { base64Data, name : fileName , message : 'Success' } ;
84
84
} ,
85
85
Original file line number Diff line number Diff line change @@ -3913,6 +3913,11 @@ addressparser@1.0.1:
3913
3913
resolved "https://registry.yarnpkg.com/addressparser/-/addressparser-1.0.1.tgz#47afbe1a2a9262191db6838e4fd1d39b40821746"
3914
3914
integrity sha512-aQX7AISOMM7HFE0iZ3+YnD07oIeJqWGVnJ+ZIKaBZAk03ftmVYVqsGas/rbXKR21n4D/hKCSHypvcyOkds/xzg==
3915
3915
3916
+ adm-zip@^0.5.16:
3917
+ version "0.5.16"
3918
+ resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.16.tgz#0b5e4c779f07dedea5805cdccb1147071d94a909"
3919
+ integrity sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==
3920
+
3916
3921
aggregate-error@^3.0.0:
3917
3922
version "3.1.0"
3918
3923
resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a"
You can’t perform that action at this time.
0 commit comments