shakapacker 6.5.6 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17c0e222ab613e6f12721d7bdb999428753be2ad5543908699ee9c6a935e925b
4
- data.tar.gz: b308833c1dece4246d9d427f794abb37bcfd7be30ff11c1471fa70ae3c549ccb
3
+ metadata.gz: 667631baa338ba0105550f29536e148bed8b21475daf816b148ab22be98209f9
4
+ data.tar.gz: 1f49260d3dd206242d022a07200c8d5dbf370fbc72e1dedf10ab033add63dc52
5
5
  SHA512:
6
- metadata.gz: 28136e6a11fd60abd2d5a83554e13d3405a24ea1c7bda76b3c7d689fef6dc4f98352d6a963f26b9cc888cc0c870e840bec662f5cbdfbc89f7e21938c366d4067
7
- data.tar.gz: e5aa229a81dfc4435d4219891f4e8e28560797d365e0ee13584f53743b6cb7c5b8f473690fce75b58d3d47a301ad7862ff8fca1397eacedfb75c450acf8faaaa
6
+ metadata.gz: c830769b5fc9a2c40c0e686848421ee39b6df1ae4866f6ad0f00a60b34e1d3262c2fa7b39012e92cbc5d1a985f200c38a636597a8a4adf339c5961960d457fe2
7
+ data.tar.gz: 818526e1d7b2f5a355a4ffe86c3b09e30ae1ca957fd077e685475aab512fe1107ce3f548e1100811a226c8cce6ed3a5f5a2e1511a9f822112eee9b091e9704c1
data/.eslintrc.js CHANGED
@@ -5,6 +5,7 @@ module.exports = {
5
5
  'import/no-unresolved': 'off',
6
6
  'import/no-extraneous-dependencies': 'off',
7
7
  'import/extensions': 'off',
8
+ "indent": ["error", 2],
8
9
  semi: ['error', 'never']
9
10
  },
