react_on_rails 6.0.0.beta.1 → 6.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/react_on_rails/test_helper.rb +1 -2
- data/lib/react_on_rails/test_helper/ensure_assets_compiled.rb +1 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/tasks/assets.rake +44 -53
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcc4a03b77263a8492274ed04f2aea8fedfdd151
|
4
|
+
data.tar.gz: 54179a432dfc85cc1f69387b9e69fc27a96e4058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e74c3ee062e6766b5b9a0db851978dd38fc936ae99387deeb1ad2d93a8f43bdc95c7997e8d85ea277f0f17cd848bb6b611a4d58d50f0e6b6692529ed5b3cc43
|
7
|
+
data.tar.gz: 50fa6532ad2f6df651dfb8fed5d1f5b21dcea3fcb7619c3fe8f6ab24be2de31075165f76748f6a9ea1da8c005974542fa17d392d3e1cbb3abbc050f9b1a03511
|
data/.travis.yml
CHANGED
@@ -64,8 +64,7 @@ module ReactOnRails
|
|
64
64
|
webpack_assets_status_checker ||=
|
65
65
|
WebpackAssetsStatusChecker.new(client_dir: client_dir,
|
66
66
|
generated_assets_dir: generated_assets_dir,
|
67
|
-
webpack_generated_files: webpack_generated_files
|
68
|
-
)
|
67
|
+
webpack_generated_files: webpack_generated_files)
|
69
68
|
|
70
69
|
unless @printed_once
|
71
70
|
puts
|
@@ -35,7 +35,7 @@ module ReactOnRails
|
|
35
35
|
# Inform the developer that we're ensuring gen assets are ready.
|
36
36
|
puts_start_compile_check_message(stale_gen_files)
|
37
37
|
|
38
|
-
webpack_assets_compiler.
|
38
|
+
webpack_assets_compiler.compile_asseta
|
39
39
|
end
|
40
40
|
|
41
41
|
def puts_start_compile_check_message(stale_files)
|
data/lib/tasks/assets.rake
CHANGED
@@ -21,10 +21,9 @@ end
|
|
21
21
|
|
22
22
|
namespace :react_on_rails do
|
23
23
|
namespace :assets do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
task symlink_non_digested_assets: :"assets:environment" do
|
24
|
+
desc "Creates non-digested symlinks for the assets in the public asset dir"
|
25
|
+
task symlink_non_digested_assets: :"assets:environment" do
|
26
|
+
if ReactOnRails.configuration.symlink_non_digested_assets_regex
|
28
27
|
manifest_path = Dir.glob(ReactOnRails::assets_path.join(".sprockets-manifest-*.json"))
|
29
28
|
.first
|
30
29
|
manifest_data = JSON.load(File.new(manifest_path))
|
@@ -42,74 +41,66 @@ namespace :react_on_rails do
|
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
46
|
+
desc "Cleans all broken symlinks for the assets in the public asset dir"
|
47
|
+
task delete_broken_symlinks: :"assets:environment" do
|
48
|
+
Dir.glob(ReactOnRails::assets_path.join("*")).each do |filename|
|
49
|
+
if File.lstat(filename).symlink?
|
50
|
+
begin
|
51
|
+
target = File.readlink(filename)
|
52
|
+
rescue
|
53
|
+
puts "React on Rails: Warning: your platform doesn't support File::readlink method."/
|
54
|
+
"Skipping broken link check."
|
55
|
+
return
|
56
|
+
end
|
57
|
+
path = Pathname.new(File.dirname(filename))
|
58
|
+
target_path = path.join(target)
|
59
|
+
unless File.exist?(target_path)
|
60
|
+
puts "React on Rails: Deleting broken link: #{filename}"
|
61
|
+
File.delete(filename)
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
# Rake::Task["assets:precompile"]
|
71
|
-
# .clear_prerequisites
|
72
|
-
# .enhance(["assets:compile_environment"])
|
73
|
-
|
74
|
-
if ReactOnRails.configuration.npm_build_production_command.present?
|
75
|
-
# In this task, set prerequisites for the assets:precompile task
|
76
|
-
desc <<-DESC
|
67
|
+
# In this task, set prerequisites for the assets:precompile task
|
68
|
+
desc <<-DESC
|
77
69
|
Create webpack assets before calling assets:environment
|
78
70
|
The webpack task must run before assets:environment task.
|
79
71
|
Otherwise Sprockets cannot find the files that webpack produces.
|
80
72
|
This is the secret sauce for how a Heroku deployment knows to create the webpack generated JavaScript files.
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
DESC
|
74
|
+
task compile_environment: :webpack do
|
75
|
+
Rake::Task["assets:environment"].invoke
|
76
|
+
end
|
85
77
|
|
86
|
-
|
78
|
+
desc <<-DESC
|
87
79
|
Compile assets with webpack
|
88
80
|
Uses command defined with ReactOnRails.configuration.npm_build_production_command
|
89
|
-
sh "cd client &&
|
90
|
-
|
91
|
-
|
81
|
+
sh "cd client && `ReactOnRails.configuration.npm_build_production_command`"
|
82
|
+
DESC
|
83
|
+
task webpack: :environment do
|
84
|
+
if ReactOnRails.configuration.npm_build_production_command.present?
|
92
85
|
sh "cd client && #{ReactOnRails.configuration.npm_build_production_command}"
|
93
86
|
end
|
87
|
+
end
|
94
88
|
|
95
|
-
|
96
|
-
|
89
|
+
desc "Delete assets created with webpack, in the generated assetst directory (/app/assets/webpack)"
|
90
|
+
task clobber: :environment do
|
91
|
+
dir = Rails.root.join(ReactOnRails.configuration.generated_assets_dir)
|
92
|
+
if dir.present? && File.directory?(dir)
|
93
|
+
puts "Deleting files in directory #{dir}"
|
97
94
|
rm_r Dir.glob(Rails.root.join("#{ReactOnRails.configuration.generated_assets_dir}/*"))
|
95
|
+
else
|
96
|
+
puts "Could not find dir #{dir}"
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
101
100
|
end
|
102
101
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
if ReactOnRails.configuration.npm_build_production_command.present?
|
111
|
-
Rake::Task["assets:precompile"].enhance do
|
112
|
-
Rake::Task["react_on_rails:assets:compile_environment"].invoke
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
102
|
+
# These tasks run as pre-requisites of assets:precompile.
|
103
|
+
# Note, it's not possible to refer to ReactOnRails configuration values at this point.
|
104
|
+
Rake::Task["assets:precompile"].enhance(["react_on_rails:assets:compile_environment",
|
105
|
+
"react_on_rails:assets:symlink_non_digested_assets",
|
106
|
+
"react_on_rails:assets:delete_broken_symlinks"])
|
data/package.json
CHANGED