Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const store = createStore(rootReducer, applyMiddleware(sagaMiddleware));
// Set emoji data:
const languageFromEnv = (process.env.LANG || 'en').split('.')[0].split('_')[0];
const languageFromArgs = cli.flags.dango ? 'en' : cli.input[0];
let language = languageFromArgs || languageFromEnv;
if (!['en', 'de'].includes(language)) {
logUpdate(`⌨ ${language} not upported, using en`);
logUpdate.done();
language = 'en';
} else {
logUpdate(`⌨ ${language}`);
logUpdate.done();
}
const data = getDataForLanguage(language);
sagaMiddleware.run(inputEmojiSequenceSubmitted);
if (cli.flags.dango) {
sagaMiddleware.run(currentQueryChanged, data); // data still needed for annotations!
} else {
store.dispatch(setFindSuggestedEmoji(createSelectSuggestedEmojiForQuery(data)));
}
// Render once initially and every time the store changes:
const render = () => logUpdate(selectStyledInput(store.getState()));
// const render = () => {
getNameForCodepoint: unicodeData.getNameForCodepoint,
getVariationSequencesForCodepoint: standardizedVariants.getVariationSequencesForCodepoint,
getCombinationsForCodepoint: emojiSequences.getCombinationsForCodepoint,
getShiftJisCodesForCodepoint: emojiSources.getShiftJisCodesForCodepoint,
});
logUpdate('✓ emoji-data');
logUpdate.done();
logUpdate('⇣ emoji-zwj-sequences');
const emojiZwjSequences = yield buildEmojiZwjSequences({
url: preset.emojiZwjSequencesUrl,
getNameForCodepoint: unicodeData.getNameForCodepoint,
getMetaForModifierName: emojiData.getMetaForModifierName,
});
logUpdate('✓ emoji-zwj-sequences');
logUpdate.done();
// Render emoji data file containing compact, nested emoji data:
logUpdate('⇣ write data file');
const combined = [
...emojiData.emoji,
...emojiSequences.flagEmoji,
...emojiZwjSequences.zwjEmoji,
];
fs.writeFileSync('res/emoji-data.json', JSON.stringify(combined, null, 2));
logUpdate('✓ write data file');
logUpdate.done();
// Create temporary expanded human readable emoji data containing flattened
function done(result?: string) {
clearInterval(interval);
let log = chalk`{green {bold \u2713}} ${task}`;
if (result !== void 0) {
log += chalk` {grey ${result}}`;
}
logUpdate(log);
logUpdate.done();
interval = null;
task = '';
}
export function logError(err: Error) {
logUpdate.done()
console.error(chalk.red(err.stack || err.message))
}
const numSequencesMissingTtsCoveredByCommunity = result.sequencesMissingAnnotations.filter(datum => datum.tts === 'covered').length;
const numSequencesMissingKeywordsCoveredByCommunity = result.sequencesMissingAnnotations.filter(datum => datum.keywords === 'covered').length;
if (numSequencesMissingTts > 0 || numSequencesMissingKeywords > 0) {
logUpdate(`x check-annotations ${result.language}:`);
logUpdate.done();
if (numSequencesMissingTts > 0) {
logUpdate(` ${numSequencesMissingTts} sequences missing tts (${numSequencesMissingTtsCoveredByCommunity} covered by community)`);
logUpdate.done();
}
if (numSequencesMissingKeywords > 0) {
logUpdate(` ${numSequencesMissingKeywords} sequences missing keywords (${numSequencesMissingKeywordsCoveredByCommunity} covered by community)`);
logUpdate.done();
}
fs.writeFileSync(`./lib/annotations/coverage/${result.language}.json`, JSON.stringify(result.sequencesMissingAnnotations, null, 2));
logUpdate(` coverage report saved`);
logUpdate.done();
return false;
}
logUpdate(`✓ check-annotations ${result.language}`);
logUpdate.done();
return prevSuccess;
}, true);
logUpdate(`${success ? '✓' : 'x'} check-annotations`);
static debug(message, data = null, callback = null) {
logUpdate.clear();
Logger.getInstance().debug(message, data, callback);
logUpdate.done();
}
end(err) {
if (this._id) {
clearInterval(this._id);
this._id = undefined;
}
render(this._tasks, this._options);
if (this._options.clearOutput && err === undefined) {
logUpdate.clear();
} else {
logUpdate.done();
}
}
}