Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
260 stars 272 forks source link

jss deploy config --config option does not work #1560

Closed kpicavet closed 2 weeks ago

kpicavet commented 1 year ago

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

art-alexeyenko commented 1 year ago

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?

illiakovalenko commented 1 year ago

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

kpicavet commented 1 year ago

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.

art-alexeyenko commented 1 year ago

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

stale[bot] commented 1 month ago

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.