hayes0724 / shopify-packer

Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, compatible with Slate and existing websites.
https://hayes0724.github.io/shopify-packer/
MIT License
181 stars 37 forks source link

[FEAT] Run `packer watch` with `--allow-live` flag #52

Closed justin-segler closed 3 years ago

justin-segler commented 3 years ago

I'm just curious. How hard would it be to allow the packer watch command to be run with --allow-live flag? I am trying to use packer to deploy updates to a live site and I simply can't due to the fact that I'm unable to run the watch command with this flag. Would be super nice and probably really easy to do.

Eben-Hafkamp commented 3 years ago

@justin-segler

I guess it's a security thing, in the mean time I got past this by installing ThemeKit locally in my theme.

Then rewriting the deploy script: "deploy": "yarn packer build && yarn shopify-themekit deploy --allow-live --env ",.

Add config.yml in the root with the project dist folder passed in as one of the env options directory: 'dist'

hayes0724 commented 3 years ago

You can also add the "live flag" to the env settings for each theme:

https://hayes0724.github.io/shopify-packer/docs/config/environment

{
    "development": {
      "id": "74500041118",
      "password": "ebd6ce7f27aae8cdafb8111a5b887b9",
      "store": "my-store-name.myshopify.com",
      "live": "false",
      "ignore": [
        "settings_data.json"
      ]
    }
}

I always use a dev theme and push or publish to live so I have not been able to test this.

hayes0724 commented 3 years ago

@Eben-Hafkamp @justin-segler Just tested and both packer start and packer watch on a live theme (using env settings not flags):

  1. Edit env live value to true
  2. packer start or packer watch
  3. Edit live theme 👍
{
    "development": {
      "id": "74500041118",
      "password": "ebd6ce7f27aae8cdafb8111a5b887b9",
      "store": "my-store-name.myshopify.com",
      "live": true,
      "ignore": [
        "settings_data.json"
      ]
    }
}
Eben-Hafkamp commented 3 years ago

Awesome, I will make use of this feature. But still like having a themekit config in the root for quick liquid file deployments made straight from the dist. Handy tip for saving time compiling if that's all you need to do