mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
59 lines
1.3 KiB
JavaScript
Executable File
59 lines
1.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
process.env.NODE_ENV = 'test'
|
|
|
|
const { resolve } = require('path')
|
|
const { cpus } = require('os')
|
|
|
|
const spawnAsync = require('@expo/spawn-async')
|
|
const Listr = require('listr')
|
|
|
|
const fixtures = [
|
|
'children',
|
|
'custom-dirs',
|
|
'debug',
|
|
'deprecate',
|
|
'dynamic-routes',
|
|
'empty',
|
|
'error',
|
|
'module',
|
|
'ssr',
|
|
'with-config',
|
|
|
|
// csr,
|
|
// dev,
|
|
// generate,
|
|
// fail generate,
|
|
// fallback generate,
|
|
// ssr,
|
|
// ssr csp,
|
|
// spa
|
|
'basic'
|
|
]
|
|
|
|
const nuxtBuild = resolve(__dirname, '../bin/nuxt-build')
|
|
|
|
function buildFixture(name) {
|
|
const rootDir = resolve(__dirname, '../test/fixtures', name)
|
|
return spawnAsync('node', [nuxtBuild, rootDir])
|
|
}
|
|
|
|
const tasks = []
|
|
for (let fixture of fixtures) {
|
|
tasks.push({
|
|
title: 'Building fixtures ' + fixture,
|
|
task: (ctx, task) => buildFixture(fixture)
|
|
.then(() => {
|
|
task.title = task.title.replace(/^Building/, 'Built') + ' Successfully'
|
|
})
|
|
})
|
|
}
|
|
|
|
const concurrency = Math.min(4, cpus().length)
|
|
new Listr([{
|
|
title: `Build ${fixtures.length} fixtures with concurrency of ${concurrency}`,
|
|
task: () => new Listr(tasks, {concurrent: concurrency})
|
|
}], { nonTTYRenderer: 'silent' })
|
|
.run()
|
|
.catch(console.error) // eslint-disable-line no-console
|
|
.then(() => process.exit(0))
|