@vira-ui/cli 0.4.0-alpha → 0.4.1-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +41 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49,6 +49,7 @@ const commander_1 = require("commander");
49
49
  const fs = __importStar(require("fs-extra"));
50
50
  const path = __importStar(require("path"));
51
51
  const chalk_1 = __importDefault(require("chalk"));
52
+ const inquirer_1 = __importDefault(require("inquirer"));
52
53
  const backendReadme_1 = require("./go/backendReadme");
53
54
  const backendEnvExample_1 = require("./go/backendEnvExample");
54
55
  const dockerfile_1 = require("./go/dockerfile");
@@ -101,14 +102,47 @@ program
101
102
  .command("create")
102
103
  .description("Create a new Vira project")
103
104
  .argument("<name>", "Project name")
104
- .option("-t, --template <template>", "Template type (frontend|fullstack|kanban)", "frontend")
105
+ .option("-t, --template <template>", "Template type (frontend|fullstack|kanban). If not specified, interactive selection will be shown.")
105
106
  .action(async (name, options) => {
106
- console.log(chalk_1.default.blue(`Creating Vira project: ${name}`));
107
+ console.log(chalk_1.default.blue(`\nCreating Vira project: ${name}\n`));
107
108
  const projectPath = path.resolve(process.cwd(), name);
108
- const template = (options.template || "frontend");
109
- if (!SUPPORTED_TEMPLATES.includes(template)) {
110
- console.error(chalk_1.default.red(`Unknown template: ${template}. Use one of: ${SUPPORTED_TEMPLATES.join(", ")}`));
111
- process.exit(1);
109
+ // Интерактивный выбор шаблона, если не указан
110
+ let template;
111
+ if (options.template) {
112
+ template = options.template;
113
+ if (!SUPPORTED_TEMPLATES.includes(template)) {
114
+ console.error(chalk_1.default.red(`Unknown template: ${template}. Use one of: ${SUPPORTED_TEMPLATES.join(", ")}`));
115
+ process.exit(1);
116
+ }
117
+ }
118
+ else {
119
+ // Интерактивный выбор как в Vite
120
+ const { selectedTemplate } = await inquirer_1.default.prompt([
121
+ {
122
+ type: "list",
123
+ name: "selectedTemplate",
124
+ message: "Select a template:",
125
+ choices: [
126
+ {
127
+ name: "Frontend (React + Vite + Vira UI)",
128
+ value: "frontend",
129
+ short: "frontend",
130
+ },
131
+ {
132
+ name: "Fullstack (Frontend + Go Backend + Docker)",
133
+ value: "fullstack",
134
+ short: "fullstack",
135
+ },
136
+ {
137
+ name: "Kanban (Reference app with VRP)",
138
+ value: "kanban",
139
+ short: "kanban",
140
+ },
141
+ ],
142
+ default: "frontend",
143
+ },
144
+ ]);
145
+ template = selectedTemplate;
112
146
  }
113
147
  // Проверяем, существует ли директория
114
148
  if (await fs.pathExists(projectPath)) {
@@ -117,7 +151,7 @@ program
117
151
  }
118
152
  // Создаём структуру проекта
119
153
  await createProjectStructure(projectPath, template);
120
- console.log(chalk_1.default.green(`✓ Project ${name} created successfully!`));
154
+ console.log(chalk_1.default.green(`\n✓ Project ${name} created successfully!\n`));
121
155
  printNextSteps(name, template);
122
156
  });
123
157
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vira-ui/cli",
3
- "version": "0.4.0-alpha",
3
+ "version": "0.4.1-alpha",
4
4
  "description": "CLI tool for ViraJS project generation",
5
5
  "author": "Vira Team",
6
6
  "license": "MIT",