jss icon indicating copy to clipboard operation
jss copied to clipboard

jss deploy config --config option does not work

Open kpicavet opened this issue 1 year ago • 4 comments

Describe the Bug

When I use the --config option the specify the location of the scjssconfig.json file, it returns the error: 'No Sitecore connection has been configured (missing scjssconfig.json)'. Tried to look into the code why I receive the error & it seems that the code is verifying of that config exists at the default location here in verifySetup() => https://github.com/Sitecore/jss/blob/cb29facddb69f0d261c6d7da93959fd05f23bc01/packages/sitecore-jss-cli/src/scripts/deploy.config.ts

But of course it doesn't exist there as I want to specify the correct location via the option.

To Reproduce

move scjssconfig.json to another location instead of the default location & try to deploy the config with jss deploy config --config='pathToConfig'

Expected Behavior

Don't throw the error & accept the path that is given via the option --config

Possible Fix

don't check the default location as it's not there.

Provide environment information

  • Sitecore Version: 10.3
  • JSS Version: 21.1.0
  • Browser Name and version: /
  • Operating System and version (desktop or mobile): windows 10
  • Link to your project (if available): /

kpicavet avatar Jul 13 '23 14:07 kpicavet

Hi @kpicavet

I'm looking at the code and the doc here: https://doc.sitecore.com/xp/en/developers/hd/19/sitecore-headless-development/walkthrough--connecting-a-jss-application-to-sitecore.htm

and it doesn't seem like --config is a supported option for the deploy command. Could you please share where did you find its mention?

Also, for us to consider implementing the option, could you describe your usecase in more detail? Is there something that prevents putting scjssconfig.json in app root, or do you want to use multiple scjssconfig files and switch between them easily when deploying your app?

art-alexeyenko avatar Jul 17 '23 21:07 art-alexeyenko

@art-alexeyenko jss deploy config supports --config flag, see list of flags here

illiakovalenko avatar Jul 18 '23 06:07 illiakovalenko

We have a monorepo (using NX) with multiple apps. The path of a specific app is now 'apps/{name-of-app}'. As we have multiple apps we would like to have the config in the root of the app itself.

At this moment we fixed it by adding an empty config in the root of the monorepo, because the code only checks if it exists there. Afterwards it will take the correct given config via the --config flag.

kpicavet avatar Jul 18 '23 06:07 kpicavet

@kpicavet thank you! I've added the bug to our backlog.

art-alexeyenko avatar Jul 18 '23 14:07 art-alexeyenko

This has been automatically marked as stale because it has not had recent activity. It will be closed if there is no further activity within 30 days. You may add comments or the 'keep' label to prevent it from closing. Thank you for your contributions.

stale[bot] avatar Jul 20 '24 02:07 stale[bot]