@craftnotion/init-project
Version:
A CLI tool to initialize a new project with AdonisJS, NextJS, NestJS, React Native, Strapi, TypeScript, Husky, Git-CZ and more.
78 lines (77 loc) • 2.75 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const inquirer_1 = __importDefault(require("inquirer"));
const base_1 = require("../base");
const functions_1 = require("../../functions");
class Vuejs extends base_1.Base {
static supportedPackageManagers = ['npm', 'yarn', 'pnpm'];
node = '18.3.0';
/**
* Base command for adonisjs
*/
constructor(data) {
let { packageManager = 'npm', projectName } = data;
super(`${packageManager} create vue@latest ${projectName} --`);
}
async handle() {
const useTypeScript = await (0, functions_1.askUseTypeScript)();
const data = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'jsx',
message: 'Add JSX Support?',
default: false,
},
{
type: 'confirm',
name: 'router',
message: 'Add Vue Router for Single Page Application development?',
default: true,
},
{
type: 'confirm',
name: 'pinia',
message: 'Add Pinia for state management?',
default: true,
},
{
type: 'confirm',
name: 'eslint',
message: 'Add ESLint for code quality?',
default: true,
},
{
type: 'confirm',
name: 'eslint-with-prettier',
message: 'Add Prettier for code formatting?',
default: true,
},
]);
let options = [];
options.push(useTypeScript ? 'ts' : 'js');
Object.keys(data).map((key) => data[key] && options.push(key));
this.updateCommand('alias', options);
const testing = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'vitest',
message: 'Add Vitest for Unit testing?',
default: true,
},
{
type: 'list',
name: 'testing-framework',
message: 'Add an End-to-End Testing Solution?',
choices: ['cypress', 'playwright', 'nightwatch', { value: '', name: 'none' }],
default: '',
},
]);
testing.vitest && this.updateCommand('alias', 'vitest');
testing['testing-framework'] && this.updateCommand('alias', testing['testing-framework']);
await this.scaffold();
}
}
exports.default = Vuejs;