<|start_filename|>lib/module.js<|end_filename|>
const { resolve } = require('path')
const defu = require('defu')
const log = require('consola').withScope('nuxt-ackee')

const defaults = {
  server: '',
  domainId: '',
  detailed: false,
  ignoreLocalhost: true,
  ignoreOwnVisits: true,
  storageKey: 'nuxt-ackee'
}

module.exports = function (moduleOptions) {
  const options = defu({
    ...this.options.ackee,
    ...moduleOptions
  }, defaults)

  if (!options.server || !options.domainId) {
    return log.warn('Could not activate nuxt-ackee module, `server` and `domainId` properties are required')
  }

  this.addPlugin({
    src: resolve(__dirname, 'templates', 'plugin.server.js'),
    fileName: 'nuxt-ackee.server.js',
    options
  })
  this.addPlugin({
    src: resolve(__dirname, 'templates', 'plugin.client.js'),
    ssr: false,
    fileName: 'nuxt-ackee.client.js',
    options
  })
}

module.exports.meta = require('../package.json')


<|start_filename|>example/nuxt.config.js<|end_filename|>
const { resolve } = require('path')

module.exports = {
  rootDir: resolve(__dirname, '..'),
  buildDir: resolve(__dirname, '.nuxt'),
  srcDir: __dirname,
  render: {
    resourceHints: false
  },
  buildModules: [{ handler: require('../') }],
  ackee: {
    server: 'https://example.com',
    domainId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
    detailed: 'opt-in',
    ignoreLocalhost: false,
    ignoreOwnVisits: false
  },
  publicRuntimeConfig: {
    ackeeTestEvent: 'ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj'
  }
}


<|start_filename|>docs/nuxt.config.js<|end_filename|>
import { withDocus } from 'docus'

export default withDocus({
  docs: {
    colors: {
      primary: '#65deb1'
    }
  },
  buildModules: ['nuxt-ackee'],
  ackee: {
    server: 'https://ackee.nuxtjs.com',
    domainId: '',
    detailed: true
  }
})
