Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] packer start : have it watch and upload all changed files, not just *some* #188

Open
danielbeardsley opened this issue Mar 9, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@danielbeardsley
Copy link
Contributor

danielbeardsley commented Mar 9, 2022

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:

_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)));
   }
@danielbeardsley danielbeardsley added the enhancement New feature or request label Mar 9, 2022
@hayes0724
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants