package-installer-cli 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 665501d841b7bce60cdb5917c5aa517e05236932dee2966958dc444fe0bf6108
4
- data.tar.gz: ab2a5a999c255824b7c903ed2b46c0018e93c3bd08010d46e4970e43dfca80c3
3
+ metadata.gz: 67f8a4e5d268f24f01d493f27c9cf688d7e909fb0ec7f67906c0955e4d022ee9
4
+ data.tar.gz: 52f196b68f262f313be40bac842f592d32c1a8c3310247bd7cc386cc5298103a
5
5
  SHA512:
6
- metadata.gz: 41e9956c319e5df07d8fd65c81129fb00c65c4d4987d706b35e035c63e70b74a9b7f0172a36ee2d278da979b4bd683b3471a824e831afa7250cec4464abf69ab
7
- data.tar.gz: c8fc5ea386fbc9e0eb4c3ebf7a7601db1ea47887378f06c6d4134e615356f920a27e038cdeb67e63d6d41692ed605382f530e0642015120048828d97cf2a81fe
6
+ metadata.gz: b9cbbdb378e2bff40893095c025e5b02802080e1e06a25c471d0e096beadbe4ff40bd3b377959dc9e4a4a7d946f805ffa491ee8194315dd8cd93cc6af2680d86
7
+ data.tar.gz: 45b213c38590a89247580f3ccf78ca0d4d714aafdc67f30effe08c45efebdd9ad1d7022857c82fc897f20087d03b6c0f14157d5544f58e6536c16e67db972e8c
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to the Package Installer CLI Ruby gem will be documented in
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.1.0] - 2025-09-23
9
+
10
+ ### Updated
11
+ - Version bump to 1.1.0
12
+ - Improved gem packaging and file inclusion
13
+ - Enhanced security with comprehensive .gitignore rules
14
+ - Updated documentation and README
15
+
8
16
  ## [1.0.0] - 2025-09-20
9
17
 
10
18
  ### Added
data/dist/commands/add.js CHANGED
@@ -4,50 +4,10 @@ import gradient from 'gradient-string';
4
4
  import boxen from 'boxen';
5
5
  import path from 'path';
6
6
  import fs from 'fs-extra';
7
- import { fileURLToPath } from 'url';
8
- import { addFeature, detectProjectStack, SUPPORTED_FEATURES, getCliRootPath } from '../utils/featureInstaller.js';
7
+ import { addFeature, detectProjectStack, SUPPORTED_FEATURES } from '../utils/featureInstaller.js';
9
8
  import { historyManager } from '../utils/historyManager.js';
10
9
  import { getCachedProject, cacheProjectData } from '../utils/cacheManager.js';
11
- /**
12
- * Resolve CLI installation paths for both local and global installations
13
- */
14
- function resolveCLIPath() {
15
- // Get the current file's directory
16
- const currentFile = fileURLToPath(import.meta.url);
17
- const currentDir = path.dirname(currentFile);
18
- // Try to find package root by looking for package.json
19
- let packageRoot = currentDir;
20
- while (packageRoot !== path.dirname(packageRoot)) {
21
- const packageJsonPath = path.join(packageRoot, 'package.json');
22
- if (fs.existsSync(packageJsonPath)) {
23
- try {
24
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
25
- if (packageJson.name === '@0xshariq/package-installer') {
26
- return packageRoot;
27
- }
28
- }
29
- catch (error) {
30
- // Continue searching
31
- }
32
- }
33
- packageRoot = path.dirname(packageRoot);
34
- }
35
- // Fallback: use current working directory if we're in development
36
- if (fs.existsSync(path.join(process.cwd(), 'features'))) {
37
- return process.cwd();
38
- }
39
- // Final fallback: try node_modules resolution
40
- try {
41
- const nodeModulesPath = path.join(currentDir, '../../../');
42
- if (fs.existsSync(path.join(nodeModulesPath, 'features'))) {
43
- return nodeModulesPath;
44
- }
45
- }
46
- catch (error) {
47
- // Ignore
48
- }
49
- return process.cwd();
50
- }
10
+ import { getFeaturesJsonPath, getFeaturesPath } from '../utils/pathResolver.js';
51
11
  /**
52
12
  * Helper function to capitalize strings
53
13
  */
