shakapacker 7.0.0 → 7.0.2

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: 0eef3643fb556af4dc928c1d651fa46cfe5543fc6d5a227d29fcbfd7b3876c3c
4
- data.tar.gz: 4530e671bb02c0af5bbfc37ba1696fff4e81548c40af6df65a06e2bc2d0a9815
3
+ metadata.gz: 51bc05e46de3c757f9d47e0435cb1928759bff38a354b4b63a5e28f5fe91b1c6
4
+ data.tar.gz: a21060c6cd736a1171c78d1bdd927292523148cedccb90e361a4c645be05983e
5
5
  SHA512:
6
- metadata.gz: a7803b77d1d0e9dff88d6cdb25f88c1a89fb4c036153e03d153fe994b216a82a69aaa85d446331945a528443fbd097ac4f49cb64661e66f29b5941a5971315a8
7
- data.tar.gz: 98aba0b391b59a50932d43cab666604998d66c5bcf548f8ceea06c77919a9196ba5ca2861a204ce3f66cd490d69b64e0e8c0dfb10610b6ba64842049f49d2df4
6
+ metadata.gz: eb9e323ebfcc603375ab766b3b2fc87641379e40a18f033703d4b0e1887001d7e7a915f42359a71d307b651f0de2e15e7cb209ccb7d40ccbfd3d839e2436e0ad
7
+ data.tar.gz: c839ce0d465e2fa67379938264de5da4e00f9374202b2e13a36e3f1e6943dde73f80304f9e88f49632a8944ddc2238ea96a81136e609ed16873ce8e06c2cca01
data/CHANGELOG.md CHANGED
@@ -9,6 +9,14 @@ Changes since last non-beta release.
9
9
 
10
10
  _Please add entries here for your pull requests that are not yet released._
11
11
 
