shakapacker 7.0.2 → 7.1.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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dummy.yml +4 -2
  3. data/.github/workflows/generator.yml +4 -2
  4. data/.github/workflows/jest.yml +5 -3
  5. data/.github/workflows/js-lint.yml +5 -3
  6. data/.github/workflows/rubocop.yml +4 -2
  7. data/.github/workflows/ruby-backward-compatibility.yml +5 -3
  8. data/.github/workflows/ruby.yml +5 -3
  9. data/CHANGELOG.md +15 -1
  10. data/CONTRIBUTING.md +3 -4
  11. data/README.md +37 -23
  12. data/docs/deployment.md +1 -1
  13. data/docs/react.md +4 -4
  14. data/docs/troubleshooting.md +4 -8
  15. data/docs/using_esbuild_loader.md +3 -5
  16. data/docs/v6_upgrade.md +1 -1
  17. data/docs/v7_upgrade.md +2 -2
  18. data/lib/install/template.rb +2 -2
  19. data/lib/shakapacker/compiler.rb +1 -1
  20. data/lib/shakapacker/deprecation_helper.rb +1 -1
  21. data/lib/shakapacker/dev_server_runner.rb +2 -1
  22. data/lib/shakapacker/utils/misc.rb +1 -1
  23. data/lib/shakapacker/version.rb +1 -1
  24. data/lib/shakapacker/version_checker.rb +35 -2
  25. data/lib/shakapacker/webpack_runner.rb +4 -3
  26. data/lib/tasks/shakapacker/binstubs.rake +2 -2
  27. data/lib/tasks/shakapacker/check_binstubs.rake +7 -2
  28. data/lib/tasks/shakapacker/install.rake +2 -2
  29. data/package/__tests__/index.js +24 -0
  30. data/package/environments/__tests__/base-bc.js +1 -1
  31. data/package/environments/__tests__/development.js +9 -9
  32. data/package/environments/__tests__/production.js +12 -12
  33. data/package/index.d.ts +61 -0
  34. data/package/index.js +8 -2
  35. data/package.json +12 -1
  36. data/rakelib/release.rake +1 -1
  37. data/spec/backward_compatibility_specs/compiler_spec.rb +2 -2
  38. data/spec/backward_compatibility_specs/compiler_strategy_spec.rb +5 -3
  39. data/spec/backward_compatibility_specs/configuration_spec.rb +16 -8
  40. data/spec/backward_compatibility_specs/dev_server_runner_spec.rb +17 -16
  41. data/spec/backward_compatibility_specs/dev_server_spec.rb +1 -1
  42. data/spec/backward_compatibility_specs/digest_strategy_spec.rb +2 -0
  43. data/spec/backward_compatibility_specs/engine_rake_tasks_spec.rb +2 -1
  44. data/spec/backward_compatibility_specs/helper_spec.rb +20 -20
  45. data/spec/backward_compatibility_specs/instance_spec.rb +3 -3
  46. data/spec/backward_compatibility_specs/manifest_spec.rb +12 -12
  47. data/spec/backward_compatibility_specs/mtime_strategy_spec.rb +3 -3
  48. data/spec/backward_compatibility_specs/rake_tasks_spec.rb +9 -5
  49. data/spec/backward_compatibility_specs/webpack_runner_spec.rb +14 -18
  50. data/spec/dummy/config/webpack/commonWebpackConfig.js +1 -1
  51. data/spec/fixtures/beta_pnpm-lock.v7.yaml +116 -0
  52. data/spec/fixtures/beta_pnpm-lock.v8.yaml +2537 -0
  53. data/spec/fixtures/git_url_pnpm-lock.v7.yaml +126 -0
  54. data/spec/fixtures/git_url_pnpm-lock.v8.yaml +3728 -0
  55. data/spec/fixtures/github_url_pnpm-lock.v7.yaml +126 -0
  56. data/spec/fixtures/github_url_pnpm-lock.v8.yaml +3728 -0
  57. data/spec/fixtures/relative_path_pnpm-lock.v7.yaml +18 -0
  58. data/spec/fixtures/relative_path_pnpm-lock.v8.yaml +22 -0
  59. data/spec/fixtures/semver_caret_pnpm-lock.v7.yaml +117 -0
  60. data/spec/fixtures/semver_caret_pnpm-lock.v8.yaml +2558 -0
  61. data/spec/fixtures/semver_exact_pnpm-lock.v7.yaml +117 -0
  62. data/spec/fixtures/semver_exact_pnpm-lock.v8.yaml +2558 -0
  63. data/spec/fixtures/semver_tilde_pnpm-lock.v7.yaml +116 -0
  64. data/spec/fixtures/semver_tilde_pnpm-lock.v8.yaml +2558 -0
  65. data/spec/fixtures/without_pnpm-lock.v7.yaml +23 -0
  66. data/spec/fixtures/without_pnpm-lock.v8.yaml +27 -0
  67. data/spec/generator_specs/generator_spec.rb +11 -7
  68. data/spec/shakapacker/compiler_spec.rb +2 -2
  69. data/spec/shakapacker/compiler_strategy_spec.rb +5 -3
  70. data/spec/shakapacker/configuration_spec.rb +16 -6
  71. data/spec/shakapacker/dev_server_runner_spec.rb +22 -16
  72. data/spec/shakapacker/dev_server_spec.rb +1 -1
  73. data/spec/shakapacker/digest_strategy_spec.rb +2 -0
  74. data/spec/shakapacker/engine_rake_tasks_spec.rb +2 -1
  75. data/spec/shakapacker/helper_spec.rb +20 -20
  76. data/spec/shakapacker/instance_spec.rb +2 -2
  77. data/spec/shakapacker/manifest_spec.rb +12 -12
  78. data/spec/shakapacker/mtime_strategy_spec.rb +3 -3
  79. data/spec/shakapacker/rake_tasks_spec.rb +6 -3
  80. data/spec/shakapacker/shakapacker_spec.rb +4 -4
  81. data/spec/shakapacker/version_checker_spec.rb +470 -123
  82. data/spec/shakapacker/webpack_runner_spec.rb +14 -18
  83. metadata +20 -3
