Skip to content

Commit

Permalink
Fix assets clean lookups (#474)
Browse files Browse the repository at this point in the history
* Update lib/shakapacker/commands.rb
  • Loading branch information
tomdracz authored May 16, 2024
1 parent cb7b2cf commit bc09740
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ _next_ branch is for v8 changes
## [Unreleased]
Changes since the last non-beta release.

### Fixed

- Fixes incorrect removal of files in the assets:clean task [PR 474](https://github.com/shakacode/shakapacker/pull/474) by [tomdracz](https://github.com/tomdracz).

## [v8.0.0.rc.3] - May 9, 2024

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/shakapacker/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def packs

packs = all_files - manifest_config - current_version
packs.reject { |file| File.directory?(file) }.group_by do |path|
base, _, ext = File.basename(path).scan(/(.*)(-[\da-f]+)(\.\w+)/).flatten
base, _, ext = File.basename(path).scan(/(.*)(-[\da-f]+)([.\w]+)/).flatten
"#{File.dirname(path)}/#{base}#{ext}"
end.values
end
Expand Down
18 changes: 18 additions & 0 deletions spec/shakapacker/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
"js/brandnew-0002.js" => now - 10,
"js/brandnew-0003.js" => now - 20,
"js/brandnew-0004.js" => now - 40,

# Compressed and map files
"js/application-deadbeef.js.br" => now - 4000,
"js/application-deadbeef.js.gz" => now - 4000,
"js/application-deadbeef.js.map" => now - 4000,
"js/application-deadbeef.js.map.br" => now - 4000,
"js/application-deadbeef.js.map.gz" => now - 4000,
"js/application-1eadbeef.js.br" => now - 4000,
"js/application-1eadbeef.js.gz" => now - 4000,
"js/application-1eadbeef.js.map" => now - 4000,
"js/application-1eadbeef.js.map.br" => now - 4000,
"js/application-1eadbeef.js.map.gz" => now - 4000,
}.transform_keys { |path| "#{Shakapacker.config.public_output_path}/#{path}" }
end

Expand All @@ -56,6 +68,12 @@
"js/common-0eadbeee.js" => now - 9002,
"css/common-0eadbeed.css" => now - 9004,
"js/brandnew-0005.js" => now - 3640,
# Compressed and map files
"js/application-0eadbeef.js.br" => now - 9000,
"js/application-0eadbeef.js.gz" => now - 9000,
"js/application-0eadbeef.js.map" => now - 9000,
"js/application-0eadbeef.js.map.br" => now - 9000,
"js/application-0eadbeef.js.map.gz" => now - 9000,
}.transform_keys { |path| "#{Shakapacker.config.public_output_path}/#{path}" }
end

Expand Down

0 comments on commit bc09740

Please sign in to comment.