Skip to content

Commit

Permalink
Typescript + Examples + Typedoc + Eslint (#10)
Browse files Browse the repository at this point in the history
* Initial commit

* Fix all typescript issues

* Remove unwanted file

* Main commit to create everything that is needed

* Document docs generation

* Add typedoc, improve docs

* Fix lint

* Fix how the package is exported, fix examples.

* Run docs generation as part of the CI.

* Add dependabot
  • Loading branch information
HarelM authored Mar 13, 2024
1 parent f66d208 commit 0e5a366
Show file tree
Hide file tree
Showing 37 changed files with 4,375 additions and 13,247 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 5
versioning-strategy: increase
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
4 changes: 2 additions & 2 deletions .github/workflows/lint-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
node-version-file: '.nvmrc'
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run build-compat
- run: npm run docs
- run: npm run build-dist
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist
publish_dir: docs
commit_message: 'deploy docs: ${{ steps.tag_version.outputs.new_tag }}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jspm_packages
.node_repl_history

dist
docs
70 changes: 0 additions & 70 deletions API.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Make sure to include the CSS and JS files.
**When using a CDN**

```html
<script src='https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/dist/maplibre-gl-inspect.js'></script>
<link href='https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/dist/maplibre-gl-inspect.css' rel='stylesheet' />
```

Expand Down
17 changes: 17 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
indent: [
2,
2
]
}
}
);
6 changes: 3 additions & 3 deletions examples/custom-color-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/custom-color-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/custom-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
37 changes: 37 additions & 0 deletions examples/generate-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import fs from 'fs';

/**
* This script is used to generate the docs for the examples.
* It reads the examples folder and replaces the relative paths to the maplibre-gl-inspect library with the unpkg url.
* It also creates an index.html file with links to all the examples.
*/

const files = fs.readdirSync('./examples');

for (const file of files) {
if (file.endsWith('.html')) {
let content = fs.readFileSync(`./examples/${file}`, 'utf8');
content = content.replaceAll("../", 'https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/');
fs.writeFileSync(`./docs/${file}`, content);
}
}

const index = `
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Maplibre GL Inspect Docs</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
</head>
<body>
<H1>Maplibre GL Inspect Docs</H1>
<H2><a href="API/index.html">API</a></H2>
<H2>Examples</H2>
<ul>
${files.map(f => ' <li><a href="' + f +'">' + f + '</a></li>').join('\n')}
</body>
</html>`

fs.writeFileSync(`./docs/index.html`, index);
6 changes: 3 additions & 3 deletions examples/geojson-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/inspect-only.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/less-fidly.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/many-sources.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/map-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/no-inspect-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/no-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/no-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/popup-on-click.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/query-params.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/raster.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
6 changes: 3 additions & 3 deletions examples/url-hash-toggle-callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
Expand Down
Loading

0 comments on commit 0e5a366

Please sign in to comment.