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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +55 -30
- data/lib/tasks/vite.rake +17 -0
- data/lib/vite_rails.rb +5 -82
- data/lib/vite_rails/config.rb +11 -135
- data/lib/vite_rails/engine.rb +7 -11
- data/lib/vite_rails/installation.rb +52 -0
- data/lib/vite_rails/tag_helpers.rb +61 -0
- data/lib/vite_rails/version.rb +2 -2
- data/{test/mounted_app/test/dummy/config/vite.json → templates/config/rails-vite.json} +1 -0
- data/{lib/install/javascript → templates}/entrypoints/application.js +0 -0
- metadata +25 -127
- data/lib/install/bin/vite +0 -17
- data/lib/install/binstubs.rb +0 -6
- data/lib/install/config/vite.config.ts +0 -11
- data/lib/install/config/vite.json +0 -14
- data/lib/install/template.rb +0 -40
- data/lib/tasks/vite/binstubs.rake +0 -12
- data/lib/tasks/vite/build.rake +0 -29
- data/lib/tasks/vite/clean.rake +0 -23
- data/lib/tasks/vite/clobber.rake +0 -20
- data/lib/tasks/vite/info.rake +0 -20
- data/lib/tasks/vite/install.rake +0 -12
- data/lib/tasks/vite/install_dependencies.rake +0 -20
- data/lib/tasks/vite/verify_install.rake +0 -23
- data/lib/vite_rails/builder.rb +0 -111
- data/lib/vite_rails/commands.rb +0 -109
- data/lib/vite_rails/dev_server.rb +0 -23
- data/lib/vite_rails/dev_server_proxy.rb +0 -57
- data/lib/vite_rails/helper.rb +0 -69
- data/lib/vite_rails/manifest.rb +0 -140
- data/lib/vite_rails/runner.rb +0 -53
- data/package.json +0 -16
- data/package/default.vite.json +0 -16
- data/test/builder_test.rb +0 -77
- data/test/commands_test.rb +0 -67
- data/test/config_test.rb +0 -133
- data/test/dev_server_proxy_test.rb +0 -101
- data/test/dev_server_test.rb +0 -9
- data/test/engine_rake_tasks_test.rb +0 -80
- data/test/helper_test.rb +0 -70
- data/test/manifest_test.rb +0 -79
- data/test/mode_test.rb +0 -16
- data/test/mounted_app/Rakefile +0 -6
- data/test/mounted_app/test/dummy/Rakefile +0 -5
- data/test/mounted_app/test/dummy/bin/rails +0 -5
- data/test/mounted_app/test/dummy/bin/rake +0 -5
- data/test/mounted_app/test/dummy/config.ru +0 -7
- data/test/mounted_app/test/dummy/config/application.rb +0 -12
- data/test/mounted_app/test/dummy/config/environment.rb +0 -5
- data/test/mounted_app/test/dummy/package.json +0 -8
- data/test/mounted_app/test/dummy/yarn.lock +0 -208
- data/test/rake_tasks_test.rb +0 -60
- data/test/runner_test.rb +0 -31
- data/test/test_app/Rakefile +0 -5
- data/test/test_app/app/frontend/entrypoints/application.js +0 -2
- data/test/test_app/bin/vite +0 -17
- data/test/test_app/config.ru +0 -7
- data/test/test_app/config/application.rb +0 -13
- data/test/test_app/config/environment.rb +0 -6
- data/test/test_app/config/vite.json +0 -18
- data/test/test_app/config/vite_additional_paths.json +0 -5
- data/test/test_app/config/vite_public_dir.json +0 -5
- data/test/test_app/package.json +0 -13
- data/test/test_app/public/vite-production/manifest.json +0 -22
- data/test/test_app/some.config.js +0 -0
- data/test/test_app/yarn.lock +0 -11
- 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
|
-
}
|
data/test/test_app/package.json
DELETED
@@ -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
|
data/test/test_app/yarn.lock
DELETED
@@ -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
|