Skip to content

Commit 9234ff3

Browse files
committed
update release script
1 parent e4a7fa5 commit 9234ff3

File tree

5 files changed

+560
-1524
lines changed

5 files changed

+560
-1524
lines changed

rakelib/create_release.rake

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ task :create_release, %i[gem_version dry_run] do |_t, args|
3737
puts 'Updating ujs:update'
3838
Rake::Task['ujs:update'].invoke
3939

40-
release_the_new_npm_version(npm_version, is_dry_run)
41-
release_the_new_gem_version(gem_version, is_dry_run)
40+
Release.commit_the_changes unless is_dry_run
41+
42+
Release.release_the_new_npm_version(npm_version, is_dry_run)
43+
Release.release_the_new_gem_version(gem_version, is_dry_run)
4244

4345
Release.push
4446
end
@@ -56,6 +58,10 @@ module Release
5658
shell_commands.flatten.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) }
5759
end
5860

61+
def commit_the_changes
62+
sh_in_dir(gem_root, 'git commit -am "Update pre-bundled react and React ujs"')
63+
end
64+
5965
def ensure_there_is_nothing_to_commit
6066
status = `git status --porcelain`
6167

@@ -84,6 +90,10 @@ module Release
8490
puts 'Pulling latest commits from remote repository'
8591

8692
sh_in_dir(gem_root, 'git pull --rebase')
93+
sh_in_dir(gem_root, 'bundle')
94+
sh_in_dir(gem_root, 'yarn')
95+
sh_in_dir(File.join(gem_root, 'react-builds'), 'yarn')
96+
8797
raise 'Failed in pulling latest changes from default remore repository.' unless $CHILD_STATUS.success?
8898
rescue Errno::ENOENT
8999
raise 'Ensure you have Git and Bundler installed before continuing.'
@@ -114,8 +124,7 @@ module Release
114124
puts 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
115125
puts 'Use the OTP for NPM!'
116126
puts 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
117-
118-
system(release_it_command)
127+
sh_in_dir(release_it_command)
119128
end
120129

121130
def push

react-builds/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"webpack": "^5.74.0"
1414
},
1515
"scripts": {
16-
"build": "webpack && NODE_ENV=production webpack -p"
16+
"build": "NODE_ENV=development webpack && NODE_ENV=production webpack"
1717
}
1818
}

react-builds/webpack.config.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
// Use `rake react:update` to build this bundle & copy files into the gem.
2-
var webpack = require("webpack");
3-
4-
var reactRailsEnv = process.env.NODE_ENV == "production" ? "production" : "development";
5-
6-
var plugins = [];
7-
8-
if (reactRailsEnv == "production") {
9-
var definePlugin = new webpack.DefinePlugin({'process.env.NODE_ENV': '"production"'});
10-
var minifyPlugin = new webpack.optimize.UglifyJsPlugin({
11-
compress: {
12-
warnings: false
13-
}
14-
});
15-
plugins.push(definePlugin);
16-
plugins.push(minifyPlugin);
17-
}
18-
2+
// Be sure to set NODE_ENV=production or NODE_ENV=development before running
193

204
module.exports = {
215
context: __dirname,
@@ -24,8 +8,7 @@ module.exports = {
248
"react-server": "./react-server.js",
259
},
2610
output: {
27-
path: __dirname + "/build/" + reactRailsEnv,
11+
path: __dirname + "/build/" + process.env.NODE_ENV,
2812
filename: "[name].js",
2913
},
30-
plugins: plugins,
3114
};

0 commit comments

Comments
 (0)