cli icon indicating copy to clipboard operation
cli copied to clipboard

[Feature]: Ignore globs from .gitignore when looking for `shopify.web.toml`

Open bradylill opened this issue 1 year ago • 6 comments

What area(s) will this request affect?

Deployment

What type of change do you want to see?

New feature

Overview

I'm currently using sst.dev to deploy some of my infrastructure to support our Shopify app. I notice that sst will copy the shopify.web.toml file multiple time to it's local cache directory located at .sst/.

After a sst deploy if I run shopify app deploy it will throw an error saying "You can only have one web with the backend role in your app"

On further inspection I noticed that the function loadWebs will automatically look for any shopify.web.toml file. If I look at the value of webTomlPaths in that function I can see it found the following paths:

  • ./myapp/shopify.web.toml
  • ./myapp/.sst/dist/asset.1c2820b0c6ebda7219ed80571b3403754fad21f218a63c84f4c2343838f6c325/shopify.web.toml
  • ./myapp/.sst/dist/asset.26364bf4695807ba459400fe064778d5687f8f8568eb65e9ebcbd5e65106cc6f/shopify.web.toml
  • ./myapp/.sst/dist/asset.b13cfda5f566a8a060902ce8e5de6140482397ca4f5b7000858edfb54a0ce02c/shopify.web.toml
  • ./myapp/.sst/dist/asset.e92036fdbd0dbc9c73bc238a935ab561ced0076bb90cf3cd8fdb4c6541295cc6/shopify.web.toml

It would be nice if there was a way to have the contents of .gitignore added to webConfigGlobs so that it would ignore any other cases like this. Personally I would always want it to use .gitignore but I imagine there are cases where someone would want that to be configurable.

This might also be classified as a bug, but I figured it was a bit of an edge case.

I'm also happy to open a PR around this if it's something ya'll deem useful. My workaround at the moment is to force delete the .sst directory before running shopify app deploy in our ci/cd pipeline.

Motivation

I was running into this issue when trying to run shopify app deploy while also working with sst.dev. Figured it would be something that others might run into.

bradylill avatar Apr 11 '24 21:04 bradylill

You could also workaround by putting your web.toml in a specific directory and setting web_directories accordingly

A PR would be very welcome! I'm not sure about loading from .gitignore by default -- that would be a change that might break some unusual existing workflows. Maybe we could make web_directories smarter -- if an option starts with a ! include it in the negation list (we already do some of this to avoid loading from node_modules for instance).

shauns avatar Apr 23 '24 10:04 shauns

This is also an issue when using direnv.

$ shopify app info
CURRENT APP CONFIGURATION

💡 To change these, run `dev --reset`

YOUR PROJECT
Root location   /home/nbe/projects/playground/d-shopifie-2

DIRECTORY COMPONENTS
web
📂 web
    📂 remix (frontend,backend)
    📂 remix (frontend,backend)   .direnv/flake-inputs/bwwr59ppz8ibh1r0dvazdy6j7cbywsyc-source
! You can only have one web with the frontend role in your app

Extensions with errors

TOOLING AND SYSTEM
Shopify CLI       3.59.1
Package manager   pnpm
OS                linux-amd64
Shell             /run/current-system/sw/bin/zsh

Workaround

Here's a workaround:

# file: shopify.app.*.toml

# default value: https://github.com/Shopify/cli/blob/f12748a53845efd9ba58595912d455a3aafa0890/packages/app/src/cli/models/app/loader.ts#L365
- web_directories = ["**"]
# amended value (only looks for a shopify.web.toml in the current directory): https://shopify.dev/docs/apps/structure#configuration
+ web_directories = ["."]

thenbe avatar Apr 24 '24 01:04 thenbe

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Jun 05 '24 03:06 github-actions[bot]

still relevant

thenbe avatar Jun 05 '24 11:06 thenbe

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Jul 18 '24 03:07 github-actions[bot]

still relevant

thenbe avatar Jul 18 '24 11:07 thenbe

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Aug 31 '24 03:08 github-actions[bot]