@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.
92 lines (91 loc) • 2.79 kB
JavaScript
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");
class Adonisjs extends base_1.Base {
static supportedPackageManagers = ['npm', 'yarn', 'pnpm'];
packageManager;
projectName;
node = '^20.0.0 || >=22.0.0';
constructor(data) {
const { packageManager, projectName } = data;
super('npm init ');
this.packageManager = packageManager;
this.projectName = projectName;
}
async handle() {
const { boilerplate } = await inquirer_1.default.prompt([
{
type: 'list',
name: 'boilerplate',
message: 'Select the project boilerplate:',
choices: ['api', 'web', 'slim'],
},
]);
await this.handleVersion6(boilerplate);
await this.scaffold();
}
async handleVersion6(boilerplate) {
this.command += ` adonisjs -- ${this.projectName}`;
this.updateCommand('alias', { kit: boilerplate, pkg: this.packageManager });
const options = await inquirer_1.default.prompt([
{
type: 'list',
name: 'db',
message: 'Define the database dialect to use with Lucid',
choices: this.databases,
},
{
type: 'list',
name: 'auth-guard',
message: 'Define the authentication guard for the Auth package',
choices: this.authGuards,
},
]);
this.updateCommand('alias', options);
}
databases = [
{
name: 'SQLite',
value: 'sqlite',
},
{
name: 'MySQL / MariaDB',
value: 'mysql',
},
{
name: 'PostgreSQL',
value: 'postgres',
},
{
name: 'Microsoft SQL Server',
value: 'mssql',
},
{
name: 'Skip',
hint: 'I want to configures the Lucid package by myself.',
alias: undefined,
},
];
authGuards = [
{
name: 'Session',
value: 'session',
hint: 'Authenticate users using cookies and session.',
},
{
name: 'Access Token',
value: 'access_tokens',
hint: 'Authenticate clients using tokens.',
},
{
name: 'Skip',
alias: undefined,
hint: 'I want to configures guards by myself.',
},
];
}
exports.default = Adonisjs;
;