-
Notifications
You must be signed in to change notification settings - Fork 2
/
shipit
executable file
·44 lines (39 loc) · 1.01 KB
/
shipit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env perl
use v5.14;
use warnings;
use Path::Class;
my ($ma, $mi, $ri) = file('package.json')->slurp =~ m/"version": "(\d+)\.(\d+)\.(\d+)"/;
say "Current version: $ma.$mi.$ri";
$ri++;
print "Next version [$ma.$mi.$ri]: ";
my $VERSION = (<> =~ s/\s+//rg) || "$ma.$mi.$ri";
for ('package.json') {
my $new = file($_)->slurp =~ s/"version": ".+?"/"version": "$VERSION"/r;
my $fh = file($_)->open('w');
print $fh $new;
close $fh;
}
for ('LICENSE') {
my $new = file($_)->slurp =~ s/(\@version\s+).+/$1$VERSION/r;
my $fh = file($_)->open('w');
print $fh $new;
close $fh;
}
for ('lib/tass.js') {
my $new = file($_)->slurp =~ s/(TASS\.version\s*=\s*)".+?"/$1"$VERSION"/r;
my $fh = file($_)->open('w');
print $fh $new;
close $fh;
}
print "Realy want to publish [$VERSION] to npm? [yN]: ";
if (<> =~ /y/i) {
say "Publishing...";
system('npm publish');
system("git add -u");
system("git commit -m '$VERSION'");
system("git tag $VERSION");
system("git push --tags");
system("git push");
} else {
say "Canceled";
}