Sync
Sync your local workspace with IPMHub
Introduction
The ipm sync
command facilitates the synchronization of your local workspace with our remote servers. In the sections below, we explore various scenarios in which the synchronization process proves to be beneficial.
Initialize a new project
When starting a new project or replicating an existing one with multiple packages, diverse strategies, or a otherwise more complex setup, you can effortlessly duplicate the ipmhub.json
file from one project to another.
- Move the
ipmhub.json
to the new project folder. - Run
ipm init
. - Execute
ipm sync
.
Resync an existing project
If you find yourself within an existing project, there may be various reasons to “resync” the project. The ipm sync
command offers multiple modes designed to help you achieve the desired effect.
Different modes
The different sync modes can be accessed using the --mode
/ -m
parameter. All modes are, by default, scoped to the whole project, but they can also be applied to individual packages (package).
Clean
This mode forces a complete resync, effectively deleting all files and downloading them from the IPMHub.
KeepChangesOnly
Preserves files that have changed compared to the original file from this hub.
KeepNewFilesOnly
In this mode, all files from this original project are synced, but files you added to the original structure itself are preserved.
KeepAllChanges
This mode does not touch anything that you have made changes to. It is the default option when no mode is specified.
Upgrading packages
One scenario involves upgrading an existing package to a higher version, a useful method for updating multiple packages simultaneously.
- Update the
ipmhub.json
to reflect your needs by setting the correct packages and save the changes. - Initiate
ipm sync
; this will run the command with the default mode KeepAllChanges.
Sync specific package
It is also possible to sync only a specific package instead of the entire project. This proves helpful when upgrading a large project in multiple phases without the need to edit the ipmhub.json
multiple times.
- Update the
ipmhub.json
to reflect your needs by setting the correct packages and save the changes. - Launch
ipm sync
with the-p
or--package
parameter to select the package you want to sync.- Example:
ipm sync -p ipmhub\hello-world -m clean
- Example: