rockcarver / frodo-cli

A CLI to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
MIT License
19 stars 17 forks source link

Fix and Improve Script Exports and Imports #435

Closed phalestrivir closed 3 months ago

phalestrivir commented 3 months ago

This PR makes a few updates to help fix and improve script exports and imports. The main changes include:

  1. Adding the option to import and export scripts by id.
  2. Adding the option to not include library scripts in exports of single scripts using the --no-deps flag. Similarly adds the option on single script imports using the same flag to not import library dependencies if so desired.
  3. Fixing many bugs related to script extraction. For example, there were certain cases where importing wouldn't function correctly due to being unable to find the extracted script(s). For exports, library scripts weren't being extracted correctly either. Therefore, an overhaul was done to try and help simplify the extraction process to that it can work for multiple scripts if dealing with library scripts both on export and import.
  4. Fixing the watch option for script imports since I discovered many errors with it. One big one was if there were several scripts for a single json file (e.g. when exporting scripts with library scripts) that only one of the scripts would correctly be watched. This was fixed by creating mappings before watching begins to map extracted script files with their corresponding json files so it functions correctly.
  5. Fixing a small bug with config imports where, if the working directory started with . or ./ it would usually fail due to being unable to locate the expected files it was looking for.
  6. Various other refactoring changes to help improve the code related to scripts, including reducing redundancy and some typo fixes.

There is a PR in frodo-lib (with the same name as this one) that this PR relies on due to a few changes made there.