@@ -12,44 +12,40 @@ describe "WebpackRunner" do
12
12
  ENV["RAILS_ENV"] = @original_rails_env
13
13
  end
14
14
 
15
- it "runs cmd via node_modules" do
15
+ let(:test_app_path) { File.expand_path("./test_app", __dir__) }
16
+
17
+ it "supports running via node_modules" do
16
18
  cmd = ["#{test_app_path}/node_modules/.bin/webpack", "--config", "#{test_app_path}/config/webpack/webpack.config.js"]
17
19
 
18
20
  verify_command(cmd, use_node_modules: true)
19
21
  end
20
22
 
21
- it "runs cmd via yarn" do
23
+ it "supports running via yarn" do
22
24
  cmd = ["yarn", "webpack", "--config", "#{test_app_path}/config/webpack/webpack.config.js"]
23
25
 
24
26
  verify_command(cmd, use_node_modules: false)
25
27
  end
26
28
 
27
- it "runs cmd argv" do
29
+ it "passes on arguments" do
28
30
  cmd = ["#{test_app_path}/node_modules/.bin/webpack", "--config", "#{test_app_path}/config/webpack/webpack.config.js", "--watch"]
29
31
 
30
32
  verify_command(cmd, argv: ["--watch"])
31
33
  end
32
34
 
33
35
  private
34
- def test_app_path
35
- File.expand_path("./test_app", __dir__)
36
- end
37
36
 
38
37
  def verify_command(cmd, use_node_modules: true, argv: [])
39
- cwd = Dir.pwd
40
- Dir.chdir(test_app_path)
41
-
42
- klass = Shakapacker::WebpackRunner
43
- instance = klass.new(argv)
38
+ Dir.chdir(test_app_path) do
39
+ klass = Shakapacker::WebpackRunner
40
+ instance = klass.new(argv)
44
41
 
45
- allow(klass).to receive(:new).and_return(instance)
46
- allow(instance).to receive(:node_modules_bin_exist?).and_return(use_node_modules)
47
- allow(Kernel).to receive(:exec)
42
+ allow(klass).to receive(:new).and_return(instance)
43
+ allow(instance).to receive(:node_modules_bin_exist?).and_return(use_node_modules)
44
+ allow(Kernel).to receive(:exec)
48
45
 
49
- klass.run(argv)
46
+ klass.run(argv)
50
47
 
51
- expect(Kernel).to have_received(:exec).with(Shakapacker::Compiler.env, *cmd)
52
- ensure
53
- Dir.chdir(cwd)
48
+ expect(Kernel).to have_received(:exec).with(Shakapacker::Compiler.env, *cmd)
49
+ end
54
50
  end
55
51
  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: 7.0.2
4
+ version: 7.1.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-07-03 00:00:00.000000000 Z
13
+ date: 2023-10-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -251,6 +251,7 @@ files:
251
251
  - package/environments/production.js
252
252
  - package/environments/test.js
253
253
  - package/esbuild/index.js
254
+ - package/index.d.ts
254
255
  - package/index.js
