shopify-packer
shopify-packer copied to clipboard
[Bug] `packer start` : have it watch and upload all changed files, not just *some*
The Problem
The code that auto-uploads changed files to the theme seems to skip some files. It's really hard to understand the intent of this bit of code, there's a bunch of path matching, but the result is that the function passes on some file paths to the code that uploads them to the theme, but some of them it ignores. We often find that packer start
skips a bunch of JS files (that we think it shouldn't) such that we have to run packer deploy
first. We're not sure why the answer isn't just "Upload all files that don't match the provided ignore patterns".
Describe the solution you'd like
We'd expect it to keep up to date the same set of files that packer deploy
uploads.
Replace the code in question:
https://github.com/hayes0724/shopify-packer/blob/c507fcbd1ed2bd335e4c7bbaeb82b8d25721b3cf/src/server/asset/index.js#L51-L68
With the same action for all paths:
if (this._hasAssetChanged(file, info))
// Note: dist/assets is the "main" output dir and all webpack dirs are
// relative to it. Examples:
// somefile -> assets/somefile
// ../snippets/template -> assets/../snippets/template -> snippets/template
return this.updates.add(path.normalize(path.join('assets', file)));
}
It's an old file from Slate. it's been changed to work with webpack 5 but should be replaced or updated. Many files like this one can cause side effects with the entrypoint system and need updates for json templates. I'm open to PR's or ideas on how to fix this on v2 without breaking builds. Also working on a v3 in typescript that will built from the beginning to work with both json and liquid templates.