* feat: add script to annotate challenges for translation * fix: readdirp-walk -> readdirp * fix: remove notranslate for frontmatter * fix: don't output seed/solution * feat: convert to function Also puts in some missing 'async's to make it clearer what returns promises. * refactor: use meaningful names * refactor: remove comments * chore: update dependencies * chore: move dir * fix(crowdin): annotate individual answers
21 lines
635 B
JavaScript
21 lines
635 B
JavaScript
const { getText } = require('./get-challenge-text');
|
|
const { challengeToString } = require('./create-challenge-string');
|
|
const { parseMD } = require('../../challenge-md-parser/mdx');
|
|
|
|
module.exports.annotate = async function annotate(filePath) {
|
|
return generateTranscribableChallenge(filePath)
|
|
.then(challengeToString)
|
|
.catch(err => {
|
|
console.log('Error transforming');
|
|
console.log(filePath);
|
|
console.log(err);
|
|
});
|
|
};
|
|
|
|
async function generateTranscribableChallenge(fullPath) {
|
|
return Promise.all([parseMD(fullPath), getText(fullPath)]).then(results => ({
|
|
...results[0],
|
|
...results[1]
|
|
}));
|
|
}
|