-
Notifications
You must be signed in to change notification settings - Fork 354
Description
Summary
When cloning an existing Jac application or deleting the .jac folder for a clean slate, users need to re-install all dependencies. Currently, jac install only installs Python/pip dependencies and does not install npm (or other plugin-registered) dependencies.
Current Behavior
jac install- Only installs Python dependencies from[dependencies],[dev-dependencies], and[dependencies.git]sectionsjac add <package> --npm- Works for individual npm packagesjac add --npm(no packages) - Installs all npm packages from[dependencies.npm]
There is no single command to install ALL dependencies (Python + npm + other plugins) at once.
Expected Behavior
jac install should install all dependencies including plugin-registered dependency types (npm, etc.), or there should be a clear flag to do so (e.g., jac install --all).
Reproduction Steps
-
Create a client project:
jac create --use client my-project cd my-project -
The generated
jac.tomlcontains npm dependencies:[dependencies.npm] jac-client-node = "1.0.4" [dependencies.npm.dev] "@jac-client/dev-deps" = "1.0.0"
-
Delete the
.jacfolder to simulate fresh clone:rm -rf .jac
-
Run
jac install:jac install --verbose
Result: Only creates venv, npm packages are NOT installed
-
User must separately run:
jac add --npm
Technical Analysis
The issue is in DependencyInstaller.install_all() which only handles:
config.dependencies(Python packages)config.dev_dependencies(Python dev packages)config.git_dependencies(Git repositories)
The plugin infrastructure for install_all_handler exists in DependencyRegistry and jac-client registers an _npm_install_all_handler, but jac install never invokes these handlers.
Proposed Solution
Modify jac install to:
- After installing Python/Git dependencies, iterate through registered dependency types from
DependencyRegistry - For each registered type with an
install_all_handler, call it to install those dependencies
Example code change in dependencies.impl.jac:
impl DependencyInstaller.install_all(include_dev: bool = False) -> bool {
# ... existing Python/Git installation code ...
# Install plugin dependencies (npm, etc.)
from jaclang.project.dep_registry import get_dependency_registry
registry = get_dependency_registry()
for dep_type in registry.get_all().values() {
if dep_type.install_all_handler is not None {
try {
dep_type.install_all_handler(self.config)
} except Exception as e {
console.error(f"Failed to install {dep_type.name} dependencies: {e}")
all_success = False
}
}
}
return all_success
}Workaround
Until this is fixed, users can create a script in jac.toml:
[scripts]
setup = "jac install && jac add --npm"Then run: jac script setup
Environment
- Jac version: latest (main branch)
- OS: Linux
- Plugin: jac-client