package-installer-cli 1.2.0 → 1.3.1

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.
@@ -3,51 +3,69 @@
3
3
  */
4
4
  import chalk from 'chalk';
5
5
  import path from 'path';
6
- import gradient from 'gradient-string';
7
- import boxen from 'boxen';
8
- import { promptProjectName, promptFrameworkSelection, promptLanguageSelection, promptTemplateSelection, promptFrameworkOptions, promptTemplateConfirmation, promptFeatureSelection, promptFeatureProvider, hasFrameworkOptions, hasUIOptions, hasBundlerOptions, shouldShowTemplates } from '../utils/prompts.js';
6
+ import { createStandardHelp } from '../utils/helpFormatter.js';
7
+ import { displayCommandBanner } from '../utils/banner.js';
8
+ import { promptProjectName, promptFrameworkSelection, promptLanguageSelection, promptTemplateSelection, promptFrameworkOptions, promptTemplateConfirmation, promptFeatureSelection, hasFrameworkOptions, hasUIOptions, hasBundlerOptions, shouldShowTemplates } from '../utils/prompts.js';
9
9
  import { resolveTemplatePath, generateTemplateName, templateExists, getFrameworkConfig } from '../utils/templateResolver.js';
10
10
  import { createProjectFromTemplate, installDependenciesForCreate } from '../utils/templateCreator.js';
11
- import { updateTemplateUsage, getCachedTemplateFiles, cacheTemplateFiles, getDirectorySize, cacheProjectData } from '../utils/cacheManager.js';
11
+ import { updateTemplateUsage, getCachedTemplateFiles, cacheTemplateFiles, cacheProjectData } from '../utils/cacheManager.js';
12
12
  import { CacheManager } from '../utils/cacheUtils.js';
13
- import { addFeatureToProject } from './add.js';
14
13
  /**
15
14
  * Display help for create command
16
15
  */
17
16
  export function showCreateHelp() {
18
- const piGradient = gradient(['#00c6ff', '#0072ff']);
19
- const headerGradient = gradient(['#4facfe', '#00f2fe']);
20
- console.log('\n' + boxen(headerGradient('🚀 Create Command Help') + '\n\n' +
21
- chalk.white('Create a new project from our curated collection of modern templates.') + '\n' +
22
- chalk.white('Choose from React, Next.js, Express, Nest.js, Rust, and more!') + '\n\n' +
23
- chalk.cyan('Usage:') + '\n' +
24
- chalk.white(` ${piGradient('pi')} ${chalk.hex('#10ac84')('create')} [project-name]`) + '\n\n' +
25
- chalk.cyan('Options:') + '\n' +
26
- chalk.gray(' -h, --help Display help for this command') + '\n\n' +
27
- chalk.cyan('Examples:') + '\n' +
28
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('create')} my-awesome-app # Create with specific name`) + '\n' +
29
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('create')} # Interactive mode - will prompt for name`) + '\n' +
30
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('create')} ${chalk.hex('#ff6b6b')('--show-cache')} # Show cached preferences`) + '\n' +
31
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('create')} ${chalk.hex('#ff6b6b')('--clear-cache')} # Clear cached preferences`) + '\n' +
32
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('create')} ${chalk.hex('#ff6b6b')('--help')} # Show this help message`) + '\n\n' +
33
- chalk.hex('#00d2d3')('💡 Smart Caching:') + '\n' +
34
- chalk.hex('#95afc0')(' • Remembers your preferences from previous sessions') + '\n' +
35
- chalk.hex('#95afc0')(' • Suggests framework-specific project names') + '\n' +
36
- chalk.hex('#95afc0')(' • Shows project count and usage statistics') + '\n\n' +
37
- chalk.hex('#00d2d3')('💡 Available Templates:') + '\n' +
38
- chalk.hex('#95afc0')(' • React (Vite) - JavaScript/TypeScript variants') + '\n' +
39
- chalk.hex('#95afc0')(' • Next.js - App Router with multiple configurations') + '\n' +
40
- chalk.hex('#95afc0')(' • Express - RESTful APIs with authentication') + '\n' +
41
- chalk.hex('#95afc0')(' • Nest.js - Enterprise-grade Node.js framework') + '\n' +
42
- chalk.hex('#95afc0')(' • Angular - Modern Angular applications') + '\n' +
43
- chalk.hex('#95afc0')(' • Vue.js - Progressive Vue.js applications') + '\n' +
44
- chalk.hex('#95afc0')(' • Rust - Systems programming templates') + '\n' +
45
- chalk.hex('#95afc0')(' • Django - Python web framework'), {
46
- padding: 1,
47
- borderStyle: 'round',
48
- borderColor: 'cyan',
49
- backgroundColor: '#0a0a0a'
50
- }));
17
+ const helpConfig = {
18
+ commandName: 'Create',
19
+ emoji: '🚀',
20
+ description: 'Create a new project from our curated collection of modern templates.\nChoose from React, Next.js, Express, Nest.js, Rust, and more!',
21
+ usage: [
22
+ 'create [project-name] [options]',
23
+ 'create [options]'
24
+ ],
25
+ options: [
26
+ { flag: '--show-cache', description: 'Show cached preferences' },
27
+ { flag: '--clear-cache', description: 'Clear cached preferences' }
28
+ ],
29
+ examples: [
30
+ { command: 'create my-awesome-app', description: 'Create with specific name' },
31
+ { command: 'create', description: 'Interactive mode - will prompt for name' },
32
+ { command: 'create --show-cache', description: 'Show cached preferences' },
33
+ { command: 'create --clear-cache', description: 'Clear cached preferences' }
34
+ ],
35
+ additionalSections: [
36
+ {
37
+ title: 'Smart Caching',
38
+ items: [
39
+ 'Remembers your preferences from previous sessions',
40
+ 'Suggests framework-specific project names',
41
+ 'Shows project count and usage statistics'
42
+ ]
43
+ },
44
+ {
45
+ title: 'Available Templates',
46
+ items: [
47
+ 'React (Vite) - JavaScript/TypeScript variants',
48
+ 'Next.js - App Router with multiple configurations',
49
+ 'Express - RESTful APIs with authentication',
50
+ 'Nest.js - Enterprise-grade Node.js framework',
51
+ 'Angular - Modern Angular applications',
52
+ 'Vue.js - Progressive Vue.js applications',
53
+ 'Rust - Systems programming templates',
54
+ 'Django - Python web framework',
55
+ 'Flask - Lightweight Python web apps',
56
+ 'Go - Fast and efficient web services',
57
+ 'React-Native - Mobile apps for iOS and Android',
58
+ 'Combination Templates - reactjs+express+shadcn,reactjs=nestjs+shadcn'
59
+ ]
60
+ }
61
+ ],
62
+ tips: [
63
+ 'Use interactive mode for guided project creation',
64
+ 'Templates include best practices and modern tooling',
65
+ 'All templates support both JavaScript and TypeScript'
66
+ ]
67
+ };
68
+ createStandardHelp(helpConfig);
51
69
  }
