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.

  1. Move the ipmhub.json to the new project folder.
  2. Run ipm init.
  3. 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 or multiple specific packages.

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.

  1. Update the ipmhub.json to reflect your needs by setting the correct packages and save the changes.
  2. 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.

  1. Update the ipmhub.json to reflect your needs by setting the correct packages and save the changes.
  2. 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

Sync multiple packages

With IPM 0.8.0, you can now synchronize multiple specific packages in a single command using the --packages parameter. This is particularly useful when you want to update several packages without syncing the entire workspace.

  1. Update the ipmhub.json to reflect your needs by setting the correct packages and save the changes.
  2. Launch ipm sync with the --packages parameter to select the packages you want to sync.
    • Example: ipm sync --packages ipmhub/hello-world mycompany/network-module othercompany/security-package -m KeepAllChanges

This approach allows you to:

  • Selectively update multiple packages while leaving others untouched
  • Apply the same sync mode to a group of related packages
  • Streamline package management in complex workspaces
  • Reduce the need for multiple sync commands when updating related components