From f78d6643b73acf68f8d0084b249bd446d0ccce02 Mon Sep 17 00:00:00 2001 From: Boaz Poolman Date: Wed, 12 May 2021 17:24:42 +0200 Subject: [PATCH 1/2] :bug: :wrench: chore: husky git hooks fix: added windows support --- .husky/.gitignore | 1 + .husky/commit-msg | 0 .husky/pre-commit | 0 package.json | 3 +++ services/core-store.js | 2 +- services/main.js | 10 +++++----- 6 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .husky/.gitignore mode change 100644 => 100755 .husky/commit-msg mode change 100644 => 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..31354ec --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/commit-msg b/.husky/commit-msg old mode 100644 new mode 100755 diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 diff --git a/package.json b/package.json index 9d74880..2e3f901 100644 --- a/package.json +++ b/package.json @@ -41,5 +41,8 @@ "license": "MIT", "devDependencies": { "husky": "^6.0.0" + }, + "scripts": { + "prepare": "husky install" } } diff --git a/services/core-store.js b/services/core-store.js index 0fb1916..64037ad 100644 --- a/services/core-store.js +++ b/services/core-store.js @@ -45,7 +45,7 @@ module.exports = { ) { await strapi.plugins['config-sync'].services.main.deleteConfigFile(configName); } else { - await strapi.plugins['config-sync'].services.main.writeConfigFile(configPrefix, currentConfig.key, currentConfig); + await strapi.plugins['config-sync'].services.main.writeConfigFile(configPrefix, currentConfig.key.replace('::', '##'), currentConfig); } })); }, diff --git a/services/main.js b/services/main.js index 9537d13..c89d404 100644 --- a/services/main.js +++ b/services/main.js @@ -22,9 +22,9 @@ module.exports = { const shouldExclude = strapi.plugins['config-sync'].config.exclude.includes(`${configType}.${configName}`); if (shouldExclude) return; - // Check if the JSON content should be minified. - const json = - !strapi.plugins['config-sync'].config.minify ? + // Check if the JSON content should be minified. + const json = + !strapi.plugins['config-sync'].config.minify ? JSON.stringify(fileContents, null, 2) : JSON.stringify(fileContents); @@ -94,7 +94,7 @@ module.exports = { await Promise.all(configFiles.map(async (file) => { 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. + const name = file.split(/\.(.+)/)[1].split('.').slice(0, -1).join('.').replace('##', '::'); // Grab the rest of the filename minus the file extension. if ( configType && configType !== type || @@ -201,6 +201,6 @@ module.exports = { * @returns {void} */ exportSingleConfig: async (configType, configName) => { - + }, }; From 7a5a8843e3f80c08ae78655531319bb7b25f2c53 Mon Sep 17 00:00:00 2001 From: alexzrp <87832147+alexzrp@users.noreply.github.com> Date: Tue, 21 Sep 2021 17:53:08 -0300 Subject: [PATCH 2/2] :bug: fix: added windows support --- services/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/main.js b/services/main.js index c89d404..6d3ab29 100644 --- a/services/main.js +++ b/services/main.js @@ -93,7 +93,7 @@ module.exports = { let fileConfigs = {}; await Promise.all(configFiles.map(async (file) => { - const type = file.split('.')[0]; // Grab the first part of the filename. + const type = file.split('.')[0].replace('##', '::'); // Grab the first part of the filename. const name = file.split(/\.(.+)/)[1].split('.').slice(0, -1).join('.').replace('##', '::'); // Grab the rest of the filename minus the file extension. if (