52
70
  /**
53
71
  * Main create project function with comprehensive prompt system
@@ -61,6 +79,8 @@ export async function createProject(providedName, options) {
61
79
  return;
62
80
  }
63
81
  try {
82
+ // Display command banner
83
+ displayCommandBanner('Create', 'Create stunning web applications with integrated templates and features');
64
84
  console.log('\n' + chalk.hex('#10ac84')('🚀 Welcome to Package Installer CLI!'));
65
85
  console.log(chalk.hex('#95afc0')('Let\'s create something amazing together...'));
66
86
  // Step 1: Get project name (prompt if not provided)
@@ -143,12 +163,10 @@ export async function createProject(providedName, options) {
143
163
  await installDependenciesForCreate(projectPath);
144
164
  // Step 11.5: Cache template usage and project data
145
165
  try {
146
- await updateTemplateUsage(templateName || selectedFramework, selectedFramework, selectedLanguage, [] // Features will be updated after adding them
147
- );
166
+ await updateTemplateUsage(templateName || selectedFramework, selectedFramework, selectedLanguage);
148
167
  const templateFiles = await getCachedTemplateFiles(templateName || selectedFramework);
149
- await cacheTemplateFiles(templateName || selectedFramework, templatePath, templateFiles || {}, await getDirectorySize(projectPath));
150
- await cacheProjectData(projectPath, projectName, selectedLanguage, selectedFramework, [], // Features will be added next
151
- await getDirectorySize(projectPath));
168
+ await cacheTemplateFiles(templateName || selectedFramework, templatePath, templateFiles || {});
169
+ await cacheProjectData(projectPath, projectName, selectedLanguage);
152
170
  }
153
171
  catch (error) {
154
172
  console.warn(chalk.yellow('⚠️ Could not cache project data'));
@@ -157,17 +175,22 @@ export async function createProject(providedName, options) {
157
175
  const selectedFeatures = await promptFeatureSelection();
158
176
  if (selectedFeatures.length > 0) {
159
177
  console.log(chalk.hex('#00d2d3')('\n🚀 Adding Features...\n'));
178
+ // Import the add command dynamically to avoid circular imports
179
+ const { addCommand } = await import('./add.js');
160
180
  for (const category of selectedFeatures) {
161
- const provider = await promptFeatureProvider(category, selectedFramework);
162
- if (provider) {
163
- console.log(chalk.cyan(`🔧 Adding ${provider} for ${category}...`));
164
- const success = await addFeatureToProject(projectPath, category, provider, selectedFramework);
165
- if (success) {
166
- console.log(chalk.green(`✅ Successfully added ${provider} for ${category}`));
167
- }
168
- else {
169
- console.log(chalk.yellow(`⚠️ Failed to add ${provider} for ${category}, skipping...`));
170
- }
181
+ try {
182
+ console.log(chalk.cyan(`🔧 Adding ${category} feature...`));
183
+ // Use the add command directly with the detected framework
184
+ await addCommand(category, undefined, {
185
+ framework: selectedFramework,
186
+ projectPath: projectPath,
187
+ list: false,
188
+ verbose: false
189
+ });
190
+ console.log(chalk.green(`✅ Successfully added ${category} feature`));
191
+ }
192
+ catch (error) {
193
+ console.log(chalk.yellow(`⚠️ Failed to add ${category} feature, skipping...`));
171
194
  }
172
195
  }
173
196
  }
@@ -4,32 +4,38 @@
4
4
  import chalk from 'chalk';
5
5
  import gradient from 'gradient-string';
6
6
  import boxen from 'boxen';
7
+ import { createStandardHelp } from '../utils/helpFormatter.js';
7
8
  /**
8
9
  * Display help for deploy command
9
10
  */
10
11
  export function showDeployHelp() {
11
- const piGradient = gradient(['#00c6ff', '#0072ff']);
12
- const headerGradient = gradient(['#ff9a9e', '#fecfef']);
13
- console.log('\n' + boxen(headerGradient('🚀 Deploy Command Help') + '\n\n' +
14
- chalk.white('Deploy your projects to various cloud platforms seamlessly.') + '\n' +
15
- chalk.white('This feature is currently under development!') + '\n\n' +
16
- chalk.cyan('Usage:') + '\n' +
17
- chalk.white(` ${piGradient('pi')} ${chalk.hex('#10ac84')('deploy')}`) + '\n\n' +
18
- chalk.cyan('Options:') + '\n' +
19
- chalk.gray(' -h, --help Display help for this command') + '\n\n' +
20
- chalk.cyan('Examples:') + '\n' +
21
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('deploy')} # Deploy current project`) + '\n' +
22
- chalk.gray(` ${piGradient('pi')} ${chalk.hex('#10ac84')('deploy')} ${chalk.hex('#ff6b6b')('--help')} # Show this help message`) + '\n\n' +
23
- chalk.hex('#00d2d3')('🔮 Planned Features:') + '\n' +
24
- chalk.hex('#95afc0')(' • Deploy to Vercel, Netlify, AWS') + '\n' +
25
- chalk.hex('#95afc0')(' Docker container deployment') + '\n' +
26
- chalk.hex('#95afc0')(' Environment variable management') + '\n' +
27
- chalk.hex('#95afc0')(' CI/CD pipeline setup'), {
28
- padding: 1,
29
- borderStyle: 'round',
30
- borderColor: 'magenta',
31
- backgroundColor: '#0a0a0a'
32
- }));
12
+ const helpConfig = {
13
+ commandName: 'deploy',
14
+ emoji: '🚀',
15
+ description: 'Deploy your projects to various cloud platforms seamlessly.\nThis feature is currently under development!',
16
+ usage: ['pi deploy'],
17
+ options: [],
18
+ examples: [
19
+ { command: 'pi deploy', description: 'Deploy current project' },
20
+ { command: 'pi deploy --help', description: 'Show this help message' }
21
+ ],
22
+ additionalSections: [
23
+ {
24
+ title: '🔮 Planned Features',
25
+ items: [
26
+ '• Deploy to Vercel, Netlify, AWS',
27
+ '• Docker container deployment',
28
+ '• Environment variable management',
29
+ '• CI/CD pipeline setup'
30
+ ]
31
+ }
32
+ ],
33
+ tips: [
34
+ 'This feature is currently under development - stay tuned!',
35
+ 'Follow the project on GitHub for updates and releases'
36
+ ]
37
+ };
38
+ createStandardHelp(helpConfig);
33
39
  }
