foobara-typescript-remote-command-generator 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/src/write_typescript_to_disk.rb +39 -17
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f9ab7173395e0395aa68ec70af02241d434cfad4feca91d1930ca5749d3152f
|
|
4
|
+
data.tar.gz: 6d68586d307d903105f34d9b66561d4b6fd43d7cff64dc924f05ae2a18ac5a9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c2e9edbaf0b1e3bfe520b1e2909d26d007861a666f84847f3e952a5ac3c5d478fb4cf2a4057d4651c4ffe28c4a932ebdb5fce9ae92722c541b794aed810a8c0
|
|
7
|
+
data.tar.gz: 621c4e4dc3509853fa2c874c016e344373ebe2049442b72dc4bb7a925fd68ba39742b97cb00b6a343aaec2a6570b713269aa029d4becd6d2ca01672181c00264
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "pathname"
|
|
1
2
|
require_relative "generate_typescript"
|
|
2
3
|
|
|
3
4
|
module Foobara
|
|
@@ -64,28 +65,49 @@ module Foobara
|
|
|
64
65
|
|
|
65
66
|
def run_post_generation_tasks
|
|
66
67
|
Dir.chdir(project_directory || output_directory) do
|
|
67
|
-
eslint_fix
|
|
68
|
+
eslint_fix if eslint_config_present?
|
|
69
|
+
oxlint_fix if oxlint_config_present?
|
|
70
|
+
prettier_write if prettier_config_present?
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
|
|
74
|
+
def output_directory_relative_to_project
|
|
75
|
+
return @output_directory_relative_to_project if defined?(@output_directory_relative_to_project)
|
|
76
|
+
|
|
77
|
+
project_path = Pathname.new(File.expand_path(project_directory || output_directory))
|
|
78
|
+
pathname = Pathname.new(File.expand_path(output_directory))
|
|
79
|
+
|
|
80
|
+
@output_directory_relative_to_project = pathname.relative_path_from(project_path).to_s
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def eslint_config_present? = any_files_present?("eslint.config.*", ".eslintrc", ".eslintrc.*")
|
|
84
|
+
def oxlint_config_present? = any_files_present?(".oxlintrc.json", "oxlint.config.*")
|
|
85
|
+
def prettier_config_present? = any_files_present?("prettier.config.*", ".prettierrc", ".prettierrc.*")
|
|
86
|
+
def any_files_present?(*globs) = !Dir.glob(globs).empty?
|
|
87
|
+
|
|
71
88
|
def eslint_fix
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
run_lint_cmd("npx eslint '#{output_directory_relative_to_project}/**/*.{js,jsx,ts,tsx}' --fix")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def oxlint_fix
|
|
93
|
+
run_lint_cmd("npx oxlint --fix '#{output_directory_relative_to_project}'")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def prettier_write
|
|
97
|
+
run_lint_cmd("npx prettier --write '#{output_directory_relative_to_project}/**/*.{js,jsx,ts,tsx}'")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def run_lint_cmd(cmd)
|
|
101
|
+
out, err, exit_status = Open3.capture3(cmd)
|
|
102
|
+
|
|
103
|
+
unless exit_status.success?
|
|
104
|
+
# simplecov:disable
|
|
105
|
+
if fail_if_does_not_pass_linter?
|
|
106
|
+
add_runtime_error :failed_to_lint, stdout: out, stderr: err
|
|
107
|
+
else
|
|
108
|
+
warn "WARNING: could not #{cmd}\n#{out}\n#{err}"
|
|
88
109
|
end
|
|
110
|
+
# simplecov:enable
|
|
89
111
|
end
|
|
90
112
|
end
|
|
91
113
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foobara-typescript-remote-command-generator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -33,6 +33,9 @@ dependencies:
|
|
|
33
33
|
name: foobara-files-generator
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
35
35
|
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: 0.2.3
|
|
36
39
|
- - "<"
|
|
37
40
|
- !ruby/object:Gem::Version
|
|
38
41
|
version: 2.0.0
|
|
@@ -40,6 +43,9 @@ dependencies:
|
|
|
40
43
|
prerelease: false
|
|
41
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
42
45
|
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: 0.2.3
|
|
43
49
|
- - "<"
|
|
44
50
|
- !ruby/object:Gem::Version
|
|
45
51
|
version: 2.0.0
|
|
@@ -162,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
162
168
|
- !ruby/object:Gem::Version
|
|
163
169
|
version: '0'
|
|
164
170
|
requirements: []
|
|
165
|
-
rubygems_version: 4.0.
|
|
171
|
+
rubygems_version: 4.0.20
|
|
166
172
|
specification_version: 4
|
|
167
173
|
summary: Generates remote commands for Typescript from a foobara manifest
|
|
168
174
|
test_files: []
|