We’re excited to introduce a major enhancement in the 4D Project Dependencies interface, available in 4D 20 R7, making managing both local and GitHub components easier than ever.
This update enables efficient component management through a unified graphical interface, handling both local files and external GitHub releases. The Dependency Manager ensures all team members, on both Mac and Windows, use the same version, with updates, removals, and additions managed centrally, allowing you to optimize your workflow and save valuable time.
REMINDER
As mentioned in this blog post, the Dependency Manager in 4D relies on two key files: ‘dependencies.json’ and ‘environment4d.json’.
dependencies.json
The ‘dependencies.json’ file manages and lists all the component dependencies for your project. It simplifies component loading by centralizing all dependencies in one place, which helps avoid duplication and the use of aliases.
This approach makes component management more efficient, especially in collaborative environments or when using version control systems. It ensures all team members have a consistent view of the project’s dependencies.
environment4d.json
‘environment4d.json’, on the other hand, allows for the customization of component paths.
It enables developers to define absolute or relative paths for local components, providing the flexibility to organize components according to their specific needs.
This means each developer can configure their environment individually, without affecting others, ensuring a more adaptable and personalized setup.
What Does the Project Dependencies’ Graphical Interface Do?
The Project Dependencies’ graphical interface further enhances this system by making it easier to add and remove components by editing the ‘dependencies.json’ and ‘environment4d.json’ files.
Adding or removing a component located next to the package folder will update the ‘dependencies.json’ file while adding a component from another location will update both ‘dependencies.json’ and ‘environment4d.json’.
ADDing COMPONENTS
The Project Dependencies graphical interface enhances the management of both local and GitHub components. To add a component, click the ‘+’ button in the window footer.
A dialog will appear, allowing you to choose whether to add a local component or a component accessible from GitHub. From there, you can either browse for a local component or enter the GitHub repository URL, depending on the component’s location.
GITHUB INTEGRATION
The GitHub integration to the Project Dependencies interface, allows developers to connect directly to GitHub repositories. This simplifies the process of adding, updating, and managing components from both public and private repositories.
ADDING GITHUB DEPENDENCIES
To add a GitHub dependency, simply enter the repository URL or just the ‘<account>/<Repository name>’ in the designated field within the interface. The interface offers four flexible options for version management:
- Latest: this option is selected by default and allows downloading the release that is tagged as the latest (stable) version
- Exact version: Select or manually enter a specific tag from the available list.
- Up to next major version: Define a version range to restrict updates to the next major version.
- Up to next minor version: Similarly, restrict updates to the next minor version.
Once the dependency is set, the ‘dependencies.json’ file is updated automatically with the repository path and chosen tag, reducing the risk of manual errors.
GITHUB TOKEN MANAGEMENT
The interface provides a simple way to enter and edit your GitHub user token, granting you access to private repositories directly from within the interface. By securely storing your token, the system ensures that private repositories are accessible whenever you need them, optimizing your workflow.
COMPONENT UPDATES
The interface offers the option to update all remote dependencies. This ensures that any updates to your components take effect upon the next project restart, keeping your environment up to date with minimal effort.
MANAGING LOCAL COMPONENT
The Project Dependencies graphical interface also enhances the management of local components. A file selection window is available, allowing you to easily choose the appropriate .4dbase package or .4DProject file.
You can customize the path of your new dependency, whether relative or absolute. Using relative paths offers the benefit of easier project portability and better organization, as components can be referenced in relation to the project’s directory structure. This makes it simpler to maintain and share projects across different environments or team members.
REMOVING COMPONENTS
Removing a dependency is just as straightforward. Right-click on the component in the context menu or use the “-” button in the interface footer.
A confirmation prompt will appear to prevent accidental deletions, ensuring you make the right choice. Once confirmed, the dependency is removed from the ‘dependencies.json’ file, and you will be prompted to remove it from the ‘environment4d.json’ file if necessary. This ensures that your project files remain consistent and accurate.
In both cases (whether adding or removing a component) a restart is required to properly load or unload the component and ensure that the changes take effect in your project. A persistent notification will inform you when a restart is necessary.
A persistent notification will tell you when a restart is necessary to load or unload a component.
ENHANCE YOUR WORKFLOW WITH GITHUB AND LOCAL INTEGRATION
This new feature significantly enhances your control over project dependencies, making your 4D development experience more efficient and intuitive. Whether you’re pulling components from GitHub repositories or managing local dependencies, the process is more intuitive and efficient than ever before simplifying component management and collaboration within your projects
We invite you to try out this feature and share your feedback. Stay tuned for more updates as we continue to enhance the 4D development experience with exciting new functionalities!