INNER CODE UNIT · JavaScript
blankLineIndex
madlabsinc/mevn-cli · src/commands/add/index.js:552
const blankLineIndex = config.indexOf(config.find((line) => line === ''));
// Inserting the import statement for vuex-store
config.splice(blankLineIndex, 0, `import store from "./store";`);
// Fetching the position where in which router is passed on to the Vue instance
const routerIndex = config.indexOf(
config.find((line) => line.trim() === 'router,'),
);
// Insert store just after router so that it gets passed on to the Vue instance
config.splice(routerIndex + 1, 0, ` store,`);
// Cleaning up
if (deps.includes('vuetify')) config.splice(blankLineIndex + 1, 1);
// Write back the updated config
fs.writeFileSync(configFilePath, config.join('\n'));