UNPKG

@zohodesk/haas-api-creator

Version:

This is used to call server side api call as js api call in client side - hc -api javascript es6

47 lines (44 loc) 1.46 kB
//$Id$ const fs = require('fs'); const path = require('path'); let appPath = fs.realpathSync(process.cwd()); //function converI18n(srcPath, targetPath){ // // let fileContents = fs.readFileSync( srcPath ).toString(); // let newFileContents = "(function(){"; // newFileContents += fileContents.replace("var i18n=","var asapI18NValues="); // newFileContents += ";ZohoHCAsap('_defaultI18N', asapI18NValues); })();" // // fs.writeFileSync(targetPath, newFileContents, 'utf-8'); //} // //function iterateDirectory(srcPath, targetPath){ // fs.readdirSync(srcPath).forEach((fileOrDir)=>{ // let fromPath = path.join(srcPath, fileOrDir); // let toPath = path.join(targetPath, fileOrDir); // if(fs.statSync(fromPath).isDirectory()){ // if (!fs.existsSync(toPath)){ // fs.mkdirSync(toPath); // } // iterateDirectory(fromPath, toPath); // }else{ // let { ext } = path.parse(fromPath); // if (ext === '.js'){ // converI18n(fromPath, toPath); // } // } // }) //} // //let jsI18nDeails = { // './dp/i18n': './dp/i18n' //} // //Object.keys(jsI18nDeails).forEach(function(srcPath){ // let desPath = path.resolve(appPath, jsI18nDeails[srcPath]); // srcPath = path.resolve(appPath, srcPath); // if (!fs.existsSync(desPath)){ // fs.mkdirSync(desPath); // } // iterateDirectory(srcPath, desPath); //})