package-installer-cli 1.1.0 → 1.3.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 +4 -4
- data/CHANGELOG.md +1 -1
- data/dist/commands/add.js +109 -75
- data/dist/commands/analyze.js +43 -35
- data/dist/commands/cache.js +142 -6
- data/dist/commands/check.js +119 -72
- data/dist/commands/clean.js +230 -92
- data/dist/commands/clone.js +66 -44
- data/dist/commands/create.js +74 -53
- data/dist/commands/deploy.js +30 -22
- data/dist/commands/doctor.js +27 -28
- data/dist/commands/env.js +44 -31
- data/dist/commands/update.js +599 -113
- data/dist/commands/upgrade-cli.js +32 -24
- data/dist/index.js +58 -15
- data/dist/utils/banner.js +1 -1
- data/dist/utils/cacheManager.js +57 -124
- data/dist/utils/dependencyInstaller.js +0 -46
- data/dist/utils/featureInstaller.js +489 -153
- data/dist/utils/helpFormatter.js +110 -0
- data/dist/utils/languageConfig.js +167 -298
- data/dist/utils/pathResolver.js +34 -72
- data/dist/utils/templateResolver.js +3 -4
- data/dist/utils/utils.js +20 -5
- data/lib/package_installer_cli.rb +1 -1
- data/templates/django/django-full-stack-template/django-project-template/deployment/docker/build.sh +0 -0
- data/templates/django/django-full-stack-template/django-project-template/deployment/docker/manage.py +0 -0
- data/templates/django/django-full-stack-template/django-project-template/src/compile-locale.sh +0 -0
- data/templates/django/django-full-stack-template/django-project-template/src/compile-sass.sh +0 -0
- data/templates/django/django-full-stack-template/django-project-template/src/manage.py +0 -0
- data/templates/django/django-inertia-svelte-template/django-inertia-svelte-template-starter/manage.py +0 -0
- data/templates/flask/flask-cookiecutter-advance-template/cookiecutter-docker.sh +0 -0
- data/templates/flask/flask-cookiecutter-advance-template/{{cookiecutter.app_name}}/autoapp.py +0 -0
- data/templates/flask/flask-project-template/apply.sh +0 -0
- data/templates/react-native/typescript/template/android/gradlew +0 -0
- data/templates/ruby/rails_7_esbuild_hotwire_tailwindcss_starter/bin/bundle +0 -0
- data/templates/ruby/rails_7_esbuild_hotwire_tailwindcss_starter/bin/dev +0 -0
- data/templates/ruby/rails_7_esbuild_hotwire_tailwindcss_starter/bin/docker-entrypoint +0 -0
- data/templates/ruby/rails_7_esbuild_hotwire_tailwindcss_starter/bin/rails +0 -0
- data/templates/ruby/rails_7_esbuild_hotwire_tailwindcss_starter/bin/rake +0 -0
- data/templates/ruby/rails_7_esbuild_hotwire_tailwindcss_starter/bin/setup +0 -0
- data/templates/ruby/ruby-on-rails-apis-template/bin/bundle +0 -0
- data/templates/ruby/ruby-on-rails-apis-template/bin/rails +0 -0
- data/templates/ruby/ruby-on-rails-apis-template/bin/rake +0 -0
- data/templates/ruby/ruby-on-rails-apis-template/bin/setup +0 -0
- data/templates/ruby/ruby-on-rails-apis-template/bin/spring +0 -0
- data/templates/ruby/ruby-on-rails-apis-template/bin/update +0 -0
- data/templates/ruby/ruby-on-rails-boilerplate-template/bin/bundle +0 -0
- data/templates/ruby/ruby-on-rails-boilerplate-template/bin/dev +0 -0
- data/templates/ruby/ruby-on-rails-boilerplate-template/bin/importmap +0 -0
- data/templates/ruby/ruby-on-rails-boilerplate-template/bin/rails +0 -0
- data/templates/ruby/ruby-on-rails-boilerplate-template/bin/rake +0 -0
- data/templates/ruby/ruby-on-rails-boilerplate-template/bin/setup +0 -0
- metadata +6 -5
data/dist/utils/pathResolver.js
CHANGED
|
@@ -25,7 +25,7 @@ export function getCliRootPath() {
|
|
|
25
25
|
if (fs.existsSync(packageJsonPath)) {
|
|
26
26
|
try {
|
|
27
27
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
28
|
-
if (packageNames.includes(packageJson.name)) {
|
|
28
|
+
if (packageNames.includes(packageJson.name) && fs.existsSync(path.join(currentDir, 'features'))) {
|
|
29
29
|
return currentDir;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -49,77 +49,51 @@ export function getCliRootPath() {
|
|
|
49
49
|
// Continue to other methods
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
// Method 3:
|
|
52
|
+
// Method 3: Check current working directory (in case the CLI is run from the project root)
|
|
53
|
+
const cwdPath = process.cwd();
|
|
54
|
+
const workspacePackage = path.join(cwdPath, 'package.json');
|
|
55
|
+
if (fs.existsSync(workspacePackage) && fs.existsSync(path.join(cwdPath, 'features'))) {
|
|
56
|
+
try {
|
|
57
|
+
const packageJson = JSON.parse(fs.readFileSync(workspacePackage, 'utf-8'));
|
|
58
|
+
if (packageNames.includes(packageJson.name)) {
|
|
59
|
+
return cwdPath;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
// Continue to other methods
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Method 4: Try to resolve using require.resolve for npm installations
|
|
53
67
|
for (const packageName of packageNames) {
|
|
54
68
|
try {
|
|
55
69
|
const packageMainPath = require.resolve(`${packageName}/package.json`);
|
|
56
|
-
|
|
70
|
+
const resolvedRoot = path.dirname(packageMainPath);
|
|
71
|
+
if (fs.existsSync(path.join(resolvedRoot, 'features'))) {
|
|
72
|
+
return resolvedRoot;
|
|
73
|
+
}
|
|
57
74
|
}
|
|
58
75
|
catch (error) {
|
|
59
76
|
// Package not found in require cache, try next
|
|
60
77
|
}
|
|
61
78
|
}
|
|
62
|
-
// Method
|
|
79
|
+
// Method 5: Check common global installation paths for all package managers
|
|
63
80
|
const globalPaths = [];
|
|
81
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || '';
|
|
64
82
|
// npm global paths
|
|
65
83
|
globalPaths.push(
|
|
66
84
|
// Linux/macOS npm global paths
|
|
67
85
|
'/usr/local/lib/node_modules/@0xshariq/package-installer', '/usr/lib/node_modules/@0xshariq/package-installer',
|
|
68
86
|
// User-specific npm global paths
|
|
69
|
-
path.join(
|
|
87
|
+
path.join(homeDir, '.npm-global/lib/node_modules/@0xshariq/package-installer'), path.join(homeDir, '.npm/lib/node_modules/@0xshariq/package-installer'),
|
|
70
88
|
// Windows npm global paths
|
|
71
89
|
path.join(process.env.APPDATA || '', 'npm/node_modules/@0xshariq/package-installer'), path.join(process.env.ProgramFiles || '', 'nodejs/node_modules/@0xshariq/package-installer'));
|
|
72
|
-
//
|
|
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
|
|
90
|
+
// Check all global paths
|
|
99
91
|
for (const globalPath of globalPaths) {
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
}
|
|
92
|
+
if (fs.existsSync(globalPath) && fs.existsSync(path.join(globalPath, 'features'))) {
|
|
93
|
+
return globalPath;
|
|
120
94
|
}
|
|
121
95
|
}
|
|
122
|
-
// Method
|
|
96
|
+
// Method 6: Check if npm prefix is available and use it (for npm installations)
|
|
123
97
|
try {
|
|
124
98
|
const { execSync } = require('child_process');
|
|
125
99
|
const npmPrefix = execSync('npm config get prefix', { encoding: 'utf8' }).trim();
|
|
@@ -131,26 +105,14 @@ export function getCliRootPath() {
|
|
|
131
105
|
catch (error) {
|
|
132
106
|
// npm not available or command failed
|
|
133
107
|
}
|
|
134
|
-
// Method
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
|
108
|
+
// Method 7: Check relative to script location as last resort
|
|
109
|
+
const scriptRelativePath = path.resolve(__dirname, '../../');
|
|
110
|
+
if (fs.existsSync(path.join(scriptRelativePath, 'features'))) {
|
|
111
|
+
return scriptRelativePath;
|
|
151
112
|
}
|
|
152
|
-
// Final fallback: use the local development path
|
|
153
|
-
console.warn('⚠️ Could not resolve CLI root path, using fallback');
|
|
113
|
+
// Final fallback: use the local development path but warn user
|
|
114
|
+
console.warn('⚠️ Could not resolve CLI root path, using fallback. Some features may not work correctly.');
|
|
115
|
+
console.warn('💡 Try running with npx for better compatibility: npx @0xshariq/package-installer');
|
|
154
116
|
return path.resolve(__dirname, '..', '..');
|
|
155
117
|
}
|
|
156
118
|
/**
|
|
@@ -43,14 +43,13 @@ export function generateTemplateName(framework, options) {
|
|
|
43
43
|
parts.push('no-src');
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
// Handle UI library
|
|
46
|
+
// Handle UI library - only add if actually selected (not "none")
|
|
47
|
+
// When UI is "none", templates simply omit the UI part from their names
|
|
47
48
|
if (config.ui && config.ui.length > 0) {
|
|
48
49
|
if (options.ui && options.ui !== 'none') {
|
|
49
50
|
parts.push(options.ui);
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
parts.push('no-' + config.ui[0]);
|
|
53
|
-
}
|
|
52
|
+
// For "none" selection, don't add any UI part to the template name
|
|
54
53
|
}
|
|
55
54
|
// Handle tailwind option
|
|
56
55
|
if (config.options?.includes('tailwind')) {
|
data/dist/utils/utils.js
CHANGED
|
@@ -18,14 +18,29 @@ const __dirname = path.dirname(__filename);
|
|
|
18
18
|
*/
|
|
19
19
|
export function getPackageVersion() {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
// Try multiple paths to find package.json
|
|
22
|
+
const possiblePaths = [
|
|
23
|
+
getPackageJsonPath(),
|
|
24
|
+
path.resolve(process.cwd(), 'package.json'),
|
|
25
|
+
path.resolve(__dirname, '../../package.json'),
|
|
26
|
+
path.resolve(__dirname, '../../../package.json')
|
|
27
|
+
];
|
|
28
|
+
for (const packagePath of possiblePaths) {
|
|
29
|
+
if (fs.existsSync(packagePath)) {
|
|
30
|
+
const packageJsonContent = fs.readFileSync(packagePath, 'utf-8');
|
|
31
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
32
|
+
if (packageJson.version) {
|
|
33
|
+
return packageJson.version;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Fallback to hardcoded version as last resort
|
|
38
|
+
console.warn('Warning: Could not read version from package.json, using fallback version');
|
|
39
|
+
return '3.6.0';
|
|
25
40
|
}
|
|
26
41
|
catch (error) {
|
|
27
42
|
console.warn('Warning: Could not read version from package.json, using fallback version');
|
|
28
|
-
return '3.
|
|
43
|
+
return '3.6.0';
|
|
29
44
|
}
|
|
30
45
|
}
|
|
31
46
|
/**
|
data/templates/django/django-full-stack-template/django-project-template/deployment/docker/build.sh
CHANGED
|
File without changes
|
data/templates/django/django-full-stack-template/django-project-template/deployment/docker/manage.py
CHANGED
|
File without changes
|
data/templates/django/django-full-stack-template/django-project-template/src/compile-locale.sh
CHANGED
|
File without changes
|
data/templates/django/django-full-stack-template/django-project-template/src/compile-sass.sh
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/templates/flask/flask-cookiecutter-advance-template/{{cookiecutter.app_name}}/autoapp.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- sharique
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-09-
|
|
11
|
+
date: 2025-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -103,6 +103,7 @@ files:
|
|
|
103
103
|
- dist/utils/dashboard.js
|
|
104
104
|
- dist/utils/dependencyInstaller.js
|
|
105
105
|
- dist/utils/featureInstaller.js
|
|
106
|
+
- dist/utils/helpFormatter.js
|
|
106
107
|
- dist/utils/historyManager.js
|
|
107
108
|
- dist/utils/languageConfig.js
|
|
108
109
|
- dist/utils/pathResolver.js
|
|
@@ -2985,8 +2986,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
2985
2986
|
- !ruby/object:Gem::Version
|
|
2986
2987
|
version: '0'
|
|
2987
2988
|
requirements: []
|
|
2988
|
-
rubygems_version: 3.
|
|
2989
|
-
signing_key:
|
|
2989
|
+
rubygems_version: 3.4.20
|
|
2990
|
+
signing_key:
|
|
2990
2991
|
specification_version: 4
|
|
2991
2992
|
summary: A cross-platform, interactive CLI to scaffold modern web app templates
|
|
2992
2993
|
test_files: []
|