mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
lint
This commit is contained in:
@@ -14,8 +14,10 @@ import click
|
||||
def cli(styles_folder):
|
||||
"""
|
||||
Lints all style JSON files in a folder
|
||||
First runs prettier with recursive JSON sorting
|
||||
Then runs gl-style-format
|
||||
1. runs gl-style-migrate
|
||||
2. runs prettier with recursive JSON sorting
|
||||
3. gl-style-format
|
||||
4. gl-style-validate
|
||||
"""
|
||||
|
||||
p = subprocess.run(['pnpm', 'bin'], capture_output=True, text=True)
|
||||
@@ -33,22 +35,34 @@ def cli(styles_folder):
|
||||
|
||||
print(f'formatting {style_file}')
|
||||
|
||||
# gl-style-migrate
|
||||
p = subprocess.run(
|
||||
[node_bin_path / 'gl-style-migrate', style_file], capture_output=True, text=True
|
||||
)
|
||||
with open(style_file, 'w') as fp:
|
||||
fp.write(p.stdout)
|
||||
|
||||
# prettier
|
||||
subprocess.run(
|
||||
[node_bin_path / 'prettier', '--config', prettier_config_path, '--write', style_file],
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
# gl-style-format
|
||||
p = subprocess.run(
|
||||
[
|
||||
node_bin_path / 'gl-style-format',
|
||||
style_file,
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
[node_bin_path / 'gl-style-format', style_file], capture_output=True, text=True
|
||||
)
|
||||
with open(style_file, 'w') as fp:
|
||||
fp.write(p.stdout)
|
||||
|
||||
# gl-style-validate
|
||||
subprocess.run(
|
||||
[
|
||||
node_bin_path / 'gl-style-validate',
|
||||
style_file,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli()
|
||||
|
||||
Reference in New Issue
Block a user