diff --git a/playground/package.json b/playground/package.json index 6af6628..90e35ce 100644 --- a/playground/package.json +++ b/playground/package.json @@ -28,7 +28,7 @@ "uuid": "2e84e366-1e09-43c2-a99f-a0d0acbc2ca5" }, "engines": { - "node": ">=14.x.x <=16.x.x", + "node": ">=12.x.x <=16.x.x", "npm": ">=6.0.0" }, "license": "MIT" diff --git a/server/services/main.js b/server/services/main.js index d353484..79f6018 100644 --- a/server/services/main.js +++ b/server/services/main.js @@ -24,9 +24,8 @@ module.exports = () => ({ const shouldExclude = !isEmpty(strapi.config.get('plugin.config-sync.excludedConfig').filter((option) => `${configType}.${configName}`.startsWith(option))); if (shouldExclude) return; - // Replace reserved characters in filenames. + // Replace ':' with '#' in filenames for Windows support. configName = configName.replace(/:/g, "#"); - configName = configName.replace(/\//g, "$"); // Check if the JSON content should be minified. const json = !strapi.config.get('plugin.config-sync').minify @@ -60,9 +59,8 @@ module.exports = () => ({ const shouldExclude = !isEmpty(strapi.config.get('plugin.config-sync.excludedConfig').filter((option) => configName.startsWith(option))); if (shouldExclude) return; - // Replace reserved characters in filenames. + // Replace ':' with '#' in filenames for Windows support. configName = configName.replace(/:/g, "#"); - configName = configName.replace(/\//g, "$"); fs.unlinkSync(`${strapi.config.get('plugin.config-sync.syncDir')}${configName}.json`); }, @@ -75,9 +73,8 @@ module.exports = () => ({ * @returns {object} The JSON content of the config file. */ readConfigFile: async (configType, configName) => { - // Replace reserved characters in filenames. + // Replace ':' with '#' in filenames for Windows support. configName = configName.replace(/:/g, "#"); - configName = configName.replace(/\//g, "$"); const readFile = util.promisify(fs.readFile); return readFile(`${strapi.config.get('plugin.config-sync.syncDir')}${configType}.${configName}.json`) @@ -110,9 +107,8 @@ module.exports = () => ({ const type = file.split('.')[0]; // Grab the first part of the filename. const name = file.split(/\.(.+)/)[1].split('.').slice(0, -1).join('.'); // Grab the rest of the filename minus the file extension. - // Put back reserved characters from filenames. - let formattedName = name.replace(/#/g, ":"); - formattedName = name.replace(/\$/g, "/"); + // Replace ':' with '#' in filenames for Windows support. + const formattedName = name.replace(/#/g, ":"); if ( configType && configType !== type