10
11
  env: {
@@ -0,0 +1 @@
1
+ github: [shakacode]
@@ -0,0 +1,18 @@
1
+ ### Summary
2
+
3
+ _Remove this paragraph and provide a general description of the code changes in your pull
4
+ request... were there any bugs you had fixed? If so, mention them. If
5
+ these bugs have open GitHub issues, be sure to tag them here as well,
6
+ to keep the conversation linked together._
7
+
8
+ ### Pull Request checklist
9
+ _Remove this line after checking all the items here. If the item is not applicable to the PR, both check it out and wrap it by `~`._
10
+
11
+ - [ ] Add/update test to cover these changes
12
+ - [ ] Update documentation
13
+ - [ ] Update CHANGELOG file
14
+ _Add the CHANGELOG entry at the top of the file._
15
+
16
+ ### Other Information
17
+
18
+ _Remove this parapraph and mention any other important and relevant information such as benchmarks._
data/CHANGELOG.md CHANGED
@@ -8,18 +8,19 @@ Changes since last non-beta release.
8
8
 
9
9
  _Please add entries here for your pull requests that are not yet released._
10
10
 
11
- ## [6.5.6] - February 11, 2023
11
+ ## [v6.6.0] - March 7, 2023
12
+ ### Improved
13
+ - Allow configuration of webpacker.yml through env variable. [PR 254](https://github.com/shakacode/shakapacker/pull/254) by [alecslupu](https://github.com/alecslupu)
14
+
15
+ ## [v6.5.6] - February 11, 2023
12
16
  ### Fixed
13
- - Fixed failing to update `bin/setup` file due to different formats of the file in different versions of Rails. [PR229](https://github.com/shakacode/shakapacker/pull/229) by [ahangarha](https://github.com/ahangarha)
17
+ - Fixed failing to update `bin/setup` file due to different formats of the file in different versions of Rails. [PR 229](https://github.com/shakacode/shakapacker/pull/229) by [ahangarha](https://github.com/ahangarha)
14
18
 
15
19
  - Upgrade several JS dependencies to fix security issues. [PR 243](https://github.com/shakacode/shakapacker/pull/243) by [ahangarha](https://github.com/ahangarha).
16
20
 
17
21
  - Added `prepend_javascript_pack_tag` to helpers. Allows to move an entry to the top of queue. Handy when calling from the layout to make sure an entry goes before the view and partial `append_javascript_pack_tag` entries. [PR 235](https://github.com/shakacode/shakapacker/pull/235) by [paypro-leon](https://github.com/paypro-leon).
18
22
 
19
23
  - Fixed [issue](https://github.com/shakacode/shakapacker/issues/208) to support directories under `node_modules/*` in the `additional_paths` property of `webpacker.yml` [PR 238](https://github.com/shakacode/shakapacker/pull/238) by [vaukalak](https://github.com/vaukalak).
20
-
21
- ## [6.5.6] - January 15, 2023
22
- ### Fixed
23
24
  - Remove duplicate yarn installs. [PR 238](https://github.com/shakacode/shakapacker/pull/238) by [justin808](https://github/justin808).
24
25
  - Remove unneeded code related to CSP config for generator. [PR 223](https://github.com/shakacode/shakapacker/pull/223) by [ahangarha](https://github/ahangarha).
25
26
 
@@ -208,7 +209,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
208
209
  ## v5.4.3 and prior changes from rails/webpacker
209
210
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
210
211
 
211
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.5.6...master
212
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.6.0...master
213
+ [v6.6.0]: https://github.com/shakacode/shakapacker/compare/v6.5.6...v6.6.0
212
214
  [v6.5.6]: https://github.com/shakacode/shakapacker/compare/v6.5.5...v6.5.6
213
215
  [v6.5.5]: https://github.com/shakacode/shakapacker/compare/v6.5.4...v6.5.5
214
216
  [v6.5.4]: https://github.com/shakacode/shakapacker/compare/v6.5.3...v6.5.4
data/docs/v6_upgrade.md CHANGED
@@ -19,7 +19,7 @@ See an example migration here: [PR 27](https://github.com/shakacode/react_on_rai
19
19
  1. Remove setting the NODE_ENV in your `bin/webpacker` and `bin/webpacker-dev-server` bin stubs as these are not set in the webpack runner file.
20
20
 
21
21
  ### Update Steps to v6.0.0 from v6.0.0.rc.6
22
- _If you're on webpacker v5, follow below steps to get to v6.0.0.rc.6 first._
22
+ _If you're on webpacker v5, follow [how to upgrade to webpacker v6.0.0.rc.6 from v5](#how-to-upgrade-to-webpacker-v600rc6-from-v5) to get to v6.0.0.rc.6 first._
23
23
 
24
24
  1. Change the gem name from `webpacker` to `shakapacker` and the NPM package from `@rails/webpacker` to `shakapacker`.
25
25
  1. Install the peer dependencies. Run `yarn add @babel/core @babel/plugin-transform-runtime @babel/preset-env @babel/runtime babel-loader compression-webpack-plugin terser-webpack-plugin webpack webpack-assets-manifest webpack-cli webpack-merge webpack-sources webpack-dev-server`. You may have old versions of libraries. Run `yarn install` and check for warnings like `warning " > shakapacker@6.1.1" has incorrect peer dependency "compression-webpack-plugin@^9.0.0"` and `file-loader@1.1.11" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0"`. In other words, warnings like these are **serious** and will cause considerable confusion if not respected.
@@ -1,10 +1,12 @@
1
+ require "pathname"
1
2
  class Webpacker::Instance
2
3
  cattr_accessor(:logger) { ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT)) }
3
4
 
4
5
  attr_reader :root_path, :config_path
5
6
 
6
7
  def initialize(root_path: Rails.root, config_path: Rails.root.join("config/webpacker.yml"))
7
- @root_path, @config_path = root_path, config_path
8
+ @root_path = root_path
9
+ @config_path = Pathname.new(ENV["WEBPACKER_CONFIG"] || config_path)
8
10
  end
9
11
 
10
12
  def env
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "6.5.6".freeze
3
+ VERSION = "6.6.0".freeze
4
4
  end
@@ -6,16 +6,16 @@ const { isProduction } = require('../env')
6
6
  const jscommon = require('./jscommon')
7
7
 
8
8
  module.exports = loaderMatches(webpackLoader, 'babel', () => ({
9
- test: /\.(js|jsx|mjs|ts|tsx|coffee)?(\.erb)?$/,
10
- ...jscommon,
11
- use: [
12
- {
13
- loader: require.resolve('babel-loader'),
14
- options: {
15
- cacheDirectory: true,
16
- cacheCompression: isProduction,
17
- compact: isProduction
18
- }
9
+ test: /\.(js|jsx|mjs|ts|tsx|coffee)?(\.erb)?$/,
10
+ ...jscommon,
11
+ use: [
12
+ {
13
+ loader: require.resolve('babel-loader'),
14
+ options: {
15
+ cacheDirectory: true,
16
+ cacheCompression: isProduction,
17
+ compact: isProduction
19
18
  }
20
- ]
19
+ }
20
+ ]
21
21
  }))
@@ -1,26 +1,26 @@
1
1
  const { resolve } = require('path')
2
2
  const { realpathSync } = require('fs')
3
3
  const {
4
- source_path: sourcePath,
5
- additional_paths: additionalPaths
4
+ source_path: sourcePath,
5
+ additional_paths: additionalPaths
6
6
  } = require('../config')
7
7
 
8
8
  const inclusions = [sourcePath, ...additionalPaths].map(p => {
9
- try {
10
- return realpathSync(p)
11
- } catch (e) {
12
- return resolve(p)
13
- }
9
+ try {
10
+ return realpathSync(p)
11
+ } catch (e) {
12
+ return resolve(p)
13
+ }
14
14
  })
15
15
 
16
16
  module.exports = {
17
- include: inclusions,
18
- exclude: [
19
- {
20
- // exclude all node_modules from running through babel-loader
21
- and: [resolve('node_modules')],
22
- // Do not exclude inclusions, as otherwise these won't be transpiled
23
- not: [...inclusions]
24
- }
25
- ]
17
+ include: inclusions,
18
+ exclude: [
19
+ {
20
+ // exclude all node_modules from running through babel-loader
21
+ and: [resolve('node_modules')],
22
+ // Do not exclude inclusions, as otherwise these won't be transpiled
23
+ not: [...inclusions]
24
+ }
25
+ ]
26
26
  }
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "6.5.6",
3
+ "version": "6.6.0",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
@@ -33,6 +33,28 @@ describe "Webpacker" do
33
33
  end
34
34
  end
35
35
 
36
+ describe "configurable config" do
37
+ before do
38
+ @original_webpacker_config = ENV["WEBPACKER_CONFIG"]
39
+ end
40
+
41
+ after do
42
+ ENV["WEBPACKER_CONFIG"] = @original_webpacker_config
43
+ end
44
+
45
+ it "allows config file to be changed based on ENV variable" do
46
+ ENV.delete("WEBPACKER_CONFIG")
47
+ Webpacker.instance = nil
48
+ expect(Webpacker.config.config_path.to_s).to eq(Rails.root.join("config/webpacker.yml").to_s)
49
+ end
50
+
51
+ it "allows config file to be changed based on ENV variable" do
52
+ ENV["WEBPACKER_CONFIG"] = "/some/random/path.yml"
53
+ Webpacker.instance = nil
54
+ expect(Webpacker.config.config_path.to_s).to eq("/some/random/path.yml")
55
+ end
56
+ end
57
+
36
58
  it "has app_autoload_paths cleanup" do
37
59
  expect($test_app_autoload_paths_in_initializer).to eq []
38
60
  end
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: 6.5.6
4
+ version: 6.6.0
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-02-12 00:00:00.000000000 Z
13
+ date: 2023-03-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -121,8 +121,10 @@ extra_rdoc_files: []
121
121
  files:
122
122
  - ".eslintignore"
123
123
  - ".eslintrc.js"
124
+ - ".github/FUNDING.yml"
124
125
  - ".github/ISSUE_TEMPLATE/bug_report.md"
125
126
  - ".github/ISSUE_TEMPLATE/feature_request.md"
127
+ - ".github/PULL_REQUEST_TEMPLATE.md"
126
128
  - ".github/workflows/jest.yml"
127
129
  - ".github/workflows/js-lint.yml"
128
130
  - ".github/workflows/rubocop.yml"
@@ -342,7 +344,7 @@ homepage: https://github.com/shakacode/shakapacker
342
344
  licenses:
343
345
  - MIT
344
346
  metadata:
345
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.5.6
347
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.6.0
346
348
  post_install_message:
347
349
  rdoc_options: []
348
350
  require_paths: