Skip to content

[#3537654] feat(CLI Tool): Detect first-party and data dependency imports

Closes #3537654

Folder structure changes:

  • Moved /code-editor/utils.ts -> /code-editor/utils/utils.ts
  • Moved 2 functions (getImportsFromAst and getDataDependencies) into a new file called ast-utils.ts that the CLI project can import from. CLI also imports from classNameCandidates.ts which is its own file.
    • @balintbrews mentioned eventually creating different packages that external projects can import functions from instead of creating individual files to import from. This might be worth having its own issue for but I tried to do the simplest thing for now which was follow the convention of the existing classNameCandidates.ts

CLI tool changes (from D.O. issue summary):

⚠️ ⚠️ I didn't get a chance to test this before handing this off so please test the code changes with the CLI tool and test different scenarios and adjust as necessary. Might want to add more helpful user messages to the CLI logging and also check error handling.

  • Reuse the same code, possibly after some refactoring if needed, as we do on the code editor UI to detect first-party imports and data dependencies in the JavaScript source of a code component.
  • Set the appropriate properties in the payload automatically.
  • Remove the importedJsComponents and property dataDependencies from the Component type (defined in cli/src/types/Component.ts)
  • Update the download command so it doesn't write these properties to the metadata file
Edited by Harumi Jang

Merge request reports

Loading