UNPKG

f2etest

Version:

Alibaba front-end testing setup tools

31 lines (30 loc) 1.05 kB
import { init } from 'init-roll'; import { dirname, isAbsolute, join } from 'path'; import prettier from 'prettier-config-ali'; import { fileURLToPath } from 'url'; export default async function f2etest(project, options = {}) { const { template = 'base' } = options; const projectFullPath = isAbsolute(project) ? project : join(process.cwd(), project); const __dirname = dirname(fileURLToPath(import.meta.url)); const initTemplate = (t) => init(join(__dirname, '..', 'templates', t), projectFullPath, options, { disableLog: options.disableLog, prettier, bumpDependencies: true, }); await initTemplate('base'); switch (template) { case 'preact': await initTemplate('web'); await initTemplate('preact'); break; case 'react': await initTemplate('web'); await initTemplate('react'); break; case 'web': await initTemplate('web'); break; default: break; } }