UNPKG

@faisalrmdhn08/allin-cli

Version:

A modern full-stack CLI tool based on Typescript designed to accelerate your app development process — setup your entire stack in one seamless command.

33 lines 1.79 kB
import chalk from 'chalk'; import fse from 'fs-extra'; import { PathNotFoundError, ProjectNotExistError, UnableOverwriteError, UnidentifiedFrameworkError, UnidentifiedTemplateError, } from './error.js'; // CHECK MEMBERSHIP UTIL const __ensureIncluded = (val, list) => list.includes(val); export function __pathNotFound(path) { if (!fse.existsSync(path)) { throw new PathNotFoundError(`${chalk.bold('Path not found')}: ${chalk.bold(path)} path does not exist.`); } } export function __projectNotExist(template, model, projects) { if (!__ensureIncluded(template, projects)) { throw new ProjectNotExistError(`${chalk.bold('Project not exist')}: ${template} project is not available for ${model} template.`); } } export function __unableOverwriteProject(path, optionValues) { const exists = fse.existsSync(path); const force = optionValues.force === true; if (exists && !force) { throw new UnableOverwriteError(`${chalk.bold('Unable to overwrite')}: ${chalk.bold(path)} already exists and cannot be overwritten.\n\n${chalk.bold('Tips')}:\nUse ${chalk.bold('-f, --force')} when running the ${chalk.bold('create')} command to allow overwriting.`); } } export function __unidentifiedProjectTemplate(template, templates) { if (!__ensureIncluded(template, templates)) { throw new UnidentifiedTemplateError(`${chalk.bold('Unidentified template model')}: ${chalk.bold(template)} template model is not recognized.`); } } export function __unidentifiedFramework(project, projects) { if (!__ensureIncluded(project, projects)) { throw new UnidentifiedFrameworkError(`${chalk.bold('Unidentified framework project')}: ${chalk.bold(project)} framework project is not recognized.`); } } //# sourceMappingURL=trigger.js.map