12
+ ### Fixed
13
+ - Fixed creation of assets:precompile if it is missing [PR 325](https://github.com/shakacode/shakapacker/pull/325) by [ahangarha](https://github.com/ahangarha).
14
+
15
+ ## [v7.0.1] - June 27, 2023
16
+ ### Fixed
17
+ - Fixed the condition for showing warning for setting `useContentHash` to `false` in the production environment. [PR 320](https://github.com/shakacode/shakapacker/pull/320) by [ahangarha](https://github.com/ahangarha).
18
+
19
+ ## [v7.0.0] - June 23, 2023
12
20
  ### Breaking changes
13
21
  - Removes defaults passed to `@babel/preset-typescript`. [PR 273](https://github.com/shakacode/shakapacker/pull/273) by [tomdracz](https://github.com/tomdracz).
14
22
 
@@ -254,7 +262,9 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
254
262
  ## v5.4.3 and prior changes from rails/webpacker
255
263
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
256
264
 
257
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.6.0...master
265
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v7.0.1...master
266
+ [v7.0.1]: https://github.com/shakacode/shakapacker/compare/v7.0.0...v7.0.1
267
+ [v7.0.0]: https://github.com/shakacode/shakapacker/compare/v6.6.0...v7.0.0
258
268
  [v6.6.0]: https://github.com/shakacode/shakapacker/compare/v6.5.6...v6.6.0
259
269
  [v6.5.6]: https://github.com/shakacode/shakapacker/compare/v6.5.5...v6.5.6
260
270
  [v6.5.5]: https://github.com/shakacode/shakapacker/compare/v6.5.4...v6.5.5
data/docs/v7_upgrade.md CHANGED
@@ -1,41 +1,44 @@
1
1
  # Upgrading from Shakapacker v6 to v7
2
2
 
3
- There will be several substantial and breaking changes in Shakapacker v7 that you need to manually account for when coming from Shakapacker v6.
3
+ There are several breaking changes in Shakapacker v7 that you need to manually account for when coming from Shakapacker v6.
4
4
 
5
- ## Usages of 'webpacker' should now be 'shakapacker'
5
+ ## Usages of `webpacker` should now be `shakapacker`
6
6
 
7
7
  Shakapacker v6 kept the 'webpacker' spelling. As a result, many config filenames, environment variables, rake tasks, etc., used the 'webpacker' spelling. Shakapacker 7 requires renaming to the 'shakapacker' spelling.
8
8
 
9
9
  Shakapacker v7 provides a high degree of backward compatibility for spelling changes. It displays deprecation messages in the terminal to help the developers have a smooth experience in making the required transition to the new requirements.
10
10
 
11
- Please note that Shakapacker v8 will remove any backward compatibility for spelling.
11
+ Just so you know, Shakapacker v8 will remove any backward compatibility for spelling.
12
12
 
13
13
  ### Upgrade Steps
14
14
 
15
15
  **Note:** At each step of changing the version, ensure that you update both gem and npm versions to the same "exact" version (like `x.y.z` and not `^x.y.z` or `>= x.y.z`).
16
16
 
17
- 1. Upgrade Shakapacker to the latest 6.x version and ensure no issues running your application.
17
+ 1. Upgrade Shakapacker to the latest 6.x version and make sure there are no issues running your application.
18
18
  2. Upgrade Shakapacker to version 7.
19
19
  3. Run `rake shakapacker:binstubs` to get the new files in place. Then delete the `bin/webpacker` and `bin/webpacker-dev-server` ones.
20
20
  4. Change spelling from Webpacker to Shakapacker in the code
21
21
  - Change `webpacker_precompile` entry to `shakapacker_precompile` if it exists in the config file.
22
- - Rename Ruby constant `Webpacker` to `Shakapacker` doing a global search and replace in your code. You might not be using it.
22
+ - Rename Ruby constant `Webpacker` to `Shakapacker` by doing a global search and replace in your code. You might not be using it.
23
23
  - Rename`Shakapacker.config.webpacker_precompile?` method, replace it with `Shakapacker.config.shakapacker_precompile?`
24
24
  - `--debug-webpacker` is now `--debug-shakapacker` for your shakapacker binstubs.
25
25
  5. Rename files
26
26
  - Rename `config/webpacker.yml` to `config/shakapacker.yml`.
27
27
  - Rename environment variables from `WEBPACKER_XYZ` to `SHAKAPACKER_XYZ`.
28
- 6. Where you have used webpackConfig, you now need to invoke it as it is a function. Alternatively, you can rename the import to globalMutableWebpackConfig which retains the v6 behavior.
29
- 7. You may need to upgrade dependencies in package.json. You should use `yarn upgrade-interactive`. Note, some upgrades introduce issues. Some will fix issues. You may need to try a few different versions of a dependency to find one that works.
28
+ 6. Where you have used webpackConfig, you must create a new instance with `generateWebpackConfig`. Alternatively, you can rename the import to globalMutableWebpackConfig, which retains the v6 behavior of a global, mutable object.
29
+ 7. You may need to upgrade dependencies in package.json. You should use `yarn upgrade-interactive`.
30
30
 
31
+ ## Stop stripping top-level dirs for static assets
32
+
33
+ When generating file paths for static assets, a top-level directory will no longer be stripped. This will necessitate the update of file name references in asset helpers. For example, the file sourced from `app/javascript/images/image.png` will now be output to `static/images/image.png`, and needs to be referenced as `image_pack_tag("images/image.jpg")` or `image_pack_tag("static/images/image.jpg")`. Nested directories are supported.
31
34
 
32
35
  ## The `webpackConfig` property is changed
33
36
 
34
37
  The `webpackConfig` property in the `shakapacker` module has been changed. The shakapacker module has two options:
35
- 1. `generatedWebpackConfig`: a function that returns an immutable webpack configuration object, which ensures that any modifications made to it will not affect any other usage of the webpack configuration.
36
- 2. `globalMutableWebpackConfig`: if a project still requires the old mutable object. You can rename your imports of `webpackConfig` with `globalMutableWebpackConfig`.
38
+ 1. `generatedWebpackConfig`: a function that returns a new webpack configuration object, which ensures that any modifications made to it will not affect any other usage of the webpack configuration.
39
+ 2. `globalMutableWebpackConfig`: if a project still desires the old mutable object. You can rename your imports of `webpackConfig` with `globalMutableWebpackConfig`.
37
40
 
38
- ### Example Upgrade
41
+ ## Example Upgrade
39
42
  If you started with:
40
43
 
41
44
  ```js
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "7.0.0".freeze
3
+ VERSION = "7.0.2".freeze
4
4
  end
@@ -22,5 +22,7 @@ end
22
22
  if Shakapacker.config.shakapacker_precompile?
23
23
  if Rake::Task.task_defined?("assets:precompile")
24
24
  invoke_shakapacker_compile_in_assets_precompile_task
25
+ else
26
+ Rake::Task.define_task("assets:precompile" => ["shakapacker:compile"])
25
27
  end
26
28
  end
@@ -23,6 +23,19 @@ describe('Production specific config', () => {
23
23
  'js/[name]-[contenthash].chunk.js'
24
24
  )
25
25
  })
26
+
27
+ test("doesn't shows any warning message", () => {
28
+ const consoleWarnSpy = jest.spyOn(console, 'warn');
29
+ const config = require("../../config");
30
+ config.useContentHash = true
31
+ const environmnetConfig = require('../production')
32
+
33
+ expect(consoleWarnSpy).not.toHaveBeenCalledWith(
34
+ expect.stringMatching(/Setting 'useContentHash' to 'false' in the production environment/)
35
+ )
36
+
37
+ consoleWarnSpy.mockRestore()
38
+ })
26
39
  })
27
40
 
28
41
  describe('with config.useContentHash = false', () => {
@@ -36,6 +49,19 @@ describe('Production specific config', () => {
36
49
  'js/[name]-[contenthash].chunk.js'
37
50
  )
38
51
  })
52
+
53
+ test('shows a warning message', () => {
54
+ const consoleWarnSpy = jest.spyOn(console, 'warn');
55
+ const config = require("../../config");
56
+ config.useContentHash = false
57
+ const environmnetConfig = require('../production')
58
+
59
+ expect(consoleWarnSpy).toHaveBeenCalledWith(
60
+ expect.stringMatching(/Setting 'useContentHash' to 'false' in the production environment/)
61
+ )
62
+
63
+ consoleWarnSpy.mockRestore()
64
+ })
39
65
  })
40
66
 
41
67
  describe('with unset config.useContentHash', () => {
@@ -49,5 +75,18 @@ describe('Production specific config', () => {
49
75
  'js/[name]-[contenthash].chunk.js'
50
76
  )
51
77
  })
78
+
79
+ test("doesn't shows any warning message", () => {
80
+ const consoleWarnSpy = jest.spyOn(console, 'warn');
81
+ const config = require("../../config");
82
+ delete config.useContentHash
83
+ const environmnetConfig = require('../production')
84
+
85
+ expect(consoleWarnSpy).not.toHaveBeenCalledWith(
86
+ expect.stringMatching(/Setting 'useContentHash' to 'false' in the production environment/)
87
+ )
88
+
89
+ consoleWarnSpy.mockRestore()
90
+ })
52
91
  })
53
92
  })
@@ -77,7 +77,7 @@ const productionConfig = {
77
77
  }
78
78
  }
79
79
 
80
- if (config.useContentHash === true) {
80
+ if (config.useContentHash === false) {
81
81
  // eslint-disable-next-line no-console
82
82
  console.warn(`⚠️ WARNING
83
83
  Setting 'useContentHash' to 'false' in the production environment (specified by NODE_ENV environment variable) is not allowed!
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
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: 7.0.0
4
+ version: 7.0.2
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: 2023-06-23 00:00:00.000000000 Z
13
+ date: 2023-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -528,7 +528,7 @@ homepage: https://github.com/shakacode/shakapacker
528
528
  licenses:
529
529
  - MIT
530
530
  metadata:
531
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.0.0
531
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.0.2
532
532
  post_install_message:
533
533
  rdoc_options: []
534
534
  require_paths: