|
Lines 22-39
use FindBin();
Link Here
|
| 22 |
use Data::Dumper qw( Dumper ); |
22 |
use Data::Dumper qw( Dumper ); |
| 23 |
use Test::More tests => 2; |
23 |
use Test::More tests => 2; |
| 24 |
|
24 |
|
| 25 |
my $vue_dir = "$FindBin::Bin/../koha-tmpl/intranet-tmpl/prog/js/vue"; |
25 |
my @vue_files; |
|
|
26 |
push @vue_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`; |
| 27 |
my @js_files; |
| 28 |
push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.js'`; |
| 29 |
push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.ts'`; |
| 30 |
push @js_files, `git ls-files 't/cypress/integration/*.ts'`; |
| 26 |
|
31 |
|
| 27 |
my @files; |
|
|
| 28 |
sub wanted_vue { |
| 29 |
my $name = $File::Find::name; |
| 30 |
push @files, $name |
| 31 |
if $name =~ /\.vue$/; |
| 32 |
} |
| 33 |
find({ wanted => \&wanted_vue, no_chdir => 1 }, $vue_dir); |
| 34 |
|
32 |
|
| 35 |
my @not_tidy; |
33 |
my @not_tidy; |
| 36 |
foreach my $filepath (@files) { |
34 |
foreach my $filepath (@vue_files) { |
| 37 |
chomp $filepath; |
35 |
chomp $filepath; |
| 38 |
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --semi false --arrow-parens avoid $filepath}; |
36 |
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --semi false --arrow-parens avoid $filepath}; |
| 39 |
my $content = read_file $filepath; |
37 |
my $content = read_file $filepath; |
|
Lines 44-61
foreach my $filepath (@files) {
Link Here
|
| 44 |
|
42 |
|
| 45 |
is(scalar(@not_tidy), 0, 'No .vue file should be messy') or diag Dumper \@not_tidy; |
43 |
is(scalar(@not_tidy), 0, 'No .vue file should be messy') or diag Dumper \@not_tidy; |
| 46 |
|
44 |
|
| 47 |
@files = (); |
|
|
| 48 |
sub wanted_js_ts { |
| 49 |
my $name = $File::Find::name; |
| 50 |
push @files, $name |
| 51 |
if ( $name =~ /\.js$/ |
| 52 |
|| $name =~ /\.ts$/ ) |
| 53 |
&& $name !~ m{koha-tmpl/intranet-tmpl/prog/js/vue/dist}; # Exclude dist |
| 54 |
} |
| 55 |
find({ wanted => \&wanted_js_ts, no_chdir => 1 }, $vue_dir); |
| 56 |
|
| 57 |
@not_tidy = (); |
45 |
@not_tidy = (); |
| 58 |
foreach my $filepath (@files) { |
46 |
foreach my $filepath (@js_files) { |
| 59 |
chomp $filepath; |
47 |
chomp $filepath; |
| 60 |
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; |
48 |
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; |
| 61 |
my $content = read_file $filepath; |
49 |
my $content = read_file $filepath; |
| 62 |
- |
|
|