Possibility to choose the number of space for the indentation

This commit is contained in:
BIEBER Baptiste 2018-08-30 17:46:37 +02:00
Родитель 7ed746d708
Коммит f99747d27a
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -47,7 +47,8 @@ $ sgp -h
sgp({ sgp({
'src':'', // salesforce src directory path : ./src 'src':'', // salesforce src directory path : ./src
'40.0':'', // salesforce API verion : 40.0 '40.0':'', // salesforce API verion : 40.0
'src':'' // salesforce src directory path : ./src 'output':'', // salesforce src directory path : ./src
'indent':' ' // the number of space for the xml indentation (optionnal attibute)
}, console.log); }, console.log);
``` ```
@ -69,6 +70,7 @@ Add CLI parameters to build package.xml for only certain types
## Authors ## Authors
* **Sebastien Colladon** - *Initial work* - [scolladon](https://github.com/scolladon) * **Sebastien Colladon** - *Initial work* - [scolladon](https://github.com/scolladon)
* **Baptiste Bieber** - *Add functionalities* - [baptistebieber](https://github.com/baptistebieber)
## License ## License

Просмотреть файл

@ -29,7 +29,7 @@ module.exports = (config,logger) => {
[].concat(...result).filter(elem => !!elem).forEach(elem => xml.importDocument(elem)); [].concat(...result).filter(elem => !!elem).forEach(elem => xml.importDocument(elem));
xml.ele('version') xml.ele('version')
.t(config.apiVersion); .t(config.apiVersion);
const xmlContent = xml.end({ pretty: true, indent: ' ', newline: '\n' }); const xmlContent = xml.end({ pretty: true, indent: config.indent || ' ', newline: '\n' });
fs.writeFileSync(config.output + '/' + PACKAGE_XML_FILE_NAME, xmlContent); fs.writeFileSync(config.output + '/' + PACKAGE_XML_FILE_NAME, xmlContent);
resolve(); resolve();
}).catch(reject); }).catch(reject);