Skip to content

Commit da7c49b

Browse files
committed
Retry ruby code format
1 parent 1f297b9 commit da7c49b

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

codegen/lib/format-code.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { SyntaxName } from '@seamapi/blueprint'
66
import commandExists from 'command-exists'
77
import { execa } from 'execa'
88
import { format as prettier } from 'prettier'
9+
import { retry } from '@harisk/retryx'
910

1011
export const formatCode = async (
1112
content: string,
@@ -66,13 +67,14 @@ const formatRuby = async (content: string): Promise<string> => {
6667
)
6768
return content
6869
}
69-
env['PRETTIER_RUBY_TIMEOUT_MS'] = String(20_000)
70-
return await prettier(content, {
71-
parser: 'ruby',
72-
plugins: [prettierPluginRuby.default],
73-
printWidth: 100,
74-
trailingComma: 'all',
75-
})
70+
return await retry(async () =>
71+
await prettier(content, {
72+
parser: 'ruby',
73+
plugins: [prettierPluginRuby.default],
74+
printWidth: 100,
75+
trailingComma: 'all',
76+
}),
77+
)
7678
}
7779

7880
const formatGo = async (content: string): Promise<string> => {

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"npm": ">=10.9.0"
2828
},
2929
"devDependencies": {
30+
"@harisk/retryx": "^1.0.2",
3031
"@metalsmith/metadata": "^0.3.0",
3132
"@prettier/plugin-php": "^0.23.0",
3233
"@prettier/plugin-ruby": "^4.0.4",

0 commit comments

Comments
 (0)