Files
wordpress-export-to-markdown/index.js
T

25 lines
710 B
JavaScript
Raw Normal View History

2020-01-14 10:26:50 -05:00
const path = require('path');
const wizard = require('./src/wizard');
const parser = require('./src/parser');
2019-12-17 13:52:09 -05:00
const writer = require('./src/writer');
2018-10-14 18:46:24 -04:00
2019-12-21 16:07:52 -05:00
(async () => {
2020-01-14 10:26:50 -05:00
// parse any command line arguments and run wizard
2020-01-12 09:03:32 -05:00
let config = await wizard.getConfig();
2020-01-14 10:26:50 -05:00
// parse data from XML and do Markdown translations
2019-12-21 16:07:52 -05:00
let posts = await parser.parseFilePromise(config)
2020-01-14 10:26:50 -05:00
// write files, downloading images as needed
2019-12-21 16:07:52 -05:00
await writer.writeFilesPromise(posts, config);
2020-01-14 10:26:50 -05:00
// happy goodbye
console.log('\nAll done!');
console.log('Look for your output files in: ' + path.resolve(config.output));
2019-12-21 16:07:52 -05:00
})().catch(ex => {
2020-01-14 10:26:50 -05:00
// sad goodbye
console.log('\nSomething went wrong, execution halted early.');
2019-12-21 16:07:52 -05:00
console.error(ex);
});