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 4747 "@strapi/design-system" : " 2.0.0-rc.11" ,
4848 "@strapi/icons" : " 2.0.0-rc.11" ,
4949 "@strapi/utils" : " 5.2.0" ,
50+ "adm-zip" : " ^0.5.16" ,
5051 "chalk" : " ^4.1.2" ,
5152 "cli-table" : " ^0.3.6" ,
5253 "commander" : " ^8.3.0" ,
Original file line number Diff line number Diff line change 33import isEmpty from 'lodash/isEmpty' ;
44import fs from 'fs' ;
55import util from 'util' ;
6- import childProcess from "child_process" ;
6+ import AdmZip from 'adm-zip' ;
7+
78import difference from '../utils/getObjectDiff' ;
89import { logMessage } from '../utils' ;
910
@@ -73,13 +74,12 @@ export default () => ({
7374 * @returns {void }
7475 */
7576 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+
8383 return { base64Data, name : fileName , message : 'Success' } ;
8484 } ,
8585
Original file line number Diff line number Diff line change 39133913 resolved "https://registry.yarnpkg.com/addressparser/-/addressparser-1.0.1.tgz#47afbe1a2a9262191db6838e4fd1d39b40821746"
39143914 integrity sha512-aQX7AISOMM7HFE0iZ3+YnD07oIeJqWGVnJ+ZIKaBZAk03ftmVYVqsGas/rbXKR21n4D/hKCSHypvcyOkds/xzg==
39153915
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+
39163921aggregate-error@^3.0.0:
39173922 version "3.1.0"
39183923 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