shakapacker 8.0.0.rc.3 → 8.0.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e72a54f983e2119580919efc77ce450a4ffb2f7978732baf3d5867a77ad50bc7
4
- data.tar.gz: 9ffa35b16d167fde5a0a8dbf68744dd7017461c91f7aedf405e1372d40614aaf
3
+ metadata.gz: b80f21f0131e58e60f67a6f091e573f22b3d7c72b3699b4b7aee547635292189
4
+ data.tar.gz: 45d54a9d54a72207ba2e83f9bc04a0214d6c0af98974710a42eee99faf4c74e1
5
5
  SHA512:
6
- metadata.gz: 69fcfa1c1d2cf18918faff7db4c1a9a116a887425629ec4f69e8dc162a4008e99661b058af8e88ae7560b9c684b9494ef047072162e600a00136d0740721767a
7
- data.tar.gz: 81448d6f15ccc851c0c56cf6d7be04b205e02c87dcb489d3ab25a5db7886f999949508c907d10d08e13d732a9c0ec35179ab9cf375af74fe3cefebc4abd2f8c6
6
+ metadata.gz: 256858b1e4735261071074a563fe1aa6638181ed0e7716076ba9381776044aaa4e86bf94f9bfad6e8d49d9621ab7044817d27a3ca4480049ffd56bf0a817ce6e
7
+ data.tar.gz: 0dceb48507cf9b28ff44d980cda954d117a152021f2f8751984b32a650b0be894bbfb43fff9025e26c2a4bc1f43cd718e86dfc818d4915da0f779126697a9067
data/CHANGELOG.md CHANGED
@@ -10,6 +10,17 @@ _next_ branch is for v8 changes
10
10
  ## [Unreleased]
11
11
  Changes since the last non-beta release.
12
12
 
13
+ ### Breaking changes
14
+ - Removes CDN url from the manifest.json paths. [PR 473](https://github.com/shakacode/shakapacker/pull/473) by [tomdracz](https://github.com/tomdracz).
15
+
16
+ This returns to the Webpacker behaviour prior to the aborted Webpacker v6.
17
+
18
+ ### Fixed
19
+
20
+ - 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).
21
+
22
+ ## [v8.0.0.rc.3] - May 9, 2024
23
+
13
24
  ### Fixed
14
25
 
