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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/dist/commands/add.js +127 -84
- data/dist/commands/analyze.js +45 -37
- data/dist/commands/cache.js +141 -6
- data/dist/commands/check.js +121 -72
- data/dist/commands/clean.js +232 -93
- data/dist/commands/clone.js +65 -44
- data/dist/commands/create.js +76 -53
- data/dist/commands/deploy.js +28 -22
- data/dist/commands/doctor.js +26 -28
- data/dist/commands/env.js +44 -32
- data/dist/commands/update.js +598 -113
- data/dist/commands/upgrade-cli.js +30 -24
- data/dist/index.js +61 -16
- data/dist/utils/banner.js +3 -3
- data/dist/utils/cacheManager.js +57 -124
- data/dist/utils/dependencyInstaller.js +0 -2
- data/dist/utils/featureInstaller.js +404 -122
- data/dist/utils/helpFormatter.js +117 -0
- data/dist/utils/pathResolver.js +34 -72
- data/dist/utils/utils.js +20 -5
- metadata +3 -2
data/dist/commands/create.js
CHANGED
|
@@ -3,51 +3,69 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { promptProjectName, promptFrameworkSelection, promptLanguageSelection, promptTemplateSelection, promptFrameworkOptions, promptTemplateConfirmation, promptFeatureSelection,
|
|
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,
|
|
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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
147
|
-
);
|
|
166
|
+
await updateTemplateUsage(templateName || selectedFramework, selectedFramework, selectedLanguage);
|
|
148
167
|
const templateFiles = await getCachedTemplateFiles(templateName || selectedFramework);
|
|
149
|
-
await cacheTemplateFiles(templateName || selectedFramework, templatePath, templateFiles || {}
|
|
150
|
-
await cacheProjectData(projectPath, projectName, selectedLanguage
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
}
|
data/dist/commands/deploy.js
CHANGED
|
@@ -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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
data/dist/commands/doctor.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 { 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
|
-
|
|
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
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|