Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Shopify CLI deletes package.json?

Shopify CLI deletes package.json?

MadeByField
Shopify Partner
7 0 21

Hi,

Does anybody know why the `shopify theme pull` command from the Shopify CLI deletes the local `package.json` file? It leaves the `webpack.config.js` and other similar files. They’re all in the root of the project.

Many thanks,

Dave

Replies 6 (6)

rabraham
Shopify Partner
3 0 1

Hi Dave,

I encountered the same issue and was able to resolve it by using the following command

shopify theme pull --nodelete

That ensures that no local files are squashed in the sync.

Additionally, I recommend creating a .shopifyignore file where you can include all of your non-theme files such as package.json, package-lock, node_modules dir, webpack.config.js etc. The CLI will ignore these files when pushing/pulling which speeds up the actions and avoids problems like the one you're describing.

https://shopify.dev/themes/tools/cli/theme-commands 

https://shopify.dev/themes/tools/cli#excluding-files-from-shopify-cli 

Hope that helps,

Ryan

BigSkillet
Shopify Partner
21 0 19

I've added package.json to .shopifyignore file, but it still deletes the file on pull.

BigSkillet
Shopify Partner
21 0 19

I've submitted an issue on GitHub: https://github.com/Shopify/shopify-cli/issues/1518

EbenHafkamp
Shopify Partner
15 1 6

I haven't worked with shopify cli yet but I'm keen to get into soon ever since I saw the recent hot reloading updates for liquid. What do you think about using the dist folder for doing theme pull? If a pull gets the uploaded dist to shopify, would it make sense to pull it into that folder rather than the root of you local setup? 

Sandy_1
Shopify Partner
7 0 2

To use the GitHub integration you must have the standard file structure, so a /dist or /build folder would not work unless it's a child repo... like using subtree as it says in the docs. You can have other files in the repo, and Shopify will ignore them.

cxris
Shopify Partner
19 0 3

theme pull to where? I have a shopifyignore file and have included my package.json