@@ -59,13 +19,12 @@ function capitalize(str) {
59
19
  */
60
20
  function getFeaturesConfig() {
61
21
  try {
62
- // Get the CLI root path
63
- const cliRoot = getCliRootPath();
64
- const featuresPath = path.join(cliRoot, 'features', 'features.json');
22
+ // Use the centralized path resolver
23
+ const featuresPath = getFeaturesJsonPath();
65
24
  if (fs.existsSync(featuresPath)) {
66
25
  return JSON.parse(fs.readFileSync(featuresPath, 'utf-8'));
67
26
  }
68
- console.warn(chalk.yellow('⚠️ features.json not found, using fallback'));
27
+ console.warn(chalk.yellow(`⚠️ features.json not found at: ${featuresPath}`));
69
28
  return { features: {} };
70
29
  }
71
30
  catch (error) {
@@ -404,15 +363,14 @@ export async function addCommand(feature, provider, options = {}) {
404
363
  console.log(chalk.green(`✅ Detected ${projectInfo.framework} project (${projectInfo.projectLanguage || projectInfo.language})`));
405
364
  }
406
365
  // Validate that framework features exist in features directory
407
- const cliRoot = getCliRootPath();
408
- const frameworkFeaturesPath = path.join(cliRoot, 'features');
366
+ const frameworkFeaturesPath = getFeaturesPath();
409
367
  if (!await fs.pathExists(frameworkFeaturesPath)) {
410
368
  console.log(chalk.red('❌ Features directory not found'));
411
369
  console.log(chalk.yellow('💡 Make sure you\'re running this from the Package Installer CLI root directory'));
412
370
  return;
413
371
  }
414
372
  // Load features configuration
415
- const featuresConfigPath = path.join(frameworkFeaturesPath, 'features.json');
373
+ const featuresConfigPath = getFeaturesJsonPath();
416
374
  if (!await fs.pathExists(featuresConfigPath)) {
417
375
  console.log(chalk.red('❌ Features configuration not found'));
418
376
  return;
data/dist/index.js CHANGED
@@ -18,17 +18,24 @@ import { deployCommand } from './commands/deploy.js';
18
18
  import { cleanCommand, showCleanHelp } from './commands/clean.js';
19
19
  import { environmentCommand, showEnvironmentHelp } from './commands/env.js';
20
20
  import { doctorCommand, showDoctorHelp } from './commands/doctor.js';
21
- // Import utilities
22
- import { showBanner } from './utils/ui.js';
23
21
  import { initializeCache } from './utils/cacheManager.js';
22
+ import { displayBanner, displayCommandBanner } from './utils/banner.js';
23
+ import { getPackageJsonPath } from './utils/pathResolver.js';
24
24
  // Get current file directory for ESM
25
25
  const __filename = fileURLToPath(import.meta.url);
26
26
  const __dirname = dirname(__filename);
27
- // Load package.json to get version
28
- let packageJsonPath = join(__dirname, '../package.json');
29
- // Check if we're running from dist folder
30
- if (__dirname.includes('/dist/')) {
31
- packageJsonPath = join(__dirname, '../../package.json');
27
+ // Load package.json to get version using improved path resolution
28
+ let packageJsonPath;
29
+ try {
30
+ packageJsonPath = getPackageJsonPath();
31
+ }
32
+ catch (error) {
33
+ // Fallback to the old method if getPackageJsonPath fails
34
+ packageJsonPath = join(__dirname, '../package.json');
35
+ // Check if we're running from dist folder
36
+ if (__dirname.includes('/dist/')) {
37
+ packageJsonPath = join(__dirname, '../../package.json');
38
+ }
32
39
  }
33
40
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
34
41
  const VERSION = packageJson.version;
@@ -74,7 +81,7 @@ program
74
81
  })
75
82
  .action(async (projectName) => {
76
83
  try {
77
- showBanner();
84
+ displayCommandBanner('create', 'Create a new project from templates');
78
85
  await createProject(projectName);
79
86
  }
80
87
  catch (error) {
@@ -206,7 +213,7 @@ program
206
213
  })
207
214
  .action(async (options) => {
208
215
  try {
209
- showBanner();
216
+ displayCommandBanner('clean', 'Clean development artifacts and caches');
210
217
  await cleanCommand(options);
211
218
  }
212
219
  catch (error) {
@@ -336,7 +343,7 @@ program.on('--help', () => {
336
343
  });
337
344
  // ENHANCED DEFAULT BEHAVIOR - Beautiful banner and help when no command provided
338
345
  if (process.argv.length === 2) {
339
- showBanner();
346
+ displayBanner();
340
347
  console.log('\n' + boxen(chalk.white('Welcome to Package Installer CLI! 👋') + '\n\n' +
341
348
  chalk.hex('#00d2d3')('🚀 Ready to build something amazing?') + '\n\n' +
342
349
  chalk.hex('#95afc0')('Start with these popular commands:') + '\n\n' +
data/dist/utils/banner.js CHANGED
@@ -5,6 +5,7 @@
5
5
  import chalk from 'chalk';
6
6
  import gradient from 'gradient-string';
7
7
  import boxen from 'boxen';
8
+ import { getPackageVersion } from './utils.js';
8
9
  /**
9
10
  * Generate the main CLI banner with gradient colors
10
11
  */
@@ -40,7 +41,8 @@ export function generateBanner() {
40
41
  * Generate version info banner
41
42
  */
42
43
  export function generateVersionBanner() {
43
- return boxen(chalk.hex('#00d2d3')('📦 Version: ') + chalk.hex('#ffa502')('v3.2.0') +
44
+ const version = getPackageVersion();
45
+ return boxen(chalk.hex('#00d2d3')('📦 Version: ') + chalk.hex('#ffa502')(`v${version}`) +
44
46
  chalk.hex('#95afc0')(' • ') + chalk.hex('#00d2d3')('🎯 Frameworks: ') + chalk.hex('#ffa502')('12+') +
45
47
  chalk.hex('#95afc0')(' • ') + chalk.hex('#00d2d3')('📋 Templates: ') + chalk.hex('#ffa502')('50+') +
46
48
  chalk.hex('#95afc0')(' • ') + chalk.hex('#00d2d3')('⚡ Status: ') + chalk.hex('#10ac84')('Ready to scaffold!'), {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Enhanced Cache Utility for Package Installer CLI v3.0.0
2
+ * Enhanced Cache Utility for Package Installer CLI v3.2.0
3
3
  * Advanced caching system with compression, encryption, and smart invalidation
4
4
  */
5
5
  import fs from 'fs-extra';
@@ -35,7 +35,7 @@ export function createBanner(title = 'Package Installer CLI') {
35
35
  console.log(banner);
36
36
  // Add tagline with updated branding
37
37
  const tagline = chalk.hex('#00d2d3')('🚀 Advanced Project Analytics Dashboard');
38
- const version = chalk.hex('#95afc0')('v3.0.0');
38
+ const version = chalk.hex('#95afc0')('v3.2.0');
39
39
  const author = chalk.hex('#ffa502')('by @0xshariq');
40
40
  const centered = `${tagline} ${version} ${author}`;
41
41
  const padding = Math.max(0, Math.floor(((process.stdout.columns || 80) - centered.length) / 2));
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Enhanced Multi-language dependency installer utility for Package Installer CLI v3.0.0
3
- * Supports Node.js, Rust, Python, Go, Ruby, PHP, Java, C#, Swift, Dart/Flutter with modern features
2
+ * Enhanced Multi-language dependency installer utility for Package Installer CLI v3.2.0
3
+ * Supports Node.js, Python, Rust, Go, Ruby, and more with intelligent package management
4
4
  */
5
5
  import { exec } from 'child_process';
6
6
  import { promisify } from 'util';
@@ -10,6 +10,7 @@ import ora from 'ora';
10
10
  import { installPackages } from './dependencyInstaller.js';
11
11
  import { detectLanguageFromFiles } from './languageConfig.js';
12
12
  import { cacheProjectData, getCachedProject } from './cacheManager.js';
13
+ import { getCliRootPath, getFeaturesJsonPath } from './pathResolver.js';
13
14
  // Get the directory of this file for proper path resolution
14
15
  const __filename = fileURLToPath(import.meta.url);
15
16
  const __dirname = dirname(__filename);
@@ -20,15 +21,14 @@ let SUPPORTED_FEATURES = {};
20
21
  */
21
22
  async function loadFeatures() {
22
23
  try {
23
- // Get CLI installation directory
24
- const __filename = fileURLToPath(import.meta.url);
25
- const __dirname = path.dirname(__filename);
26
- const cliDir = path.resolve(__dirname, '..', '..');
27
- // Load directly from file system (simplified approach)
28
- const featuresPath = path.join(cliDir, 'features', 'features.json');
24
+ // Get CLI installation directory using the centralized path resolver
25
+ const featuresPath = getFeaturesJsonPath();
29
26
  if (await fs.pathExists(featuresPath)) {
30
27
  const featuresData = await fs.readJson(featuresPath);
31
- SUPPORTED_FEATURES = featuresData.features;
28
+ SUPPORTED_FEATURES = featuresData.features || featuresData;
29
+ }
30
+ else {
31
+ console.warn(chalk.yellow(`⚠️ Features file not found at: ${featuresPath}`));
32
32
  }
33
33
  }
34
34
  catch (error) {
@@ -39,6 +39,8 @@ async function loadFeatures() {
39
39
  await loadFeatures();
40
40
  // Export for use in other modules
41
41
  export { SUPPORTED_FEATURES };
42
+ // Re-export path utilities for backward compatibility
43
+ export { getCliRootPath } from './pathResolver.js';
42
44
  /**
43
45
  * Detect the current project's framework and language with improved logic
44
46
  */
@@ -464,15 +466,6 @@ async function copyTemplateFile(sourceFilePath, targetFilePath) {
464
466
  await fs.copy(sourceFilePath, targetFilePath);
465
467
  }
466
468
  }
467
- /**
468
- * Get the CLI installation root directory
469
- */
470
- export function getCliRootPath() {
471
- const __filename = fileURLToPath(import.meta.url);
472
- const __dirname = path.dirname(__filename);
473
- // Go up from src/utils to root directory
474
- return path.resolve(__dirname, '..', '..');
475
- }
476
469
  /**
477
470
  * Show setup instructions for a feature
478
471
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Enhanced Language Configuration for Package Installer CLI v3.0.0
2
+ * Enhanced Language Configuration for Package Installer CLI v3.2.0
3
3
  * Comprehensive language support with modern tooling and advanced features
4
4
  */
5
5
  // Enhanced comprehensive language configurations
@@ -1200,7 +1200,7 @@ export const ENHANCED_LANGUAGE_CONFIGS = {
1200
1200
  // For brevity, I'm showing the structure with key languages implemented
1201
1201
  };
1202
1202
  /**
1203
- * Enhanced utility functions for v3.0.0
1203
+ * Enhanced utility functions for v3.2.0
1204
1204
  */
1205
1205
  export function getSupportedLanguages() {
1206
1206
  return Object.keys(ENHANCED_LANGUAGE_CONFIGS);
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Path resolution utility for Package Installer CLI
3
+ * Centralized path resolution logic that works for both local development and global installations
4
+ */
5
+ import fs from 'fs';
6
+ import path from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ /**
9
+ * Get the CLI installation root directory
10
+ * Works for both local development and global installations across multiple package managers
11
+ */
12
+ export function getCliRootPath() {
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = path.dirname(__filename);
15
+ // All possible package names across different package managers
16
+ const packageNames = [
17
+ '@0xshariq/package-installer', // npm
18
+ 'package-installer-cli', // PyPI, RubyGems, Rust crates
19
+ 'go_package_installer_cli' // Go (from github.com/0xshariq/go_package_installer_cli)
20
+ ];
21
+ // Method 1: Walk up the directory tree to find package.json with any of our package names
22
+ let currentDir = __dirname;
23
+ while (currentDir !== path.dirname(currentDir)) {
24
+ const packageJsonPath = path.join(currentDir, 'package.json');
25
+ if (fs.existsSync(packageJsonPath)) {
26
+ try {
27
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
28
+ if (packageNames.includes(packageJson.name)) {
29
+ return currentDir;
30
+ }
31
+ }
32
+ catch (error) {
33
+ // Continue searching
34
+ }
35
+ }
36
+ currentDir = path.dirname(currentDir);
37
+ }
38
+ // Method 2: Check if this is a local development environment
39
+ const localDevPath = path.resolve(__dirname, '..', '..');
40
+ if (fs.existsSync(path.join(localDevPath, 'package.json')) &&
41
+ fs.existsSync(path.join(localDevPath, 'features'))) {
42
+ try {
43
+ const packageJson = JSON.parse(fs.readFileSync(path.join(localDevPath, 'package.json'), 'utf-8'));
44
+ if (packageNames.includes(packageJson.name)) {
45
+ return localDevPath;
46
+ }
47
+ }
48
+ catch (error) {
49
+ // Continue to other methods
50
+ }
51
+ }
52
+ // Method 3: Try to resolve using require.resolve for npm installations
53
+ for (const packageName of packageNames) {
54
+ try {
55
+ const packageMainPath = require.resolve(`${packageName}/package.json`);
56
+ return path.dirname(packageMainPath);
57
+ }
58
+ catch (error) {
59
+ // Package not found in require cache, try next
60
+ }
61
+ }
62
+ // Method 4: Check common global installation paths for all package managers
63
+ const globalPaths = [];
64
+ // npm global paths
65
+ globalPaths.push(
66
+ // Linux/macOS npm global paths
67
+ '/usr/local/lib/node_modules/@0xshariq/package-installer', '/usr/lib/node_modules/@0xshariq/package-installer',
68
+ // User-specific npm global paths
69
+ path.join(process.env.HOME || '', '.npm-global/lib/node_modules/@0xshariq/package-installer'), path.join(process.env.HOME || '', '.npm/lib/node_modules/@0xshariq/package-installer'),
70
+ // Windows npm global paths
71
+ path.join(process.env.APPDATA || '', 'npm/node_modules/@0xshariq/package-installer'), path.join(process.env.ProgramFiles || '', 'nodejs/node_modules/@0xshariq/package-installer'));
72
+ // PyPI/pip global paths
73
+ if (process.env.HOME) {
74
+ globalPaths.push(
75
+ // Linux/macOS pip user install paths
76
+ path.join(process.env.HOME, '.local/lib/python*/site-packages/package-installer-cli'), path.join(process.env.HOME, '.local/bin/package-installer-cli'),
77
+ // System-wide pip install paths
78
+ '/usr/local/lib/python*/site-packages/package-installer-cli', '/usr/lib/python*/site-packages/package-installer-cli');
79
+ }
80
+ // RubyGems global paths
81
+ if (process.env.HOME) {
82
+ globalPaths.push(
83
+ // User gem installation paths
84
+ path.join(process.env.HOME, '.gem/ruby/*/gems/package-installer-cli-*'), path.join(process.env.HOME, '.local/share/gem/ruby/*/gems/package-installer-cli-*'),
85
+ // System gem installation paths
86
+ '/usr/local/lib/ruby/gems/*/gems/package-installer-cli-*', '/var/lib/gems/*/gems/package-installer-cli-*');
87
+ }
88
+ // Rust cargo global paths
89
+ if (process.env.HOME) {
90
+ globalPaths.push(path.join(process.env.HOME, '.cargo/bin/package-installer-cli'), path.join(process.env.HOME, '.cargo/registry/src/*/package-installer-cli-*'));
91
+ }
92
+ // Go global paths
93
+ const goPath = process.env.GOPATH || path.join(process.env.HOME || '', 'go');
94
+ globalPaths.push(path.join(goPath, 'bin/go_package_installer_cli'), path.join(goPath, 'bin/pi'), // In case the binary is named 'pi'
95
+ path.join(goPath, 'pkg/mod/github.com/0xshariq/go_package_installer_cli*'),
96
+ // Also check system-wide go installation paths
97
+ '/usr/local/bin/go_package_installer_cli', '/usr/local/bin/pi');
98
+ // Check all possible global paths
99
+ for (const globalPath of globalPaths) {
100
+ // Handle wildcard paths
101
+ if (globalPath.includes('*')) {
102
+ try {
103
+ const { execSync } = require('child_process');
104
+ const expandedPaths = execSync(`ls -d ${globalPath} 2>/dev/null || true`, { encoding: 'utf8' }).trim().split('\n').filter((p) => p);
105
+ for (const expandedPath of expandedPaths) {
106
+ if (fs.existsSync(expandedPath) && (fs.existsSync(path.join(expandedPath, 'features')) ||
107
+ fs.existsSync(path.join(path.dirname(expandedPath), 'features')))) {
108
+ return fs.existsSync(path.join(expandedPath, 'features')) ? expandedPath : path.dirname(expandedPath);
109
+ }
110
+ }
111
+ }
112
+ catch (error) {
113
+ // Continue to next path
114
+ }
115
+ }
116
+ else {
117
+ if (fs.existsSync(globalPath) && fs.existsSync(path.join(globalPath, 'features'))) {
118
+ return globalPath;
119
+ }
120
+ }
121
+ }
122
+ // Method 5: Check if npm prefix is available and use it (for npm installations)
123
+ try {
124
+ const { execSync } = require('child_process');
125
+ const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8' }).trim();
126
+ const npmGlobalPath = path.join(npmPrefix, 'lib/node_modules/@0xshariq/package-installer');
127
+ if (fs.existsSync(npmGlobalPath) && fs.existsSync(path.join(npmGlobalPath, 'features'))) {
128
+ return npmGlobalPath;
129
+ }
130
+ }
131
+ catch (error) {
132
+ // npm not available or command failed
133
+ }
134
+ // Method 6: Check binary location and work backwards (for compiled languages like Go/Rust)
135
+ try {
136
+ const { execSync } = require('child_process');
137
+ const whichResult = execSync('which pi || which package-installer-cli || which go_package_installer_cli || echo ""', { encoding: 'utf8' }).trim();
138
+ if (whichResult) {
139
+ // Go up from binary location to find the package root
140
+ let binaryDir = path.dirname(whichResult);
141
+ while (binaryDir !== path.dirname(binaryDir)) {
142
+ if (fs.existsSync(path.join(binaryDir, 'features'))) {
143
+ return binaryDir;
144
+ }
145
+ binaryDir = path.dirname(binaryDir);
146
+ }
147
+ }
148
+ }
149
+ catch (error) {
150
+ // which command failed or not available
151
+ }
152
+ // Final fallback: use the local development path
153
+ console.warn('⚠️ Could not resolve CLI root path, using fallback');
154
+ return path.resolve(__dirname, '..', '..');
155
+ }
156
+ /**
157
+ * Get the path to the features directory
158
+ */
159
+ export function getFeaturesPath() {
160
+ return path.join(getCliRootPath(), 'features');
161
+ }
162
+ /**
163
+ * Get the path to the features.json file
164
+ */
165
+ export function getFeaturesJsonPath() {
166
+ return path.join(getFeaturesPath(), 'features.json');
167
+ }
168
+ /**
169
+ * Get the path to the templates directory
170
+ */
171
+ export function getTemplatesPath() {
172
+ return path.join(getCliRootPath(), 'templates');
173
+ }
174
+ /**
175
+ * Get the path to the package.json file
176
+ */
177
+ export function getPackageJsonPath() {
178
+ return path.join(getCliRootPath(), 'package.json');
179
+ }
@@ -1,22 +1,15 @@
1
1
  /**
2
- * User interaction prompts for Package Installer CLI v3.0.0
2
+ * User interaction prompts for Package Installer CLI v3.2.0
3
3
  * Handles framework selection and template configuration based on template.json
4
4
  */
5
5
  import inquirer from 'inquirer';
6
6
  import chalk from 'chalk';
7
7
  import fs from 'fs-extra';
8
8
  import path from 'path';
9
- import { fileURLToPath } from 'url';
10
- // Get CLI installation directory
11
- function getCLIDirectory() {
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = path.dirname(__filename);
14
- // Go up from src/utils to root directory
15
- return path.resolve(__dirname, '..', '..');
16
- }
9
+ import { getCliRootPath, getFeaturesJsonPath } from './pathResolver.js';
17
10
  // Helper functions to read template.json
18
11
  function getTemplateConfig() {
19
- const cliDir = getCLIDirectory();
12
+ const cliDir = getCliRootPath();
20
13
  const templatePath = path.join(cliDir, 'template.json');
21
14
  if (!fs.existsSync(templatePath)) {
22
15
  throw new Error(`template.json not found at: ${templatePath}`);
@@ -275,8 +268,7 @@ export async function promptFeatureSelection() {
275
268
  return [];
276
269
  }
277
270
  // Get available feature categories from features.json
278
- const cliDir = getCLIDirectory();
279
- const featuresPath = path.join(cliDir, 'features', 'features.json');
271
+ const featuresPath = getFeaturesJsonPath();
280
272
  if (!fs.existsSync(featuresPath)) {
281
273
  console.log(chalk.yellow('⚠️ Features configuration not found'));
282
274
  return [];
@@ -302,8 +294,7 @@ export async function promptFeatureSelection() {
302
294
  * Specific feature provider selection
303
295
  */
304
296
  export async function promptFeatureProvider(category, framework) {
305
- const cliDir = getCLIDirectory();
306
- const featuresPath = path.join(cliDir, 'features', 'features.json');
297
+ const featuresPath = getFeaturesJsonPath();
307
298
  const featuresConfig = JSON.parse(fs.readFileSync(featuresPath, 'utf-8'));
308
299
  if (!featuresConfig[category]) {
309
300
  return null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Template creation utilities for Package Installer CLI v3.0.0
2
+ * Template creation utilities for Package Installer CLI v3.2.0
3
3
  * Enhanced with features integration support
4
4
  */
5
5
  import fs from 'fs-extra';
@@ -329,11 +329,11 @@ async function initializeGitRepositoryForCreate(projectPath) {
329
329
  // Make initial commit
330
330
  try {
331
331
  gitSpinner.text = chalk.hex('#00d2d3')('Creating initial commit with gcommit...');
332
- await execAsync('gcommit "Initial commit from Package Installer CLI v3.0.0"', { cwd: projectPath });
332
+ await execAsync('gcommit "Initial commit from Package Installer CLI v3.2.0"', { cwd: projectPath });
333
333
  }
334
334
  catch {
335
335
  gitSpinner.text = chalk.hex('#00d2d3')('Creating initial commit with git commit...');
336
- await execAsync('git commit -m "Initial commit from Package Installer CLI v3.0.0"', { cwd: projectPath });
336
+ await execAsync('git commit -m "Initial commit from Package Installer CLI v3.2.0"', { cwd: projectPath });
337
337
  }
338
338
  gitSpinner.succeed(chalk.green('✅ Git repository initialized with initial commit'));
339
339
  }
@@ -4,17 +4,10 @@
4
4
  */
5
5
  import path from 'path';
6
6
  import fs from 'fs-extra';
7
- import { fileURLToPath } from 'url';
8
- // Get CLI installation directory
9
- function getCLIDirectory() {
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = path.dirname(__filename);
12
- // Go up from src/utils to root directory
13
- return path.resolve(__dirname, '..', '..');
14
- }
7
+ import { getCliRootPath, getTemplatesPath } from './pathResolver.js';
15
8
  // Helper functions to read template.json
16
9
  function getTemplateConfig() {
17
- const cliDir = getCLIDirectory();
10
+ const cliDir = getCliRootPath();
18
11
  const templatePath = path.join(cliDir, 'template.json');
19
12
  if (!fs.existsSync(templatePath)) {
20
13
  throw new Error(`template.json not found at: ${templatePath}`);
@@ -84,8 +77,7 @@ export function generateTemplateName(framework, options) {
84
77
  */
85
78
  export function resolveTemplatePath(projectInfo) {
86
79
  const { framework, language, templateName } = projectInfo;
87
- const cliDir = getCLIDirectory();
88
- const templatesRoot = path.join(cliDir, 'templates');
80
+ const templatesRoot = getTemplatesPath();
89
81
  // Handle combination templates (like reactjs+expressjs+shadcn)
90
82
  if (framework.includes('+')) {
91
83
  const frameworkDir = framework.replace(/\+/g, '-');
@@ -144,8 +136,8 @@ export function templateExists(templatePath) {
144
136
  * Get all available templates for a framework
145
137
  */
146
138
  export function getFrameworkTemplates(framework) {
147
- const cliDir = getCLIDirectory();
148
- const frameworkPath = path.join(cliDir, 'templates', framework);
139
+ const templatesRoot = getTemplatesPath();
140
+ const frameworkPath = path.join(templatesRoot, framework);
149
141
  if (!fs.existsSync(frameworkPath)) {
150
142
  return [];
151
143
  }
data/dist/utils/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Type definitions for Package Installer CLI v3.0.0
3
- * Enhanced type system without database logic, focused on modern template structure
2
+ * Type definitions for Package Installer CLI v3.2.0
3
+ * Comprehensive type system for enhanced CLI functionality
4
4
  */
5
5
  export {};
data/dist/utils/ui.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * UI and display utilities for Package Installer CLI v3.0.0
3
- * Enhanced with modern styling, progress indicators, and better user experience
2
+ * UI and display utilities for Package Installer CLI v3.2.0
3
+ * Enhanced user interface components and styling utilities
4
4
  */
5
5
  import chalk from 'chalk';
6
6
  import figlet from 'figlet';
data/dist/utils/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Enhanced utility functions for Package Installer CLI v3.0.0
2
+ * Enhanced utility functions for Package Installer CLI v3.2.0
3
3
  * Comprehensive utilities for project management, validation, and operations
4
4
  */
5
5
  import chalk from 'chalk';
@@ -8,7 +8,26 @@ import * as fs from 'fs';
8
8
  import * as crypto from 'crypto';
9
9
  import { promisify } from 'util';
10
10
  import { exec } from 'child_process';
11
+ import { fileURLToPath } from 'url';
12
+ import { getPackageJsonPath } from './pathResolver.js';
11
13
  const execAsync = promisify(exec);
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
16
+ /**
17
+ * Get the current version from package.json
18
+ */
19
+ export function getPackageVersion() {
20
+ try {
21
+ const packageJsonPath = getPackageJsonPath();
22
+ const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8');
23
+ const packageJson = JSON.parse(packageJsonContent);
24
+ return packageJson.version || '3.2.0';
25
+ }
26
+ catch (error) {
27
+ console.warn('Warning: Could not read version from package.json, using fallback version');
28
+ return '3.2.0';
29
+ }
30
+ }
12
31
  /**
13
32
  * Enhanced string utilities
14
33
  */
@@ -4,7 +4,7 @@ require 'open3'
4
4
  require 'json'
5
5
 
6
6
  module PackageInstallerCli
7
- VERSION = "3.2.0"
7
+ VERSION = "1.1.0"
8
8
 
9
9
  class << self
10
10
  def run(args = ARGV)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: package-installer-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sharique
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-22 00:00:00.000000000 Z
11
+ date: 2025-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,6 +105,7 @@ files:
105
105
  - dist/utils/featureInstaller.js
106
106
  - dist/utils/historyManager.js
107
107
  - dist/utils/languageConfig.js
108
+ - dist/utils/pathResolver.js
108
109
  - dist/utils/prompts.js
109
110
  - dist/utils/templateCreator.js
110
111
  - dist/utils/templateResolver.js