11'use strict' ;
22
3+ const { isEmpty } = require ( 'lodash' ) ;
34const fs = require ( 'fs' ) ;
45const util = require ( 'util' ) ;
56const difference = require ( '../utils/getObjectDiff' ) ;
@@ -19,7 +20,7 @@ module.exports = () => ({
1920 */
2021 writeConfigFile : async ( configType , configName , fileContents ) => {
2122 // Check if the config should be excluded.
22- const shouldExclude = strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . includes ( `${ configType } .${ configName } ` ) ;
23+ const shouldExclude = ! isEmpty ( strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . filter ( ( option ) => `${ configType } .${ configName } ` . startsWith ( option ) ) ) ;
2324 if ( shouldExclude ) return ;
2425
2526 // Replace ':' with '#' in filenames for Windows support.
@@ -54,7 +55,7 @@ module.exports = () => ({
5455 */
5556 deleteConfigFile : async ( configName ) => {
5657 // Check if the config should be excluded.
57- const shouldExclude = strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . includes ( ` ${ configName } ` ) ;
58+ const shouldExclude = ! isEmpty ( strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . filter ( ( option ) => configName . startsWith ( option ) ) ) ;
5859 if ( shouldExclude ) return ;
5960
6061 // Replace ':' with '#' in filenames for Windows support.
@@ -111,7 +112,7 @@ module.exports = () => ({
111112 if (
112113 configType && configType !== type
113114 || ! strapi . plugin ( 'config-sync' ) . types [ type ]
114- || strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . includes ( `${ type } .${ name } ` )
115+ || ! isEmpty ( strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . filter ( ( option ) => `${ type } .${ name } ` . startsWith ( option ) ) )
115116 ) {
116117 return ;
117118 }
@@ -210,7 +211,7 @@ module.exports = () => ({
210211 */
211212 importSingleConfig : async ( configName , onSuccess ) => {
212213 // Check if the config should be excluded.
213- const shouldExclude = strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . includes ( configName ) ;
214+ const shouldExclude = ! isEmpty ( strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . filter ( ( option ) => configName . startsWith ( option ) ) ) ;
214215 if ( shouldExclude ) return ;
215216
216217 const type = configName . split ( '.' ) [ 0 ] ; // Grab the first part of the filename.
@@ -236,7 +237,7 @@ module.exports = () => ({
236237 */
237238 exportSingleConfig : async ( configName , onSuccess ) => {
238239 // Check if the config should be excluded.
239- const shouldExclude = strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . includes ( configName ) ;
240+ const shouldExclude = ! isEmpty ( strapi . config . get ( 'plugin.config-sync.excludedConfig' ) . filter ( ( option ) => configName . startsWith ( option ) ) ) ;
240241 if ( shouldExclude ) return ;
241242
242243 const type = configName . split ( '.' ) [ 0 ] ; // Grab the first part of the filename.
0 commit comments