shopify cli 3.74.1 'shopify app init --flavor=' not working with official templates

Solved

shopify cli 3.74.1 'shopify app init --flavor=' not working with official templates

rftsu
Shopify Partner
3 1 0

PREREQUISITES

stack: shopify cli 3.74.1

experience with shopify: I have no problem scaffolding an app (like the example qr code remix app, that I can connect correctly to out partner account development store and I've deployed to render.com). Now I've been trying to scaffold apps with different "flavours" via --flavor

STEP TO REPRODUCE

docs rif: https://shopify.dev/docs/api#app-templates

When you scaffold an app using Shopify CLI, you can specify the template that you want to use with the --flavor flag. Enter remix, node, ruby, or php to use one of our app templates, or use a third-party template by providing a path to a GitHub repository for the template.

following the steps detailed above I tried the following:

shopify app init --flavor=php

then this:

shopify app init --flavor=php --template=https://github.com/Shopify/shopify-app-template-php.git

EXPECTED RESULT:

App being scaffolded with default shopify php template: note how https://github.com/Shopify/shopify-app-template-php.git it is not a custom template and this can be confirmed here: https://shopify.dev/docs/api#app-templates

ACTUAL RESULT:

I get the following errors:

for the first cmd I fired:

 

 ERROR: The --flavor flag requires the --template flag to be set 

 

for the second:

ERROR: The --flavor flag is not supported for custom templates 

CONCLUSION:

I've tried the same using the remix template instead of php tempalte but I get the same error: it seems that when using --flavor and --template shopify cli always sees the template as "custom".

Is this a bug? Or there is a way to instruct shopify cli that the template is indeed NOT a custom but a shopify template.

The official documentation cited above is pretty clear about "one of our template" (see the text I have highlighted in bold). It states I'm supposed to provide a url only for third party templates hosted on github repos. But how can I use the default php template then? what should I specify in --template= in order to use a default shopify template?

Note I've also tried this:

shopify app init --flavor=php --template=php

getting the following error:

Only remix, none template aliases are supported, please provide a valid URL

tried with remix and it works fine:

 

shopify app init --flavor=javascript --template=remix

 

tried with ruby (that does not support flavours but works fine as well):

shopify app init --template=ruby

but if I try the same with php instead of ruby I get the following error

ERROR: Only remix, none template aliases are supported, please provide a valid URL
Accepted Solution (1)

rftsu
Shopify Partner
3 1 0

This is an accepted solution.

answering my own question after a few more tries.

I reckon this can be solved via threating the shopify app template as a third party template.

command:

shopify app init --template=https://github.com/Shopify/shopify-app-template-php

Not sure if this is a correct solution but at least it installs the php scaffolded app and I can run the "shopify app dev".

View solution in original post

Reply 1 (1)

rftsu
Shopify Partner
3 1 0

This is an accepted solution.

answering my own question after a few more tries.

I reckon this can be solved via threating the shopify app template as a third party template.

command:

shopify app init --template=https://github.com/Shopify/shopify-app-template-php

Not sure if this is a correct solution but at least it installs the php scaffolded app and I can run the "shopify app dev".