shakapacker 7.0.3 → 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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dummy.yml +3 -1
  3. data/.github/workflows/generator.yml +3 -1
  4. data/.github/workflows/jest.yml +4 -2
  5. data/.github/workflows/js-lint.yml +4 -2
  6. data/.github/workflows/rubocop.yml +3 -1
  7. data/.github/workflows/ruby-backward-compatibility.yml +3 -1
  8. data/.github/workflows/ruby.yml +4 -2
  9. data/CHANGELOG.md +7 -0
  10. data/README.md +29 -20
  11. data/docs/troubleshooting.md +4 -8
  12. data/docs/using_esbuild_loader.md +2 -4
  13. data/lib/install/template.rb +2 -2
  14. data/lib/shakapacker/deprecation_helper.rb +1 -1
  15. data/lib/shakapacker/dev_server_runner.rb +2 -1
  16. data/lib/shakapacker/version.rb +1 -1
  17. data/lib/shakapacker/version_checker.rb +35 -2
  18. data/lib/shakapacker/webpack_runner.rb +4 -3
  19. data/package/__tests__/index.js +24 -0
  20. data/package/index.d.ts +1 -1
  21. data/package/index.js +8 -2
  22. data/package.json +1 -1
  23. data/spec/backward_compatibility_specs/compiler_strategy_spec.rb +5 -3
  24. data/spec/backward_compatibility_specs/configuration_spec.rb +12 -4
  25. data/spec/backward_compatibility_specs/dev_server_runner_spec.rb +17 -16
  26. data/spec/backward_compatibility_specs/dev_server_spec.rb +1 -1
  27. data/spec/backward_compatibility_specs/digest_strategy_spec.rb +2 -0
  28. data/spec/backward_compatibility_specs/engine_rake_tasks_spec.rb +2 -1
  29. data/spec/backward_compatibility_specs/helper_spec.rb +20 -20
  30. data/spec/backward_compatibility_specs/instance_spec.rb +3 -3
  31. data/spec/backward_compatibility_specs/manifest_spec.rb +12 -12
  32. data/spec/backward_compatibility_specs/mtime_strategy_spec.rb +3 -3
  33. data/spec/backward_compatibility_specs/rake_tasks_spec.rb +9 -5
  34. data/spec/backward_compatibility_specs/webpack_runner_spec.rb +14 -18
  35. data/spec/dummy/config/webpack/commonWebpackConfig.js +1 -1
  36. data/spec/fixtures/beta_pnpm-lock.v7.yaml +116 -0
  37. data/spec/fixtures/beta_pnpm-lock.v8.yaml +2537 -0
  38. data/spec/fixtures/git_url_pnpm-lock.v7.yaml +126 -0
  39. data/spec/fixtures/git_url_pnpm-lock.v8.yaml +3728 -0
  40. data/spec/fixtures/github_url_pnpm-lock.v7.yaml +126 -0
  41. data/spec/fixtures/github_url_pnpm-lock.v8.yaml +3728 -0
  42. data/spec/fixtures/relative_path_pnpm-lock.v7.yaml +18 -0
  43. data/spec/fixtures/relative_path_pnpm-lock.v8.yaml +22 -0
  44. data/spec/fixtures/semver_caret_pnpm-lock.v7.yaml +117 -0
  45. data/spec/fixtures/semver_caret_pnpm-lock.v8.yaml +2558 -0
  46. data/spec/fixtures/semver_exact_pnpm-lock.v7.yaml +117 -0
  47. data/spec/fixtures/semver_exact_pnpm-lock.v8.yaml +2558 -0
  48. data/spec/fixtures/semver_tilde_pnpm-lock.v7.yaml +116 -0
  49. data/spec/fixtures/semver_tilde_pnpm-lock.v8.yaml +2558 -0
  50. data/spec/fixtures/without_pnpm-lock.v7.yaml +23 -0
  51. data/spec/fixtures/without_pnpm-lock.v8.yaml +27 -0
  52. data/spec/generator_specs/generator_spec.rb +7 -3
  53. data/spec/shakapacker/compiler_strategy_spec.rb +5 -3
  54. data/spec/shakapacker/configuration_spec.rb +12 -2
  55. data/spec/shakapacker/dev_server_runner_spec.rb +22 -16
  56. data/spec/shakapacker/dev_server_spec.rb +1 -1
  57. data/spec/shakapacker/digest_strategy_spec.rb +2 -0
  58. data/spec/shakapacker/engine_rake_tasks_spec.rb +2 -1
  59. data/spec/shakapacker/helper_spec.rb +20 -20
  60. data/spec/shakapacker/instance_spec.rb +2 -2
  61. data/spec/shakapacker/manifest_spec.rb +12 -12
  62. data/spec/shakapacker/mtime_strategy_spec.rb +3 -3
  63. data/spec/shakapacker/rake_tasks_spec.rb +5 -2
  64. data/spec/shakapacker/shakapacker_spec.rb +4 -4
  65. data/spec/shakapacker/version_checker_spec.rb +468 -121
  66. data/spec/shakapacker/webpack_runner_spec.rb +14 -18
  67. metadata +19 -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.3
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-08-13 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
@@ -425,41 +425,57 @@ files:
425
425
  - spec/fixtures/beta_package-lock.v1.json
