Skip to content

Commit

Permalink
bin/release: drop needless copyright year updates and src commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Jul 15, 2024
1 parent f7793b6 commit eca01a1
Showing 1 changed file with 3 additions and 37 deletions.
40 changes: 3 additions & 37 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class Release
check_npm

build
update_copyright_year
commit_changes
push_git_tag
create_release
npm_publish
end
Expand All @@ -39,37 +38,8 @@ class Release
system("yarn install && yarn build") || abort("Build failed")
end

def update_copyright_year
puts "Updating copyright year…"

%w( LICENSE README.md ).each do |filename|
pathname = Pathname.new(filename)
contents = pathname.read
year = Time.now.year

(year - 1).downto(year - 3) do |previous_year|
pattern = / #{previous_year} /
if contents =~ pattern
pathname.write(contents.gsub!(pattern, " #{year} "))
break
end
end
end
end

def commit_changes
puts `git status #{pathspecs.join(' ')}`

if confirm "Commit changes?"
abort("Failed to commit") unless \
system("git add #{pathspecs.join(' ')}") &&
system("git commit -m '#{NAME} #{version}'") &&
system("git push") &&
system("git tag #{version}") &&
system("git push --tags")
else
abort
end
def push_git_tag
system("git tag #{version}") && system("git push --tags")
end

def create_release
Expand All @@ -82,10 +52,6 @@ class Release
end
end

def pathspecs
%w( src/ package.json LICENSE README.md )
end

def dist_pathnames
Pathname.new("dist").children
end
Expand Down

0 comments on commit eca01a1

Please sign in to comment.