Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

Unable to create a new mode with CLI

Open eric-taix opened this issue 3 years ago • 0 comments

Bug Report

Describe the Bug

I tried to create a new mode with CLI v2.0.7 (from the v3-stable branch) and then to link that mode (following the CLI documentation).

What steps can we follow to reproduce the bug?

1- Create mode

Output of the create-mode command

  √ Copying template files
  √ Editing Package.json with provided information
  √ Creating a License file
  √ Creating a Readme file
  √ Initializing a Git Repository

Done: mode is ready at C:\Users\eric.taix\development\my-company\Viewers\my-mode

2- Link mode

Output of the link-mode command

$ node ./platform/cli/src/index.js link-mode C:\Users\eric.taix\development\my-company\Viewers\my-mode
success Using linked package for "my-mode".
Done in 1.24s.

Note: I had to use yarn run cli link-mode "C:\Users\eric.taix\development\my-company\Viewers\my-mode" with double quotes around the absolute path, otherwise the directory is not found (I'm working on Windows 10 and I'm using GitBash for my terminal Shell)

Output without double quotes

$ node ./platform/cli/src/index.js link-mode C:Userseric.taixdevelopmentmy-companyViewersmy-mode
The Mode directory does not exist, please provide a valid directory
error Command failed with exit code 1.

3- Launch the app in development mode yarn run dev:local (this specific script only use the APP_CONFIG env variable to setup a local Orthanc server)

Result of the launch

@ohif/viewer: ERROR in ./pluginImports.js 39:0-29
@ohif/viewer: Module not found: Error: Can't resolve 'my-mode' in 'C:\Users\eric.taix\development\my-company\Viewers\platform\viewer\src'
....
....

Only pluginConfig.json and pluginImports.js have been modified in the platform directory. And a new directory have been created with some files.

As a workaround, I also tried to copy/paste an existing mode (longitudinal) and update manually pluginConfig.json and pluginImports.js: everything works fine and I'm able to use this new mode.

I know this is a temporary workaround and shouldn't be modified manually, but we are currently investigating OHIF to use it as part of our next generation applications and we'll probably have to create a lot of modes/extensions.

If you need any further informations please let me know, I'll be pleased to help you. Thanks for your help

eric-taix avatar Sep 01 '22 12:09 eric-taix