426
426
  - spec/fixtures/beta_package-lock.v2.json
427
427
  - spec/fixtures/beta_package.json
428
+ - spec/fixtures/beta_pnpm-lock.v7.yaml
429
+ - spec/fixtures/beta_pnpm-lock.v8.yaml
428
430
  - spec/fixtures/beta_yarn.v1.lock
429
431
  - spec/fixtures/beta_yarn.v2.lock
430
432
  - spec/fixtures/git_url_package-lock.v1.json
431
433
  - spec/fixtures/git_url_package-lock.v2.json
432
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
433
437
  - spec/fixtures/git_url_yarn.v1.lock
434
438
  - spec/fixtures/git_url_yarn.v2.lock
435
439
  - spec/fixtures/github_url_package-lock.v1.json
436
440
  - spec/fixtures/github_url_package-lock.v2.json
437
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
438
444
  - spec/fixtures/github_url_yarn.v1.lock
439
445
  - spec/fixtures/github_url_yarn.v2.lock
440
446
  - spec/fixtures/relative_path_package-lock.v1.json
441
447
  - spec/fixtures/relative_path_package-lock.v2.json
442
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
443
451
  - spec/fixtures/relative_path_yarn.v1.lock
444
452
  - spec/fixtures/relative_path_yarn.v2.lock
445
453
  - spec/fixtures/semver_caret_package-lock.v1.json
446
454
  - spec/fixtures/semver_caret_package-lock.v2.json
447
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
448
458
  - spec/fixtures/semver_caret_yarn.v1.lock
449
459
  - spec/fixtures/semver_caret_yarn.v2.lock
450
460
  - spec/fixtures/semver_exact_package-lock.v1.json
451
461
  - spec/fixtures/semver_exact_package-lock.v2.json
452
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
453
465
  - spec/fixtures/semver_exact_yarn.v1.lock
454
466
  - spec/fixtures/semver_exact_yarn.v2.lock
455
467
  - spec/fixtures/semver_tilde_package-lock.v1.json
456
468
  - spec/fixtures/semver_tilde_package-lock.v2.json
457
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
458
472
  - spec/fixtures/semver_tilde_yarn.v1.lock
459
473
  - spec/fixtures/semver_tilde_yarn.v2.lock
460
474
  - spec/fixtures/without_package-lock.v1.json
461
475
  - spec/fixtures/without_package-lock.v2.json
462
476
  - spec/fixtures/without_package.json
477
+ - spec/fixtures/without_pnpm-lock.v7.yaml
478
+ - spec/fixtures/without_pnpm-lock.v8.yaml
463
479
  - spec/fixtures/without_yarn.v1.lock
464
480
  - spec/fixtures/without_yarn.v2.lock
465
481
  - spec/generator_specs/e2e_template/files/app/controllers/home_controller.rb
@@ -529,7 +545,7 @@ homepage: https://github.com/shakacode/shakapacker
529
545
  licenses:
530
546
  - MIT
531
547
  metadata:
532
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.0.3
548
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.1.0
533
549
  post_install_message:
534
550
  rdoc_options: []
535
551
  require_paths: