7-package.json: update version field
This commit is contained in:
@@ -21,8 +21,11 @@ module Release
|
||||
|
||||
validate_version_is_new version
|
||||
|
||||
update_package_json version
|
||||
|
||||
git_local_tag release_tag_from_version(version)
|
||||
|
||||
git_push current_branch
|
||||
git_push_tags
|
||||
|
||||
end
|
||||
|
||||
@@ -18,10 +18,11 @@ module Release
|
||||
|
||||
git_pull release_branch
|
||||
|
||||
update_package_json version_from_release_branch(release_branch)
|
||||
|
||||
git_local_tag release_tag_from_version(version_from_release_branch(release_branch))
|
||||
|
||||
git_push release_branch
|
||||
|
||||
git_push_tags
|
||||
|
||||
git_checkout "master"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require 'json'
|
||||
|
||||
module Shared
|
||||
|
||||
module Runnable
|
||||
@@ -19,6 +21,25 @@ module Shared
|
||||
exit
|
||||
end
|
||||
|
||||
def update_package_json (version)
|
||||
if File.exist? 'package.json'
|
||||
package_json = File.read('package.json')
|
||||
json = JSON.parse(package_json)
|
||||
json['version'] = version
|
||||
File.write('package.json', JSON.pretty_generate(json))
|
||||
git_add 'package.json'
|
||||
git_commit version
|
||||
end
|
||||
end
|
||||
|
||||
def git_add (path)
|
||||
run_cmd "git add #{path}"
|
||||
end
|
||||
|
||||
def git_commit (msg)
|
||||
run_cmd "git commit -m '#{msg}'"
|
||||
end
|
||||
|
||||
def git_show_branches
|
||||
run_cmd "git branch"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user