INNER CODE UNIT · JavaScript
postImportIndex
madlabsinc/mevn-cli · src/commands/generate/index.js:132
const postImportIndex = serverFileContent.findIndex((item) => item === '');
// second occurrence
const requiredIndex = serverFileContent.indexOf('', postImportIndex + 1);
// Include a new line to compensate the previous addition
serverFileContent.splice(
requiredIndex + 1,
0,
'require("./helpers/db/mongodb.js")();',
'',
);
fs.writeFileSync(serverFilePath, serverFileContent.join('\n'));
};