The documentation of theme new does not fully describe what the command will do. This can result in unexpected code to be uploaded, and the stripping of config.yml comments.
Update: I noted that this is related to a very recent feature, so I guess that's why it's not documented yet. See linked issue below.
To Reproduce
Steps to reproduce the behavior:
run command 'theme new --env=my-environment --name=theme'
run command 'theme deploy --env=my-environtment" (with a non-default theme in the local working directory)
Creates a new theme on the specified Shopify store, initializes your configuration using your API password and new theme ID, and generates and uploads default templates to make your theme valid.
But "uploads default templates" is not what is happening. The non-default current working directory theme is already being uploaded.
initializes your configuration using your API password and new theme ID
When running theme new with an --env switch, what actually happens is this:
The current config.yml is read
All the comments & whitespace are stripped.
The newly created theme ID is filled into the env that was given.
This processed config.yml is written again
I think that's good behavior, but it's not documented. I didn't know my comments were going to be stripped.
Expected behavior
Document that the local theme will be uploaded if it exists (I'm not sure what the behavior is if this command is run from a directory with only a config.yml present
Document that your current environments will not be deleted by the config initialization, but that the comments will be stripped.
Environment (please complete the following information):
OS [e.g. iOS]: macOS
Themekit version: ThemeKit 1.1.6 darwin/amd64
Editor [e.g. atom, sublime]: VSCode
Ignore: (config/settings_data.json was not ignored)
Describe the bug
The documentation of
theme new
does not fully describe what the command will do. This can result in unexpected code to be uploaded, and the stripping ofconfig.yml
comments.Update: I noted that this is related to a very recent feature, so I guess that's why it's not documented yet. See linked issue below.
To Reproduce Steps to reproduce the behavior:
The documentation (https://shopify.dev/tools/theme-kit/command-reference#new) specifies this:
But "uploads default templates" is not what is happening. The non-default current working directory theme is already being uploaded.
Heres a CLI log:
Note the uploading of the current working directory theme at the end of the
new
commandAlso, note the
318 files, No Change: 318
of thedeploy
command that shows that the local theme was already uploaded. I suspect this line https://github.com/Shopify/themekit/blob/b204edd3a4e1d96559bf2bc75272e0f28e4a07cc/cmd/new.go#L56 is responsible for the deploy.A related unexpected change
The 1-sentence doc further specifies:
When running
theme new
with an--env
switch, what actually happens is this:I think that's good behavior, but it's not documented. I didn't know my comments were going to be stripped.
Expected behavior
config.yml
presentEnvironment (please complete the following information):