mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
work
This commit is contained in:
@@ -1,10 +0,0 @@
|
|||||||
const config = {
|
|
||||||
printWidth: 100,
|
|
||||||
semi: false,
|
|
||||||
singleQuote: true,
|
|
||||||
arrowParens: 'avoid',
|
|
||||||
plugins: ['prettier-plugin-sort-json'],
|
|
||||||
jsonRecursiveSort: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = config
|
|
||||||
3
lint.sh
3
lint.sh
@@ -6,6 +6,3 @@ ruff format .
|
|||||||
find . -type f -name '*.conf' -path '*/nginx*' -exec nginxfmt -v {} +;
|
find . -type f -name '*.conf' -path '*/nginx*' -exec nginxfmt -v {} +;
|
||||||
|
|
||||||
|
|
||||||
if [ -d "../styles" ]; then
|
|
||||||
scripts/styles/lint_styles/lint_styles.py ../styles/
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"@maplibre/maplibre-gl-style-spec": "^19.3.3",
|
|
||||||
"prettier": "^3.1.1",
|
|
||||||
"prettier-plugin-sort-json": "^3.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
192
pnpm-lock.yaml
generated
192
pnpm-lock.yaml
generated
@@ -1,192 +0,0 @@
|
|||||||
lockfileVersion: '6.0'
|
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
'@maplibre/maplibre-gl-style-spec':
|
|
||||||
specifier: ^19.3.3
|
|
||||||
version: 19.3.3
|
|
||||||
prettier:
|
|
||||||
specifier: ^3.1.1
|
|
||||||
version: 3.1.1
|
|
||||||
prettier-plugin-sort-json:
|
|
||||||
specifier: ^3.1.0
|
|
||||||
version: 3.1.0(prettier@3.1.1)
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
/@mapbox/jsonlint-lines-primitives@2.0.2:
|
|
||||||
resolution: {integrity: sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==}
|
|
||||||
engines: {node: '>= 0.6'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@mapbox/unitbezier@0.0.1:
|
|
||||||
resolution: {integrity: sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@maplibre/maplibre-gl-style-spec@19.3.3:
|
|
||||||
resolution: {integrity: sha512-cOZZOVhDSulgK0meTsTkmNXb1ahVvmTmWmfx9gRBwc6hq98wS9JP35ESIoNq3xqEan+UN+gn8187Z6E4NKhLsw==}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
'@mapbox/jsonlint-lines-primitives': 2.0.2
|
|
||||||
'@mapbox/unitbezier': 0.0.1
|
|
||||||
json-stringify-pretty-compact: 3.0.0
|
|
||||||
minimist: 1.2.8
|
|
||||||
rw: 1.3.3
|
|
||||||
sort-object: 3.0.3
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/arr-union@3.1.0:
|
|
||||||
resolution: {integrity: sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/assign-symbols@1.0.0:
|
|
||||||
resolution: {integrity: sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/bytewise-core@1.2.3:
|
|
||||||
resolution: {integrity: sha512-nZD//kc78OOxeYtRlVk8/zXqTB4gf/nlguL1ggWA8FuchMyOxcyHR4QPQZMUmA7czC+YnaBrPUCubqAWe50DaA==}
|
|
||||||
dependencies:
|
|
||||||
typewise-core: 1.2.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/bytewise@1.1.0:
|
|
||||||
resolution: {integrity: sha512-rHuuseJ9iQ0na6UDhnrRVDh8YnWVlU6xM3VH6q/+yHDeUH2zIhUzP+2/h3LIrhLDBtTqzWpE3p3tP/boefskKQ==}
|
|
||||||
dependencies:
|
|
||||||
bytewise-core: 1.2.3
|
|
||||||
typewise: 1.0.3
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/extend-shallow@2.0.1:
|
|
||||||
resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
is-extendable: 0.1.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/extend-shallow@3.0.2:
|
|
||||||
resolution: {integrity: sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
assign-symbols: 1.0.0
|
|
||||||
is-extendable: 1.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/get-value@2.0.6:
|
|
||||||
resolution: {integrity: sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/is-extendable@0.1.1:
|
|
||||||
resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/is-extendable@1.0.1:
|
|
||||||
resolution: {integrity: sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
is-plain-object: 2.0.4
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/is-plain-object@2.0.4:
|
|
||||||
resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
isobject: 3.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/isobject@3.0.1:
|
|
||||||
resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/json-stringify-pretty-compact@3.0.0:
|
|
||||||
resolution: {integrity: sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/minimist@1.2.8:
|
|
||||||
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/prettier-plugin-sort-json@3.1.0(prettier@3.1.1):
|
|
||||||
resolution: {integrity: sha512-eIDEUjwzekiVd+oKrpd0aoACBTp5zOW71wDTNy+qQ5C9Q8oqt9n9wCm4F+SeRZbXfgblh/WYIguJynImlBXrvQ==}
|
|
||||||
engines: {node: '>=16.0.0'}
|
|
||||||
peerDependencies:
|
|
||||||
prettier: ^3.0.0
|
|
||||||
dependencies:
|
|
||||||
prettier: 3.1.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/prettier@3.1.1:
|
|
||||||
resolution: {integrity: sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==}
|
|
||||||
engines: {node: '>=14'}
|
|
||||||
hasBin: true
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/rw@1.3.3:
|
|
||||||
resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/set-value@2.0.1:
|
|
||||||
resolution: {integrity: sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
extend-shallow: 2.0.1
|
|
||||||
is-extendable: 0.1.1
|
|
||||||
is-plain-object: 2.0.4
|
|
||||||
split-string: 3.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/sort-asc@0.2.0:
|
|
||||||
resolution: {integrity: sha512-umMGhjPeHAI6YjABoSTrFp2zaBtXBej1a0yKkuMUyjjqu6FJsTF+JYwCswWDg+zJfk/5npWUUbd33HH/WLzpaA==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/sort-desc@0.2.0:
|
|
||||||
resolution: {integrity: sha512-NqZqyvL4VPW+RAxxXnB8gvE1kyikh8+pR+T+CXLksVRN9eiQqkQlPwqWYU0mF9Jm7UnctShlxLyAt1CaBOTL1w==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/sort-object@3.0.3:
|
|
||||||
resolution: {integrity: sha512-nK7WOY8jik6zaG9CRwZTaD5O7ETWDLZYMM12pqY8htll+7dYeqGfEUPcUBHOpSJg2vJOrvFIY2Dl5cX2ih1hAQ==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
bytewise: 1.1.0
|
|
||||||
get-value: 2.0.6
|
|
||||||
is-extendable: 0.1.1
|
|
||||||
sort-asc: 0.2.0
|
|
||||||
sort-desc: 0.2.0
|
|
||||||
union-value: 1.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/split-string@3.1.0:
|
|
||||||
resolution: {integrity: sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
extend-shallow: 3.0.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/typewise-core@1.2.0:
|
|
||||||
resolution: {integrity: sha512-2SCC/WLzj2SbUwzFOzqMCkz5amXLlxtJqDKTICqg30x+2DZxcfZN2MvQZmGfXWKNWaKK9pBPsvkcwv8bF/gxKg==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/typewise@1.0.3:
|
|
||||||
resolution: {integrity: sha512-aXofE06xGhaQSPzt8hlTY+/YWQhm9P0jYUp1f2XtmW/3Bk0qzXcyFWAtPoo2uTGQj1ZwbDuSyuxicq+aDo8lCQ==}
|
|
||||||
dependencies:
|
|
||||||
typewise-core: 1.2.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/union-value@1.0.1:
|
|
||||||
resolution: {integrity: sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
|
||||||
arr-union: 3.1.0
|
|
||||||
get-value: 2.0.6
|
|
||||||
is-extendable: 0.1.1
|
|
||||||
set-value: 2.0.1
|
|
||||||
dev: false
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import json
|
|
||||||
import subprocess
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import click
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.argument(
|
|
||||||
'styles_folder',
|
|
||||||
type=click.Path(exists=True, file_okay=False, resolve_path=True, path_type=Path),
|
|
||||||
)
|
|
||||||
def cli(styles_folder):
|
|
||||||
"""
|
|
||||||
Lints all style JSON files in a folder
|
|
||||||
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)
|
|
||||||
node_bin_path = Path(p.stdout.strip())
|
|
||||||
prettier_config_path = node_bin_path.parent.parent / '.prettierrc.js'
|
|
||||||
|
|
||||||
for style_file in styles_folder.rglob('*.json'):
|
|
||||||
if 'node_modules' in style_file.parts:
|
|
||||||
continue
|
|
||||||
|
|
||||||
with open(style_file) as fp:
|
|
||||||
data = json.load(fp)
|
|
||||||
if 'sources' not in data:
|
|
||||||
continue
|
|
||||||
|
|
||||||
print(f'formatting {style_file}')
|
|
||||||
|
|
||||||
remove_keys(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
|
|
||||||
)
|
|
||||||
with open(style_file, 'w') as fp:
|
|
||||||
fp.write(p.stdout)
|
|
||||||
|
|
||||||
# gl-style-validate
|
|
||||||
subprocess.run(
|
|
||||||
[
|
|
||||||
node_bin_path / 'gl-style-validate',
|
|
||||||
style_file,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_keys(style_file):
|
|
||||||
with open(style_file) as fp:
|
|
||||||
data = json.load(fp)
|
|
||||||
|
|
||||||
for key in ['id', 'center', 'zoom', 'bearing', 'pitch']:
|
|
||||||
data.pop(key, None)
|
|
||||||
|
|
||||||
with open(style_file, 'w') as fp:
|
|
||||||
json.dump(data, fp, ensure_ascii=False)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
cli()
|
|
||||||
Reference in New Issue
Block a user