feat(seed): "unpack" and "repack" scripts
add "npm run seed" as alias to "node seed" unpack tests and solution into HTML file; add titles and help text; style unpacked file enable running unpacked assert tests in browser Using browserify, compile "tape", "lodash", jQuery into "unpacked-bundle.js" for use during in-browser unpacked tests feat(seed): diff after repacking feat(seed): unpacked tests use Browser TAP chrome dev tool if available
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
0c6141289b
commit
a8484873d8
@@ -52,16 +52,16 @@ function createNewTranslations(challenge) {
|
||||
newTranslation = {};
|
||||
newTranslation[matches[1]] = challenge[oldKey];
|
||||
translations[tag] = translations[tag] ?
|
||||
Object.assign({}, translations[tag], newTranslation) :
|
||||
Object.assign({}, newTranslation);
|
||||
({...translations[tag], ...newTranslation}) :
|
||||
({...newTranslation});
|
||||
return translations;
|
||||
}
|
||||
matches = oldKey.match(oldNameRegex);
|
||||
tag = normalizeLangTag(matches[1]);
|
||||
newTranslation = { title: challenge[oldKey] };
|
||||
translations[tag] = translations[tag] ?
|
||||
Object.assign({}, translations[tag], newTranslation) :
|
||||
Object.assign({}, newTranslation);
|
||||
({...translations[tag], ...newTranslation}) :
|
||||
({...newTranslation});
|
||||
return translations;
|
||||
}, {});
|
||||
}
|
||||
@@ -71,11 +71,10 @@ function normalizeChallenge(challenge) {
|
||||
challenge.translations = challenge.translations || {};
|
||||
var hasOldTranslations = keys.some(hasOldTranslation);
|
||||
if (hasOldTranslations) {
|
||||
challenge.translations = Object.assign(
|
||||
{},
|
||||
challenge.translations,
|
||||
createNewTranslations(challenge)
|
||||
);
|
||||
challenge.translations = ({
|
||||
...challenge.translations,
|
||||
...createNewTranslations(challenge)
|
||||
});
|
||||
}
|
||||
challenge.translations = sortTranslationsKeys(challenge.translations);
|
||||
// remove old translations from the top level
|
||||
|
Reference in New Issue
Block a user