34
40
  /**
35
41
  * Display coming soon animation
@@ -9,6 +9,7 @@ import path from 'path';
9
9
  import boxen from 'boxen';
10
10
  import gradient from 'gradient-string';
11
11
  import { displaySuccessMessage, displayErrorMessage } from '../utils/dashboard.js';
12
+ import { createStandardHelp } from '../utils/helpFormatter.js';
12
13
  /**
13
14
  * Check if command exists
14
15
  */
@@ -181,35 +182,32 @@ async function autoFixIssue(issue, projectPath) {
181
182
  * Display help for doctor command
182
183
  */
183
184
  export function showDoctorHelp() {
185
+ const helpConfig = {
186
+ commandName: 'doctor',
187
+ emoji: '🩺',
188
+ description: 'Diagnose and fix common development issues.\nComprehensive health check for your development environment and project setup.',
189
+ usage: ['pi doctor [options]', 'pi diagnose [options] # (alias)'],
190
+ options: [
191
+ { flag: '--fix', description: 'Automatically fix detected issues' },
192
+ { flag: '--node', description: 'Check Node.js and npm setup only' },
193
+ { flag: '--deps', description: 'Check project dependencies only' },
194
+ { flag: '--tools', description: 'Check development tools only' },
195
+ { flag: '--verbose', description: 'Show detailed diagnostic information' }
196
+ ],
197
+ examples: [
198
+ { command: 'pi doctor', description: 'Complete health check' },
199
+ { command: 'pi doctor --fix', description: 'Check and auto-fix issues' },
200
+ { command: 'pi doctor --deps', description: 'Check dependencies only' },
201
+ { command: 'pi doctor --node --verbose', description: 'Detailed Node.js check' }
202
+ ],
203
+ tips: [
204
+ 'Use --fix to automatically resolve common issues',
205
+ 'Run with --verbose for detailed diagnostic information',
206
+ '\'pi diagnose\' is an alias for \'pi doctor\''
207
+ ]
208
+ };
184
209
  console.clear();
185
- const helpContent = boxen(gradient(['#ff6b6b', '#4ecdc4'])('🩺 Doctor Command Help') + '\n\n' +
186
- chalk.white('Diagnose and fix common development issues') + '\n\n' +
187
- chalk.cyan('Usage:') + '\n' +
188
- chalk.white(' pi doctor [options]') + '\n' +
189
- chalk.white(' pi diagnose [options]') + chalk.gray(' (alias)') + '\n\n' +
190
- chalk.cyan('Description:') + '\n' +
191
- chalk.white(' Comprehensive health check for your development environment') + '\n' +
192
- chalk.white(' and project setup. Detects and fixes common issues.') + '\n\n' +
193
- chalk.cyan('Options:') + '\n' +
194
- chalk.white(' --fix') + chalk.gray(' Automatically fix detected issues') + '\n' +
195
- chalk.white(' --node') + chalk.gray(' Check Node.js and npm setup only') + '\n' +
196
- chalk.white(' --deps') + chalk.gray(' Check project dependencies only') + '\n' +
197
- chalk.white(' --tools') + chalk.gray(' Check development tools only') + '\n' +
198
- chalk.white(' --verbose') + chalk.gray(' Show detailed diagnostic information') + '\n' +
199
- chalk.white(' -h, --help') + chalk.gray(' Show this help message') + '\n\n' +
200
- chalk.cyan('Examples:') + '\n' +
201
- chalk.gray(' # Complete health check') + '\n' +
202
- chalk.white(' pi doctor') + '\n\n' +
203
- chalk.gray(' # Check and auto-fix issues') + '\n' +
204
- chalk.white(' pi doctor --fix') + '\n\n' +
205
- chalk.gray(' # Check dependencies only') + '\n' +
206
- chalk.white(' pi doctor --deps'), {
207
- padding: 1,
208
- margin: 1,
209
- borderStyle: 'round',
210
- borderColor: 'green'
211
- });
212
- console.log(helpContent);
210
+ createStandardHelp(helpConfig);
213
211
  }
214
212
  /**
215
213
  * Main doctor command function
data/dist/commands/env.js CHANGED
@@ -9,6 +9,7 @@ import path from 'path';
9
9
  import boxen from 'boxen';
10
10
  import gradient from 'gradient-string';
11
11
  import inquirer from 'inquirer';
12
+ import { createStandardHelp } from '../utils/helpFormatter.js';
12
13
  import { displaySuccessMessage, displayErrorMessage } from '../utils/dashboard.js';
13
14
  import { detectProjectStack } from '../utils/featureInstaller.js';
14
15
  /**
@@ -105,7 +106,7 @@ function checkEnvironmentVariables() {
105
106
  async function generateEnvTemplate(projectPath) {
106
107
  try {
107
108
  const projectInfo = await detectProjectStack(projectPath);
108
- const envPath = path.join(projectPath, '.env.example');
109
+ const envPath = path.join(projectPath, '.env');
109
110
  let envContent = `# Environment Configuration
110
111
  # Generated by Package Installer CLI
111
112
 
@@ -208,37 +209,48 @@ async function validateEnvFile(projectPath) {
208
209
  * Display help for environment command
209
210
  */
210
211
  export function showEnvironmentHelp() {
211
- console.clear();
212
- const helpContent = boxen(gradient(['#ff6b6b', '#feca57'])('🌍 Environment Command Help') + '\n\n' +
213
- chalk.white('Analyze and manage your development environment') + '\n\n' +
214
- chalk.cyan('Usage:') + '\n' +
215
- chalk.white(' pi env [options]') + '\n' +
216
- chalk.white(' pi environment [options]') + chalk.gray(' (alias)') + '\n\n' +
217
- chalk.cyan('Description:') + '\n' +
218
- chalk.white(' Comprehensive environment analysis and management tools') + '\n' +
219
- chalk.white(' for development setup and configuration') + '\n\n' +
220
- chalk.cyan('Options:') + '\n' +
221
- chalk.white(' --check') + chalk.gray(' Check development tools and versions') + '\n' +
222
- chalk.white(' --generate') + chalk.gray(' Generate .env template for project') + '\n' +
223
- chalk.white(' --validate') + chalk.gray(' Validate existing .env file') + '\n' +
224
- chalk.white(' --export') + chalk.gray(' Export environment info to file') + '\n' +
225
- chalk.white(' --system') + chalk.gray(' Show system information only') + '\n' +
226
- chalk.white(' -h, --help') + chalk.gray(' Show this help message') + '\n\n' +
227
- chalk.cyan('Examples:') + '\n' +
228
- chalk.gray(' # Interactive environment analysis') + '\n' +
229
- chalk.white(' pi env') + '\n\n' +
230
- chalk.gray(' # Check development tools') + '\n' +
231
- chalk.white(' pi env --check') + '\n\n' +
232
- chalk.gray(' # Generate .env template') + '\n' +
233
- chalk.white(' pi env --generate') + '\n\n' +
234
- chalk.gray(' # Validate .env file') + '\n' +
235
- chalk.white(' pi env --validate'), {
236
- padding: 1,
237
- margin: 1,
238
- borderStyle: 'round',
239
- borderColor: 'yellow'
240
- });
241
- console.log(helpContent);
212
+ const helpConfig = {
213
+ commandName: 'Environment',
214
+ emoji: '🌍',
215
+ description: 'Analyze and manage your development environment.\nComprehensive environment analysis and management tools for development setup and configuration.',
216
+ usage: [
217
+ 'env [options]',
218
+ 'environment [options] # alias'
219
+ ],
220
+ options: [
221
+ { flag: '--check', description: 'Check development tools and versions' },
222
+ { flag: '--generate', description: 'Generate .env template for project' },
223
+ { flag: '--validate', description: 'Validate existing .env file' },
224
+ { flag: '--export', description: 'Export environment info to file' },
225
+ { flag: '--system', description: 'Show system information only' }
226
+ ],
227
+ examples: [
228
+ { command: 'env', description: 'Interactive environment analysis' },
229
+ { command: 'env --check', description: 'Check development tools' },
230
+ { command: 'env --generate', description: 'Generate .env template' },
231
+ { command: 'env --validate', description: 'Validate .env file' },
232
+ { command: 'env --system', description: 'Show system information only' },
233
+ { command: 'environment --export', description: 'Export environment info to file' }
234
+ ],
235
+ additionalSections: [
236
+ {
237
+ title: 'Features',
238
+ items: [
239
+ 'Development tools version checking',
240
+ 'Environment file generation and validation',
241
+ 'System information analysis',
242
+ 'Configuration management',
243
+ 'Project environment setup'
244
+ ]
245
+ }
246
+ ],
247
+ tips: [
248
+ 'Use --generate to create .env templates for your projects',
249
+ 'Regular environment checks help maintain development consistency',
250
+ 'Validate .env files to catch configuration issues early'
251
+ ]
252
+ };
253
+ createStandardHelp(helpConfig);
242
254
  }
243
255
  /**
244
256
  * Main environment command function