INNER CODE UNIT · JavaScript
configureNuxtVuexStore
madlabsinc/mevn-cli · src/commands/add/index.js:208
const configureNuxtVuexStore = () => {
const vuexNuxtStoreTemplate = [
'export const state = () => ({',
' counter: 0,',
'})',
'',
'export const mutations = {',
' increment (state) {',
'\tstate.counter++',
' },',
'}',
];
// Navigate to the store directory and create a basic store template file
const storeFilePath = path.join('client', 'store', 'index.js');
if (!fs.existsSync(storeFilePath)) {
fs.writeFileSync(storeFilePath, vuexNuxtStoreTemplate.join('\n'));
}