Convert this autocmd in vimrc to neovim lua

I want to run this command for *.cpp files only
Convert this into neovim lua

autocmd vimEnter *.cpp map :w :!clear ; g++ %; if [ -f a.out ]; then time ./a.out; rm a.out; fi

vim.api.nvim_create_autocmd(
    'vimEnter',
    {
        pattern='*.cpp',
        command='!clear ; g++ %; if [ -f a.out ]; then time ./a.out; rm a.out; fi'
    }
)