How to use the nuxt.Generator function in nuxt

To help you get started, we’ve selected a few nuxt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt-community / nuxtent-module / test / e2e / common / nuxt.js View on Github external
const generate = (nuxtentConfig, config = {}) => async () => {
  const mergedConfig = {
    ...baseConfig(nuxtentConfig),
    ...config
  }

  // Build a fresh nuxt
  nuxt = new Nuxt(mergedConfig)
  const builder = new Builder(nuxt)
  const generator = new Generator(nuxt, builder)
  await generator.generate()
  serve()
}
github medfreeman / nuxt-netlify-cms-module / test / nuxt.js View on Github external
const generate = async (config = {}) => {
  const mergedConfig = {
    ...baseConfig,
    ...config
  };

  // Build a fresh nuxt
  nuxt = new Nuxt(mergedConfig);
  const builder = new Builder(nuxt);
  generator = new Generator(nuxt, builder);
  await generator.generate();
  serve(true);
};
github michalzaq12 / electron-nuxt / template / .electron-nuxt / renderer / nuxt-process.js View on Github external
process.on('message', async ({ action, target }) => {
  if (action !== 'build') {
    console.warn('Unknown action')
    process.send({ status: 'error', err: `Nuxt process: unknown action ('${action}')` })
    return
  }

  await nuxt.ready()

  // https://github.com/nuxt/nuxt.js/blob/dev/packages/builder/src/builder.js
  const builder = new Builder(nuxt)

  // https://github.com/nuxt/nuxt.js/blob/dev/packages/generator/src/generator.js
  const generator = new Generator(nuxt, builder)

  if (target === 'development') {
    builder.build().then(() => {
      nuxt.listen(SERVER_PORT)
      process.send({ status: 'ok' })
    }).catch(err => {
      console.error(err)
      process.send({ status: 'error', err: err.message })
    })
  } else {
    generator.generate({ build: true, init: true }).then(({ errors }) => {
      if (errors.length === 0) process.send({ status: 'ok' })
      else process.send({ status: 'error', err: 'Error occurred while generating pages' })
    }).catch(err => {
      console.error(err)
      process.send({ status: 'error', err: err.message })
github njam / nuxt-i18n-module / test / Fixture.js View on Github external
async setUp () {
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000

    let builder = new Builder(this.nuxt)
    let generator = new Generator(this.nuxt, builder)
    await builder.build()
    await generator.generate()

    await this.nuxt.listen(this.port)
  }
github bazzite / statusfy / packages / @statusfy / core / lib / generate.js View on Github external
module.exports = async (sourceDir, cliOptions = {}) => {
  process.env.NODE_ENV = "production";

  const outDir = cliOptions.outDir || path.join(sourceDir, "dist");
  const { nuxtConfig } = generateConfig(sourceDir, cliOptions);
  nuxtConfig.generate.dir = outDir;

  if (!cliOptions.analyze) {
    delete nuxtConfig.build.analyze;
  }

  const nuxt = new Nuxt(nuxtConfig);
  const builder = new Builder(nuxt);
  const generator = new Generator(nuxt, builder);

  const generateOptions = {
    init: true,
    build: true
  };

  try {
    await generator.generate(generateOptions);
    process.exit(0);
  } catch (error) {
    logger.fatal(error);
  }
};

nuxt

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

MIT
Latest version published 1 month ago

Package Health Score

83 / 100
Full package analysis