Add beautify setting for the json exports

pull/1/head
Boaz Poolman 2021-03-19 22:27:29 +01:00
parent 2535d76909
commit e4b5c1d0f9
2 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
{ {
"destination": "extensions/config/files/", "destination": "extensions/config/files/",
"beautify": true,
"exclude": [] "exclude": []
} }

View File

@ -11,10 +11,15 @@ const util = require('util');
module.exports = { module.exports = {
writeConfigFile: async (configName, fileContents) => { writeConfigFile: async (configName, fileContents) => {
const json =
strapi.plugins.config.config.beautify ?
JSON.stringify(JSON.parse(fileContents), null, 2)
: fileContents;
await strapi.fs.writePluginFile( await strapi.fs.writePluginFile(
'config', 'config',
`files/${configName}.json`, `files/${configName}.json`,
fileContents json
); );
}, },