Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(storefront): strf-9582 stencil push: apply theme to multiple storefronts #825

Conversation

bc-max
Copy link
Contributor

@bc-max bc-max commented Jan 5, 2022

What?

This feature allows users to apply one theme to multiple storefronts/channels. There are several options available for users:

  • stencil push command will check whether multiple storefronts/channels available. If yes, user will be prompted to chose one or several/all ids (list of available channels will be shown in radio button style);
  • stencil push -a -c 123 456 allows to apply a theme to selected channels and further system questions will be skipped;
  • stencil push -a -allc allows to apply a theme to all available channels.

Tickets / Documentation

STRF-9582

Screenshots (if appropriate)

image

image

image

cc @bigcommerce/storefront-team

- README.md - documentation updated;
- theme-api-client.js - activateThemeByVariationId function updated to process multiple channels;
- stencil-push.utils.js - updated to process multiple channels;
- stencil-push.js - channel_ids option added;
@bc-max bc-max requested a review from bookernath January 5, 2022 14:04
@bc-max
Copy link
Contributor Author

bc-max commented Jan 5, 2022

I thought it could be useful to add possibility to use command like stencil push -a -c all (use flag all) to apply theme to all available channels instead of typing all the ids. However, user also can run just stencil push command and choose all channels with radio button shortcuts.

If you think it is a good idea to add all just let me know and I'll amend my PR with respective changes.

@zvuki
Copy link
Contributor

zvuki commented Jan 5, 2022

@bc-max It would make sense to have a separate flag, like stencil push -a -allc for applying to all channels (so -c always expects whitespace-separated ids as an input).

- stencil-push.js - added option to push a theme to all available channels;
- stencil-push.utils.js - added option to push a theme to all available channels;
- stencil-push.utils.spec.js - tests added (work in progress);
- README.md - minor refactoring;
- stencil-push.utils.spec.js - tests added;
lib/theme-api-client.js Outdated Show resolved Hide resolved
- stencil-push.utils.js - Promise.all added;
- theme-api-client.js - JSdocs fix;
@bc-max bc-max mentioned this pull request Jan 13, 2022
@bc-max bc-max merged commit fa7a257 into bigcommerce:master Jan 14, 2022
jairo-bc pushed a commit to jairo-bc/stencil-cli that referenced this pull request Jan 14, 2022
…refronts (bigcommerce#825)

* feat: strf-9582 stencil push: apply theme to multiple storefronts

- README.md - documentation updated;
- theme-api-client.js - activateThemeByVariationId function updated to process multiple channels;
- stencil-push.utils.js - updated to process multiple channels;
- stencil-push.js - channel_ids option added;

* feat(storefront): work in progress

- stencil-push.js - added option to push a theme to all available channels;
- stencil-push.utils.js - added option to push a theme to all available channels;
- stencil-push.utils.spec.js - tests added (work in progress);
- README.md - minor refactoring;

* feat: tests added

- stencil-push.utils.spec.js - tests added;
@deepak-aupchaarik
Copy link

Might be a dumb question, but does this just assume which variation is being applied? I don't see a variation being passed in the command

@jairo-bc
Copy link
Contributor

@dmaurya-gea There's -a option for variation name https://github.com/bigcommerce/stencil-cli/blob/master/bin/stencil-push.js#L14

@deepak-aupchaarik
Copy link

@dmaurya-gea There's -a option for variation name https://github.com/bigcommerce/stencil-cli/blob/master/bin/stencil-push.js#L14

Yes, I'm aware of that flag and we use it. I saw the same being used here for a different purpose so wanted to check. I wish document had an example with the channels flag

Anyway, I added the -c option without the -a option while retaining it for the variation name and it worked

stencil push -a <Variation> -d -c 1 for applying theme to the default channel. For some reason the only storefront was being listed as 2 channels and creating a prompt which broke the build since channel option wasn't passed initially

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants