UNPKG

flagpole

Version:

Simple and fast DOM integration, headless or headful browser, and REST API testing framework.

72 lines 2.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cli_helper_1 = require("./cli-helper"); const cli_1 = require("./cli"); const { prompt } = require('enquirer'); const fs = require('fs'); function init() { cli_helper_1.printHeader(); cli_helper_1.printSubheader('Initialize Flagpole Project'); prompt([ { type: 'input', name: 'project', message: 'What is the name of your project?', initial: process.cwd().split('/').pop(), result: function (input) { return input.trim(); } }, { type: 'input', name: 'path', message: 'What subfolder do you want to put your tests in?', initial: 'tests', result: function (input) { return input.trim(); } }, { type: 'select', name: 'env', message: 'What environments do you want to support?', initial: 0, multiple: true, choices: [ 'dev', 'stag', 'prod', 'qa', 'rc', 'preprod', 'alpha', 'beta' ], validate: function (input) { return (input.length > 0); } } ]).then(function (answers) { const configOptions = { projectName: answers.project, testsPath: answers.path, environments: answers.env }; cli_1.Cli.hideBanner = true; cli_1.Cli.log('Creating your Flagpole project...'); cli_1.Cli.init(configOptions) .then((tasks) => { cli_1.Cli.log(''); cli_1.Cli.list(tasks); cli_1.Cli.log(''); cli_1.Cli.log('Your Flagpole project was created.'); cli_1.Cli.exit(0); }) .catch((err) => { cli_1.Cli.log(err); cli_1.Cli.exit(1); }); }); } exports.init = init; //# sourceMappingURL=init.js.map