vite_rails 1.0.10 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +55 -30
  4. data/lib/tasks/vite.rake +17 -0
  5. data/lib/vite_rails.rb +5 -82
  6. data/lib/vite_rails/config.rb +11 -135
  7. data/lib/vite_rails/engine.rb +7 -11
  8. data/lib/vite_rails/installation.rb +52 -0
  9. data/lib/vite_rails/tag_helpers.rb +61 -0
  10. data/lib/vite_rails/version.rb +2 -2
  11. data/{test/mounted_app/test/dummy/config/vite.json → templates/config/rails-vite.json} +1 -0
  12. data/{lib/install/javascript → templates}/entrypoints/application.js +0 -0
  13. metadata +25 -127
  14. data/lib/install/bin/vite +0 -17
  15. data/lib/install/binstubs.rb +0 -6
  16. data/lib/install/config/vite.config.ts +0 -11
  17. data/lib/install/config/vite.json +0 -14
  18. data/lib/install/template.rb +0 -40
  19. data/lib/tasks/vite/binstubs.rake +0 -12
  20. data/lib/tasks/vite/build.rake +0 -29
  21. data/lib/tasks/vite/clean.rake +0 -23
  22. data/lib/tasks/vite/clobber.rake +0 -20
  23. data/lib/tasks/vite/info.rake +0 -20
  24. data/lib/tasks/vite/install.rake +0 -12
  25. data/lib/tasks/vite/install_dependencies.rake +0 -20
  26. data/lib/tasks/vite/verify_install.rake +0 -23
  27. data/lib/vite_rails/builder.rb +0 -111
  28. data/lib/vite_rails/commands.rb +0 -109
  29. data/lib/vite_rails/dev_server.rb +0 -23
  30. data/lib/vite_rails/dev_server_proxy.rb +0 -57
  31. data/lib/vite_rails/helper.rb +0 -69
  32. data/lib/vite_rails/manifest.rb +0 -140
  33. data/lib/vite_rails/runner.rb +0 -53
  34. data/package.json +0 -16
  35. data/package/default.vite.json +0 -16
  36. data/test/builder_test.rb +0 -77
  37. data/test/commands_test.rb +0 -67
  38. data/test/config_test.rb +0 -133
  39. data/test/dev_server_proxy_test.rb +0 -101
  40. data/test/dev_server_test.rb +0 -9
  41. data/test/engine_rake_tasks_test.rb +0 -80
  42. data/test/helper_test.rb +0 -70
  43. data/test/manifest_test.rb +0 -79
  44. data/test/mode_test.rb +0 -16
  45. data/test/mounted_app/Rakefile +0 -6
  46. data/test/mounted_app/test/dummy/Rakefile +0 -5
  47. data/test/mounted_app/test/dummy/bin/rails +0 -5
  48. data/test/mounted_app/test/dummy/bin/rake +0 -5
  49. data/test/mounted_app/test/dummy/config.ru +0 -7
  50. data/test/mounted_app/test/dummy/config/application.rb +0 -12
  51. data/test/mounted_app/test/dummy/config/environment.rb +0 -5
  52. data/test/mounted_app/test/dummy/package.json +0 -8
  53. data/test/mounted_app/test/dummy/yarn.lock +0 -208
  54. data/test/rake_tasks_test.rb +0 -60
  55. data/test/runner_test.rb +0 -31
  56. data/test/test_app/Rakefile +0 -5
  57. data/test/test_app/app/frontend/entrypoints/application.js +0 -2
  58. data/test/test_app/bin/vite +0 -17
  59. data/test/test_app/config.ru +0 -7
  60. data/test/test_app/config/application.rb +0 -13
  61. data/test/test_app/config/environment.rb +0 -6
  62. data/test/test_app/config/vite.json +0 -18
  63. data/test/test_app/config/vite_additional_paths.json +0 -5
  64. data/test/test_app/config/vite_public_dir.json +0 -5
  65. data/test/test_app/package.json +0 -13
  66. data/test/test_app/public/vite-production/manifest.json +0 -22
  67. data/test/test_app/some.config.js +0 -0
  68. data/test/test_app/yarn.lock +0 -11
  69. data/test/test_helper.rb +0 -68
