Skip to content

Commit

Permalink
reverse last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmatatjahu committed Mar 4, 2021
1 parent f8ff55d commit 785b3f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 0 additions & 2 deletions lib/renderer/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ reactExport.configureReact = async (templateLocation, templateContentDir, transp
*/
reactExport.renderReact = async (asyncapiDocument, filePath, extraTemplateData, templateLocation, templateContentDir, transpiledTemplateLocation, templateParams, debug, originalAsyncAPI) => {
extraTemplateData = extraTemplateData || {};
filePath = changeExtenstionToJS(filePath);
filePath = filePath.replace(templateContentDir, path.resolve(templateLocation, transpiledTemplateLocation));

return await AsyncReactSDK.renderTemplate(
filePath,
{
Expand Down
13 changes: 1 addition & 12 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,7 @@ utils.isFilePath = (str) => {
*/
utils.isJsFile = (filepath) => {
const ext = filepath.split('.').pop() || '';
return ['js', 'jsx', 'cjs', 'tsx'].includes(ext);
};

/**
* Change file's extension to .js
*
* @param {String} filename information representing file path
* @returns {Boolean}
*/
utils.changeExtenstionToJS = (filename) => {
const basename = path.basename(filename, path.extname(filename));
return path.join(path.dirname(filename), basename + '.js');
return ['js', 'jsx', 'cjs'].includes(ext);
};

/**
Expand Down

0 comments on commit 785b3f4

Please sign in to comment.