diff --git a/client/src/templates/Challenges/rechallenge/transformers.js b/client/src/templates/Challenges/rechallenge/transformers.js index 914145b5e44403..2782c98bdf2384 100644 --- a/client/src/templates/Challenges/rechallenge/transformers.js +++ b/client/src/templates/Challenges/rechallenge/transformers.js @@ -13,7 +13,6 @@ import sassData from '../../../../config/browser-scripts/sass-compile.json'; import { transformContents, transformHeadTailAndContents, - setExt, compileHeadTail, createSource } from '../../../../../shared/utils/polyvinyl'; @@ -127,10 +126,10 @@ const getJSXTranspiler = loopProtectOptions => async challengeFile => { await loadBabel(); await loadPresetReact(); const babelOptions = getBabelOptions(presetsJSX, loopProtectOptions); - return flow( - partial(transformHeadTailAndContents, babelTransformCode(babelOptions)), - partial(setExt, 'js') - )(challengeFile); + return transformHeadTailAndContents( + babelTransformCode(babelOptions), + challengeFile + ); }; const getTSTranspiler = loopProtectOptions => async challengeFile => { @@ -265,9 +264,7 @@ export const embedFilesInHtml = async function (challengeFiles) { function challengeFilesToObject(challengeFiles) { const indexHtml = challengeFiles.find(file => file.fileKey === 'indexhtml'); - const indexJsx = challengeFiles.find( - file => file.fileKey === 'indexjs' && file.history[0] === 'index.jsx' - ); + const indexJsx = challengeFiles.find(file => file.fileKey === 'indexjsx'); const stylesCss = challengeFiles.find(file => file.fileKey === 'stylescss'); const scriptJs = challengeFiles.find(file => file.fileKey === 'scriptjs'); const indexTs = challengeFiles.find(file => file.fileKey === 'indexts'); diff --git a/shared/utils/polyvinyl.ts b/shared/utils/polyvinyl.ts index d1fd07a402cfdc..ecfbed6e47669d 100644 --- a/shared/utils/polyvinyl.ts +++ b/shared/utils/polyvinyl.ts @@ -100,19 +100,6 @@ export function setContent( }; } -export async function setExt(ext: string, polyP: Promise) { - const poly = await polyP; - checkPoly(poly); - const newPoly = { - ...poly, - ext, - path: poly.name + '.' + ext, - fileKey: poly.name + ext - }; - newPoly.history = [...poly.history, newPoly.path]; - return newPoly; -} - // This is currently only used to add back properties that are not stored in the // database. export function regeneratePathAndHistory(poly: ChallengeFile) {