@@ -1,18 +0,0 @@
1
- {
2
- "development": {
3
- "autoBuild": true,
4
- "port": "3535",
5
- "https": true,
6
- "publicOutputDir": "vite-development"
7
- },
8
- "test": {
9
- "autoBuild": true,
10
- "publicOutputDir": "vite-test"
11
- },
12
- "production": {
13
- "publicOutputDir": "vite-production"
14
- },
15
- "staging": {
16
- "publicOutputDir": "vite-staging"
17
- }
18
- }
@@ -1,5 +0,0 @@
1
- {
2
- "all": {
3
- "watchAdditionalPaths": ["config/*"]
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "all": {
3
- "publicDir": "../public"
4
- }
5
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "test_app",
3
- "version": "1.0.0",
4
- "main": "index.js",
5
- "license": "MIT",
6
- "private": true,
7
- "dependencies": {
8
- "left-pad": "^1.2.0"
9
- },
10
- "devDependencies": {
11
- "right-pad": "^1.0.1"
12
- }
13
- }
@@ -1,22 +0,0 @@
1
- {
2
- "application.js": {
3
- "file": "assets/application.a0ba047e.js",
4
- "imports": [
5
- "assets/example_import.8e1fddc0.js"
6
- ]
7
- },
8
- "example_import.js": {
9
- "file": "assets/example_import.8e1fddc0.js",
10
- "imports": []
11
- },
12
- "colored.js": {
13
- "file": "assets/colored.1173bfe0.js",
14
- "imports": []
15
- },
16
- "application.css": {
17
- "file": "assets/application.cccfef34.css"
18
- },
19
- "colored.css": {
20
- "file": "assets/colored.84277fd6.css"
21
- }
22
- }
File without changes
@@ -1,11 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-
5
- left-pad@^1.2.0:
6
- version "1.2.0"
7
- resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
8
-
9
- right-pad@^1.0.1:
10
- version "1.0.1"
11
- resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0"
data/test/test_helper.rb DELETED
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'simplecov'
4
- SimpleCov.start {
5
- add_filter '/test/'
6
- }
7
-
8
- require 'minitest/autorun'
9
- require 'rails'
10
- require 'rails/test_help'
11
- require 'pry-byebug'
12
-
13
- require_relative 'test_app/config/environment'
14
-
15
- Rails.env = 'production'
16
-
17
- ViteRails.instance = ViteRails.new
18
-
19
- module ViteRailsTestHelpers
20
- def refresh_config(env_variables = ViteRails.load_env_variables)
21
- ViteRails.env = env_variables
22
- (ViteRails.instance = ViteRails.new).config
23
- end
24
-
25
- def with_rails_env(env)
26
- original = Rails.env
27
- Rails.env = ActiveSupport::StringInquirer.new(env)
28
- yield(refresh_config)
29
- ensure
30
- Rails.env = ActiveSupport::StringInquirer.new(original)
31
- refresh_config
32
- end
33
-
34
- def test_app_path
35
- File.expand_path('test_app', __dir__)
36
- end
37
-
38
- def with_dev_server_running(&block)
39
- ViteRails.instance.stub(:dev_server_running?, true, &block)
40
- end
41
- end
42
-
43
- class ViteRails::Test < Minitest::Test
44
- include ViteRailsTestHelpers
45
-
46
- private
47
-
48
- def assert_run_command(*argv, use_yarn: false, flags: [])
49
- command = use_yarn ? %w[yarn vite] : ["#{ test_app_path }/node_modules/.bin/vite"]
50
- cwd = Dir.pwd
51
- Dir.chdir(test_app_path)
52
-
53
- klass = ViteRails::Runner
54
- instance = klass.new(argv)
55
- mock = Minitest::Mock.new
56
- mock.expect(:call, nil, [ViteRails.env, *command, *argv, *flags])
57
-
58
- klass.stub(:new, instance) do
59
- instance.stub(:executable_exists?, !use_yarn) do
60
- Kernel.stub(:exec, mock) { ViteRails.run(argv) }
61
- end
62
- end
63
-
64
- mock.verify
65
- ensure
66
- Dir.chdir(cwd)
67
- end
68
- end