import fs from 'fs'; import _ from 'lodash'; import {appList, ScopeApp, navList, ScopeRoute} from './function.mjs'; let appMapContent = 'export const appMap = {'; for (const item of appList) { const originName = item.name; item.name = `${ScopeApp}.${item.name}`; appMapContent += `\n ${originName}: ${JSON.stringify(item)},`; } appMapContent += '\n}'; appMapContent += `\nexport const navMap = {`; for (const item of navList) { const originName = item.name; item.name = `${ScopeRoute}.${item.name}`; appMapContent += `\n ${originName}: ${JSON.stringify(item)},`; } appMapContent += '\n};'; try { fs.writeFileSync(`./moduleMap.ts`, appMapContent); console.log(`file written successfully :>> moduleMap.ts\n`); } catch (err) { console.error(err); }