15
26
  - Support v9 PNPM lockfiles [PR 472](https://github.com/shakacode/shakapacker/pull/472) by [G-Rath](https://github.com/g-rath).
@@ -359,7 +370,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
359
370
  ## v5.4.3 and prior changes from rails/webpacker
360
371
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
361
372
 
362
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v8.0.0-rc.2...main
373
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v8.0.0-rc.3...main
374
+ [v8.0.0.rc.3]: https://github.com/shakacode/shakapacker/compare/v8.0.0-rc.2...v8.0.0-rc.3
363
375
  [v8.0.0.rc.2]: https://github.com/shakacode/shakapacker/compare/v7.2.3...v8.0.0-rc.2
364
376
  [v7.2.3]: https://github.com/shakacode/shakapacker/compare/v7.2.2...v7.2.3
365
377
  [v7.2.2]: https://github.com/shakacode/shakapacker/compare/v7.2.1...v7.2.2
data/README.md CHANGED
@@ -27,11 +27,17 @@ See a comparison of [Shakapacker with jsbundling-rails](https://github.com/rails
27
27
  For discussions, see our [Slack Channel](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE).
28
28
 
29
29
  ---
30
- ### ShakaCode Support
30
+ ## ShakaCode Support
31
31
 
32
- [ShakaCode](https://www.shakacode.com) offers support for upgrading from Webpacker and using Shakapacker. If interested, contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com). We're also [hiring](https://jobs.lever.co/shakacode/3bdbfdb3-4495-4611-a279-01dddb351abe)!
32
+ [ShakaCode](https://www.shakacode.com) focuses on helping Ruby on Rails teams use React and Webpack better. We can upgrade your project and improve your development and customer experiences, allowing you to focus on building new features or fixing bugs instead.
33
33
 
34
- Here's a testimonial of how ShakaCode can help, from [Florian Gößler](https://github.com/FGoessler) of [Blinkist](https://www.blinkist.com/), January 2, 2023:
34
+ For an overview of working with us, see our [Client Engagement Model](https://www.shakacode.com/blog/client-engagement-model/) article and [how we bill for time](https://www.shakacode.com/blog/shortcut-jira-trello-github-toggl-time-and-task-tracking/).
35
+
36
+ We also specialize in helping development teams lower infrastructure and CI costs. Check out our project [Control Plane Flow](https://github.com/shakacode/control-plane-flow/), which can allow you to get the ease of Heroku with the power of Kubernetes and big cost savings.
37
+
38
+ If you think ShakaCode can help your project, [click here](https://meetings.hubspot.com/justingordon/30-minute-consultation) to book a call with [Justin Gordon](mailto:justin@shakacode.com), the creator of React on Rails and Shakapacker.
39
+
40
+ Here's a testimonial of how ShakaCode can help from [Florian Gößler](https://github.com/FGoessler) of [Blinkist](https://www.blinkist.com/), January 2, 2023:
35
41
  > Hey Justin 👋
36
42
  >
37
43
  > I just wanted to let you know that we today shipped the webpacker to shakapacker upgrades and it all seems to be running smoothly! Thanks again for all your support and your teams work! 😍
@@ -40,7 +46,7 @@ Here's a testimonial of how ShakaCode can help, from [Florian Gößler](https://
40
46
  >
41
47
  > Have a great 2023 and maybe we get to work together again later in the year! 🙌
42
48
 
43
- Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2118154). Here's [another review of a Shakapacker migration that led to more work](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2096078).
49
+ Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2118154).
44
50
 
45
51
  ---
46
52
 
@@ -985,7 +991,7 @@ The following companies support our Open Source projects, and ShakaCode uses the
985
991
  <img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px">
986
992
  </picture>
987
993
  </a>
988
- <a href="https://controlplane.com">
994
+ <a href="https://shakacode.controlplane.com">
989
995
  <picture>
990
996
  <img alt="Control Plane" src="https://github.com/shakacode/.github/assets/20628911/90babd87-62c4-4de3-baa4-3d78ef4bec25" height="120px">
991
997
  </picture>
data/docs/v8_upgrade.md CHANGED
@@ -7,9 +7,55 @@ manager is used to manage JavaScript dependencies.
7
7
  Support for Ruby 2.6 and Node v12 has also been dropped since they're very old
8
8
  at this point.
9
9
 
10
+ ## CDN host is stripped from the manifest output
11
+
12
+ In Webpacker v5, the manifest.json file did not include the CDN asset host if defined. THis has been added in the aborted v6 and we've retained this in Shakapacker.
13
+
14
+ Presence of this host in the output could lead to unexpected issues and required [some workarounds](https://github.com/shakacode/shakapacker/blob/main/docs/troubleshooting.md#wrong-cdn-src-from-javascript_pack_tag) in certain cases.
15
+
16
+ If you are not using CDN, then this change will have no effect on your setup.
17
+
18
+ If you are using CDN and your CDN host is static, `config.asset_host` setting in Rails will be respected during compilation and when referencing assets through view helpers.
19
+
20
+ If your host might differ, between various environments for example, you will either need to:
21
+ - Ensure the assets are specifically rebuilt for each environment (Heroku pipeline promote feature for example does not do that by default).
22
+ - Make sure the assets are compiled with `SHAKAPACKER_ASSET_HOST=''` ENV variable to avoid hardcording URLs in packs output.
23
+
24
+ Second option has got a certain gotcha - dynamic imports and static asset references (like image paths in CSS) will end up without host reference and the app will try and fetch them from your app host rather than defined `config.asset_host`.
25
+
26
+ Make sure the assets are compiled with `SHAKAPACKER_ASSET_HOST=''` ENV variable to avoid hardcoding URLs in packs output.
27
+
28
+ To get around that, you can use dynamic override as outlined by [Webpack documentation](https://webpack.js.org/guides/asset-modules/#on-the-fly-override).
29
+
30
+ Setting for example:
31
+
32
+ ```
33
+ __webpack_public_path__ = 'https://mycdn.url.com/packs';
34
+ ```
35
+
36
+ In your code and ensuring it is run first in the app, will allow the dynamic imports lookup path to be overriden at runtime.
37
+
38
+ You can also try Webpack `output.publicPath` option of `'auto'` as per https://webpack.js.org/guides/public-path/#automatic-publicpath.
39
+
40
+ For example in your `webpack.config.js`:
41
+
42
+ ```
43
+ const { generateWebpackConfig } = require('shakapacker')
44
+
45
+ const customConfig = {
46
+ output: {
47
+ publicPath: 'auto'
48
+ }
49
+ };
50
+
51
+ module.exports = generateWebpackConfig(customConfig);
52
+ ```
53
+
54
+ This will work in number of environments although some older browsers like IE will require a polyfill as mentioned in the Webpack documentation linked above.
55
+
10
56
  ## The `packageManager` property in `package.json` is used to determine the package manager
11
57
 
12
- The biggest functional change in v8, `shakapacker` is now able to work with any
58
+ The biggest functional change in v8, `shakapacker` can now work with any
13
59
  of the major JavaScript package managers thanks to the
14
60
  [`package_json`](https://github.com/shakacode/package_json) gem which uses the
15
61
  [`packageManager`](https://nodejs.org/api/packages.html#packagemanager) property
@@ -61,7 +61,7 @@ class Shakapacker::Commands
61
61
 
62
62
  packs = all_files - manifest_config - current_version
63
63
  packs.reject { |file| File.directory?(file) }.group_by do |path|
64
- base, _, ext = File.basename(path).scan(/(.*)(-[\da-f]+)(\.\w+)/).flatten
64
+ base, _, ext = File.basename(path).scan(/(.*)(-[\da-f]+)([.\w]+)/).flatten
65
65
  "#{File.dirname(path)}/#{base}#{ext}"
66
66
  end.values
67
67
  end
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "8.0.0.rc.3".freeze
3
+ VERSION = "8.0.0.rc.4".freeze
4
4
  end
@@ -80,7 +80,7 @@ const getPlugins = () => {
80
80
  writeToDisk: true,
81
81
  output: config.manifestPath,
82
82
  entrypointsUseAssets: true,
83
- publicPath: true
83
+ publicPath: config.publicPathWithoutCDN
84
84
  })
85
85
  ]
86
86
 
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "8.0.0-rc.3",
3
+ "version": "8.0.0-rc.4",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "homepage": "https://github.com/shakacode/shakapacker",
6
6
  "bugs": {
@@ -46,6 +46,18 @@ describe "Command" do
46
46
  "js/brandnew-0002.js" => now - 10,
47
47
  "js/brandnew-0003.js" => now - 20,
48
48
  "js/brandnew-0004.js" => now - 40,
49
+
50
+ # Compressed and map files
51
+ "js/application-deadbeef.js.br" => now - 4000,
52
+ "js/application-deadbeef.js.gz" => now - 4000,
53
+ "js/application-deadbeef.js.map" => now - 4000,
54
+ "js/application-deadbeef.js.map.br" => now - 4000,
55
+ "js/application-deadbeef.js.map.gz" => now - 4000,
56
+ "js/application-1eadbeef.js.br" => now - 4000,
57
+ "js/application-1eadbeef.js.gz" => now - 4000,
58
+ "js/application-1eadbeef.js.map" => now - 4000,
59
+ "js/application-1eadbeef.js.map.br" => now - 4000,
60
+ "js/application-1eadbeef.js.map.gz" => now - 4000,
49
61
  }.transform_keys { |path| "#{Shakapacker.config.public_output_path}/#{path}" }
50
62
  end
51
63
 
@@ -56,6 +68,12 @@ describe "Command" do
56
68
  "js/common-0eadbeee.js" => now - 9002,
57
69
  "css/common-0eadbeed.css" => now - 9004,
58
70
  "js/brandnew-0005.js" => now - 3640,
71
+ # Compressed and map files
72
+ "js/application-0eadbeef.js.br" => now - 9000,
73
+ "js/application-0eadbeef.js.gz" => now - 9000,
74
+ "js/application-0eadbeef.js.map" => now - 9000,
75
+ "js/application-0eadbeef.js.map.br" => now - 9000,
76
+ "js/application-0eadbeef.js.map.gz" => now - 9000,
59
77
  }.transform_keys { |path| "#{Shakapacker.config.public_output_path}/#{path}" }
60
78
  end
61
79
 
@@ -21,6 +21,13 @@ describe("Config", () => {
21
21
  expect(config.publicPath).toBe("http://foo.com/packs/")
22
22
  })
23
23
 
24
+ test("public path without CDN is not affected by the asset host", () => {
25
+ process.env.RAILS_ENV = "development"
26
+ process.env.SHAKAPACKER_ASSET_HOST = "http://foo.com/"
27
+ const config = require("../../package/config")
28
+ expect(config.publicPathWithoutCDN).toBe("/packs/")
29
+ })
30
+
24
31
  test("should return additional paths as listed in app config, with resolved paths", () => {
25
32
  const config = require("../../package/config")
26
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shakapacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.rc.3
4
+ version: 8.0.0.rc.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-05-10 00:00:00.000000000 Z
13
+ date: 2024-05-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -506,7 +506,7 @@ homepage: https://github.com/shakacode/shakapacker
506
506
  licenses:
507
507
  - MIT
508
508
  metadata:
509
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v8.0.0-rc.3
509
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v8.0.0-rc.4
510
510
  post_install_message:
511
511
  rdoc_options: []
512
512
  require_paths: