mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
66 lines
1.4 KiB
JavaScript
Executable File
66 lines
1.4 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 options = {
|
|
renderer: process.env.CI ? 'silent' : 'default',
|
|
nonTTYRenderer: 'silent',
|
|
concurrent: Math.min(4, cpus().length)
|
|
}
|
|
new Listr([{
|
|
title: `Build ${fixtures.length} fixtures with concurrency of ${options.concurrent}`,
|
|
task: () => new Listr(tasks, {concurrent: options.concurrent})
|
|
}], options)
|
|
.run()
|
|
.then(() => process.exit(0))
|
|
.catch((err) => {
|
|
console.error(err) // eslint-disable-line no-console
|
|
process.exit(1)
|
|
})
|