255
256
  - package/rules/__tests__/__utils__/webpack.js
256
257
  - package/rules/__tests__/babel.js
@@ -424,41 +425,57 @@ files:
424
425
  - spec/fixtures/beta_package-lock.v1.json
425
426
  - spec/fixtures/beta_package-lock.v2.json
426
427
  - spec/fixtures/beta_package.json
428
+ - spec/fixtures/beta_pnpm-lock.v7.yaml
429
+ - spec/fixtures/beta_pnpm-lock.v8.yaml
427
430
  - spec/fixtures/beta_yarn.v1.lock
428
431
  - spec/fixtures/beta_yarn.v2.lock
429
432
  - spec/fixtures/git_url_package-lock.v1.json
430
433
  - spec/fixtures/git_url_package-lock.v2.json
431
434
  - spec/fixtures/git_url_package.json
435
+ - spec/fixtures/git_url_pnpm-lock.v7.yaml
436
+ - spec/fixtures/git_url_pnpm-lock.v8.yaml
432
437
  - spec/fixtures/git_url_yarn.v1.lock
433
438
  - spec/fixtures/git_url_yarn.v2.lock
434
439
  - spec/fixtures/github_url_package-lock.v1.json
435
440
  - spec/fixtures/github_url_package-lock.v2.json
436
441
  - spec/fixtures/github_url_package.json
442
+ - spec/fixtures/github_url_pnpm-lock.v7.yaml
443
+ - spec/fixtures/github_url_pnpm-lock.v8.yaml
437
444
  - spec/fixtures/github_url_yarn.v1.lock
438
445
  - spec/fixtures/github_url_yarn.v2.lock
439
446
  - spec/fixtures/relative_path_package-lock.v1.json
440
447
  - spec/fixtures/relative_path_package-lock.v2.json
441
448
  - spec/fixtures/relative_path_package.json
449
+ - spec/fixtures/relative_path_pnpm-lock.v7.yaml
450
+ - spec/fixtures/relative_path_pnpm-lock.v8.yaml
442
451
  - spec/fixtures/relative_path_yarn.v1.lock
443
452
  - spec/fixtures/relative_path_yarn.v2.lock
444
453
  - spec/fixtures/semver_caret_package-lock.v1.json
445
454
  - spec/fixtures/semver_caret_package-lock.v2.json
446
455
  - spec/fixtures/semver_caret_package.json
456
+ - spec/fixtures/semver_caret_pnpm-lock.v7.yaml
457
+ - spec/fixtures/semver_caret_pnpm-lock.v8.yaml
447
458
  - spec/fixtures/semver_caret_yarn.v1.lock
448
459
  - spec/fixtures/semver_caret_yarn.v2.lock
449
460
  - spec/fixtures/semver_exact_package-lock.v1.json
450
461
  - spec/fixtures/semver_exact_package-lock.v2.json
451
462
  - spec/fixtures/semver_exact_package.json
463
+ - spec/fixtures/semver_exact_pnpm-lock.v7.yaml
464
+ - spec/fixtures/semver_exact_pnpm-lock.v8.yaml
452
465
  - spec/fixtures/semver_exact_yarn.v1.lock
453
466
  - spec/fixtures/semver_exact_yarn.v2.lock
454
467
  - spec/fixtures/semver_tilde_package-lock.v1.json
455
468
  - spec/fixtures/semver_tilde_package-lock.v2.json
456
469
  - spec/fixtures/semver_tilde_package.json
470
+ - spec/fixtures/semver_tilde_pnpm-lock.v7.yaml
471
+ - spec/fixtures/semver_tilde_pnpm-lock.v8.yaml
457
472
  - spec/fixtures/semver_tilde_yarn.v1.lock
458
473
  - spec/fixtures/semver_tilde_yarn.v2.lock
459
474
  - spec/fixtures/without_package-lock.v1.json
460
475
  - spec/fixtures/without_package-lock.v2.json
461
476
  - spec/fixtures/without_package.json
477
+ - spec/fixtures/without_pnpm-lock.v7.yaml
478
+ - spec/fixtures/without_pnpm-lock.v8.yaml
462
479
  - spec/fixtures/without_yarn.v1.lock
463
480
  - spec/fixtures/without_yarn.v2.lock
464
481
  - spec/generator_specs/e2e_template/files/app/controllers/home_controller.rb
@@ -528,7 +545,7 @@ homepage: https://github.com/shakacode/shakapacker
528
545
  licenses:
529
546
  - MIT
530
547
  metadata:
531
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.0.2
548
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.1.0
532
549
  post_install_message:
533
550
  rdoc_options: []
534
551
  require_paths: