UNPKG

@lakutata/cli

Version:
95 lines (94 loc) 3.87 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateProjectOptions = void 0; const lakutata_1 = require("lakutata"); const dto_1 = require("lakutata/decorator/dto"); const node_process_1 = __importDefault(require("node:process")); const ListTemplateNames_1 = require("../lib/ListTemplateNames"); const templateNames = (0, ListTemplateNames_1.ListTemplateNames)(); if (!templateNames.length) templateNames.push(''); /** * Create project options */ class CreateProjectOptions extends lakutata_1.DTO { } exports.CreateProjectOptions = CreateProjectOptions; __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .required() .pattern(/^([a-zA-Z0-9_-]+\.?)*[a-zA-Z0-9_-]+$/) .description('Specify the name of the application')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "name", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .required() .pattern(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/) //Match package json name regex .description('Specify the ID of the application')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "id", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .required() .allow(...templateNames) .only() .description('Choose a template for this project')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "template", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .optional() .default(node_process_1.default.cwd()) .description('Specify the path for creating the project')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "path", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .Boolean() .strict(false) .optional() .default(false) .description('Initialize the project within an existing folder')), __metadata("design:type", Boolean) ], CreateProjectOptions.prototype, "overwrite", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .optional() .default('none') .description('Specify the description of the application')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "description", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .optional() .default('Anonymous') .description('Specify the name of the author of the application')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "author", void 0); __decorate([ (0, dto_1.Expect)(lakutata_1.DTO .String() .optional() .default('UNLICENSED') .description('Specify the name of the license for the application')), __metadata("design:type", String) ], CreateProjectOptions.prototype, "license", void 0);