Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charites v2: Drop support providers, rewrite all to esm module #178

Merged
merged 12 commits into from
Sep 5, 2024
Merged
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.js

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build:
strategy:
matrix:
node-version: [18.x, 20.x, 21.x]
node-version: [20.x, 22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [22.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -53,8 +53,6 @@ jobs:
- run: npm run build
- run: chmod 777 dist/cli.js
- run: npm run test:e2e
env:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}

publish:
name: 'Publish npm package'
Expand All @@ -67,7 +65,7 @@ jobs:
- uses: actions/setup-node@v3
with:
tag_name: 'v%s'
node-version: '18.x'
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
scope: '@unvt'
- run: npm install
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ typings/
.serverless

dist

test-results/
7 changes: 7 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"loader": "ts-node/esm",
"require": ["./mocha-register.cjs"],
"extensions": ["ts"],
"spec": "test/*.ts",
"timeout": 5000
}
File renamed without changes.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

An easy, intuitive, and efficient command-line tool for writing vector map styles compatible with the [Mapbox](https://docs.mapbox.com/mapbox-gl-js/style-spec/) and [MapLibre](https://maplibre.org/maplibre-gl-js-docs/style-spec/) Style Specification in YAML.
An easy, intuitive, and efficient command-line tool for writing vector map styles compatible with the [MapLibre](https://maplibre.org/maplibre-style-spec/) Style Specification in YAML.
With YAML format's readability, JSON compiler, linter, and live style viewer on a local browser, you can simplify your map styling workflow.

In Greek mythology, the [Charites](https://en.wikipedia.org/wiki/Charites) are the three goddesses of charm, beauty, and human creativity. They are believed to have been worshipped not only by artists but also by those who aspired to technology to infuse them with a creative spirit.
Expand All @@ -15,7 +15,6 @@ In Greek mythology, the [Charites](https://en.wikipedia.org/wiki/Charites) are t
- Divide groups of layers in to multiple files for better readability and mantainability. `!!inc/file <relative-path-to-the-file>`
- Use variables like `$backgroundColor` and `$waterColor` to style effectively.
- Compile YAML to a single style.json file, with a format linter.
- Use `--provider mapbox` to validate your style against Mapbox GL JS v2.x
- Run `charites serve <source>` to preview your style live while you make changes in a browser.

## Documentation
Expand All @@ -30,6 +29,10 @@ see [CONTRIBUTING.md](./.github/CONTRIBUTING.md)

MIT

## Rquirements

- Node.js v20 or later

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand Down
9 changes: 4 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
Charites - Documentation
====================================

:Date: 2022-12-15
:Date: 2024-08-23
:Copyright: CC-BY-SA
:Organization: The United Nations Vector Tile Toolkit
:Version: 0.3.0
:Version: 2.0.0
:Abstract: This document contains the complete documentation of Charites, an application to style vector tiles easily

.. meta::
:description lang=en: This document contains the complete documentation of Charites, an application to style vector tiles easily
:keywords: Charites, Mapbox, Maplibre, Vectortiles, UNVT, webmapping
:keywords: Charites, Maplibre, Vectortiles, UNVT, webmapping

An easy, intuitive, and efficient command-line tool for writing vector map styles compatible with the `Mapbox <https://docs.mapbox.com/mapbox-gl-js/style-spec/>`_ and `MapLibre <https://maplibre.org/maplibre-gl-js-docs/style-spec/>`_ Style Specification in YAML.
An easy, intuitive, and efficient command-line tool for writing vector map styles compatible with the `MapLibre <https://maplibre.org/maplibre-style-spec/>`_ Style Specification in YAML.
With YAML format's readability, JSON compiler, linter, and live style viewer on a local browser, you can simplify your map styling workflow.

.. note::
Expand All @@ -30,7 +30,6 @@ Features
- Divide groups of layers in to multiple files for better readability and mantainability. `!!inc/file <relative-path-to-the-file>`
- Use variables like `$backgroundColor` and `$waterColor` to style effectively.
- Compile YAML to a single style.json file, with a format linter.
- Use `--provider mapbox` to validate your style against Mapbox GL JS v2.x
- Run `charites serve <source>` to preview your style live while you make changes in a browser.

.. toctree::
Expand Down
12 changes: 0 additions & 12 deletions docs/source/usage/commandline_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,8 @@ Build `style.json` from `style.yml`
-u, --sprite-url [<sprite url>] url to set as the sprite in style.json
-i, --sprite-input [<icon input directory>] directory path of icon source to build icons. The default <icon source> is `icons/`
-o, --sprite-output [<icon output directory>] directory path to output icon files. The default <icons destination> is the current directory
--provider [provider] your map service. e.g. `mapbox`, `geolonia`
-h, --help display help for command

if you use mapbox v2 for your style, please use `--provider mapbox` to specify mapbox service rather than default. Please see `--provider` option at `serve` command section.

Realtime editor on browser
--------------------------

Expand All @@ -94,8 +91,6 @@ Realtime editor on browser
serve your map locally

Options:
--provider [provider] your map service. e.g. `mapbox`, `geolonia`
--mapbox-access-token [mapboxAccessToken] Access Token for the Mapbox
-i, --sprite-input [<icon input directory>] directory path of icon source to build icons. The default <icon
source> is `icons/`
--sdf Allows to use SDF sprite in charites
Expand All @@ -104,13 +99,6 @@ Realtime editor on browser

Charites has three options for `serve` command.

- ``--provider`` - `mapbox`, `geolonia`, or `default`. When not specified, default or the value in the configuration file will be used.

- `mapbox` - The format linter runs against the Mapbox GL JS v2.x compatible specification.
- `geolonia` and `default` - the format linter runs against the MapLibre GL JS compatible specification.

- ``--mapbox-access-token`` - Set your access-token when styling for Mapbox.

- ``--sprite-input`` - If you are building icon spritesheets with Charites, you can specify the directory of SVG files to compile here. See the ``build`` command for more information.

- ``--sdf`` - if this option is used together with ``--sprite-input``, the viewer will generate SDF sprite. If the option is not specified, non SDF sprite will be generated.
Expand Down
6 changes: 0 additions & 6 deletions docs/source/usage/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,3 @@ Launch a live preview of your map style in your local environment:

charites serve style.yml


For Mapbox users:

.. code-block:: bash

charites serve style.yml --provider mapbox --mapbox-access-token xxxx
21 changes: 0 additions & 21 deletions docs/source/usage/global_options.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/source/usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ Usage
:maxdepth: 1

commandline_interface
global_options
examples
example2
46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
ignores: ['node_modules/', 'dist', 'mocha-register.cjs'],
},
...compat.extends(
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier',
),
{
languageOptions: {
parser: tsParser,
ecmaVersion: 2020,
sourceType: 'module',
},

rules: {
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
},
],
},
},
]
2 changes: 2 additions & 0 deletions mocha-register.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('ts-node/register')
require('tsconfig-paths/register')
Loading
Loading