-
-
Notifications
You must be signed in to change notification settings - Fork 33
Description
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:
shopify-packer/src/server/asset/index.js
Lines 51 to 68 in c507fcb
| _onAssetEmit(file, info) { | |
| if (this._isLiquidStyle(file) && this._hasAssetChanged(file, info)) { | |
| return this.updates.add(`assets/${file}`); | |
| } | |
| if (this._isLiquidTagFile(file) && this._hasAssetChanged(file, info)) { | |
| return this.updates.add(`snippets/${path.basename(file)}`); | |
| } | |
| if ( | |
| (this._isLiquidFile(file) || this._isAssetFile(file)) && | |
| 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))); | |
| } | |
| } |
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)));
}