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

docs: add docusaurus #461

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3b2e57e
yarn create docusaurus docs classic --typescript
josxha Jun 6, 2024
8d0ef02
edit config
josxha Jun 6, 2024
086c5e7
Update build-docs.yml
josxha Jun 6, 2024
e784288
Update build-docs.yml
josxha Jun 6, 2024
421f2ce
Update build-docs.yml
josxha Jun 6, 2024
7189c65
Update build-docs.yml
josxha Jun 6, 2024
70cbd2f
Update build-docs.yml
josxha Jun 6, 2024
b8e3dd3
add iframe
josxha Jun 6, 2024
8621732
Update intro.md
josxha Jun 6, 2024
e443c82
Update intro.md
josxha Jun 6, 2024
37fd93d
Merge branch 'main' into feat/add-docusaurus
josxha Jun 10, 2024
a1ce718
Update README.md
josxha Jun 10, 2024
efeaac7
write get-started
josxha Jun 10, 2024
c74cfe8
set links, remove most generated sites
josxha Jun 10, 2024
6e5ffa0
add code block titles
josxha Jun 10, 2024
3436fc7
remove generated pages
josxha Jun 10, 2024
f02eaf2
add dart syntax highlighting
josxha Jun 10, 2024
acb2648
fix imports
josxha Jun 10, 2024
cf277ce
fix external link
josxha Jun 10, 2024
3486c35
Update setup-android.md
josxha Jun 10, 2024
bdf3164
Update setup-android.md
josxha Jun 10, 2024
8ca44b8
add faq
josxha Jun 10, 2024
5fe910d
fix faq link
josxha Jun 10, 2024
a1d109b
add example image
josxha Jun 10, 2024
3dc6b7e
Update build-docs.yml
josxha Jun 10, 2024
3c44e52
update front page
josxha Jun 10, 2024
d7bdaef
fix link, format
josxha Jun 10, 2024
77c9b03
add background image
josxha Jun 10, 2024
3e44833
Update styles.module.css
josxha Jun 10, 2024
edbd01a
fix nav bar links
josxha Jun 10, 2024
7d9701b
fix build
josxha Jun 10, 2024
0875275
update stackoverflow tag
josxha Jun 10, 2024
5062ccf
use maplibre org
josxha Jun 10, 2024
998771e
update docs
josxha Jun 10, 2024
b4e3724
create version for 0.20.0
josxha Jun 10, 2024
c0e1ccd
fix link label
josxha Jun 10, 2024
3df91c5
disable push to gh-pages
josxha Jun 23, 2024
efeaaff
split CI into two
josxha Jun 23, 2024
a58e217
Merge branch 'main' into feat/add-docusaurus
josxha Jun 23, 2024
8743b71
Delete build-deploy-docs.yml
josxha Jun 23, 2024
ffcad35
Revert "Delete build-deploy-docs.yml"
josxha Jun 23, 2024
cd72a76
Update build-docs.yml
josxha Jun 23, 2024
fdf455c
Merge branch 'main' into feat/add-docusaurus
josxha Jun 24, 2024
3f31c42
use action version v4.3.3
josxha Jun 24, 2024
e46e1fc
Merge branch 'main' into feat/add-docusaurus
josxha Jun 25, 2024
2a0cd93
Merge branch 'main' into feat/add-docusaurus
josxha Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/build-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Generate documentation

on:
push:
branches: [ main ]

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
defaults:
run:
working-directory: docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
# Can't use cache because build fails with "Dependencies lock file is not found"
# with:
# cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Build
run: yarn build
- name: Deploy to GitHub Pages
if: github.repository_owner == 'maplibre'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build
keep_files: true
22 changes: 22 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Generate documentation

on: [ push, pull_request, workflow_dispatch ]

jobs:
build:
defaults:
run:
working-directory: docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
# Can't use cache because build fails with "Dependencies lock file is not found"
# with:
# cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Build
run: yarn build
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
uses: actions/dependency-review-action@v4.3.3
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
49 changes: 49 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Documentation

The documentation website is built using [Docusaurus](https://docusaurus.io/),
a static website generator.
See the hosted documentation at [TODO insert url]()

## Run locally

To run the website locally, you need to have Node.js and yarn installed.
You can Node.js from [here](https://nodejs.org/) and install yarn by running
`npm install -g yarn`.

Run the following commands to fetch the dependencies:

```bash
yarn
```

Then, run the following command to start the development server:

```bash
yarn start
```

This command starts a local development server. Most changes are reflected live
without having to restart the server.

### Create new docs version

To create a new version of the documentation, run the following command:

```bash
yarn docusaurus docs:version <version>
```

A new `versioned_docs.version-<version>` folder will be created and the version
gets added to the `versions.json` file.

### Build

```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

The website is deployed automatically to GitHub Pages via CI.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
48 changes: 48 additions & 0 deletions docs/docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
sidebar_position: 5
---

# FAQ

### Loading .mbtiles tile files or sprites/glyphs from the assets shipped with the app

One approach that has been used successfully to do that is to copy the files
from the app's assets directory to another directory, e.g. the app's cache
directory, and then reference that location.
See e.g. issues https://github.com/maplibre/flutter-maplibre-gl/issues/338
and https://github.com/maplibre/flutter-maplibre-gl/issues/318

### Avoid Android UnsatisfiedLinkError

Update buildTypes in `android\app\build.gradle`

```gradle title="android\app\build.gradle"
buildTypes {
release {
// other configs
ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86_64', 'x86'
}
}
}
```

### Layer is not displayed on IOS, but no error

Have a look in your `LayerProperties` object, if you supply a `lineColor`
argument, (or any color argument) the issue might come from here.
Android supports the following format : `'rgba(192, 192, 255, 1.0)'`, but on
iOS, this doesn't work!

You have to have the color in the following format : `#C0C0FF`

### iOS crashes with error: `'NSInvalidArgumentException', reason: 'Invalid filter value: filter property must be a string'`

Check if one of your expression is : `["!has", "value"]`. Android support this
format, but iOS does not.
You can replace your expression with : `["!",["has", "value"] ]` which works
both in Android and iOS.

Note : iOS will display the
error : `NSPredicate: Use of 'mgl_does:have:' as an NSExpression function is forbidden`,
but it seems like the expression still works well.
8 changes: 8 additions & 0 deletions docs/docs/features/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Features",
"position": 4,
"link": {
"type": "generated-index",
"description": "Dive in to the features MapLibre GL for Flutter provides."
}
}
18 changes: 18 additions & 0 deletions docs/docs/features/supported-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
sidebar_position: 1
---

# Supported Features

| Feature | Android | iOS | Web | Windows | MacOS | Linux |
|----------------|:-------:|:---:|:---:|:-------:|:-----:|:-----:|
| Style | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Camera | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Gesture | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| User Location | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Symbol | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Circle | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Line | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Fill | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Fill Extrusion | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Heatmap Layer | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
8 changes: 8 additions & 0 deletions docs/docs/getting-started/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Getting Started",
"position": 2,
"link": {
"type": "generated-index",
"description": "Quick start guide"
}
}
24 changes: 24 additions & 0 deletions docs/docs/getting-started/add-dependency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 1
---

# Add Dependency

Add `maplibre_gl` to your project by running this command:

```bash
flutter pub add maplibre_gl
```

or add it directly as a dependency to your `pubspec.yaml` file and run
`flutter pub get`:

```yaml title="pubspec.yaml"
dependencies:
maplibre_gl: ^0.20.0 # use the latest version found on pub.dev
```

You can find the latest version of the package on
[pub.dev](https://pub.dev/packages/maplibre_gl) or here:

[![Pub Version](https://img.shields.io/pub/v/maplibre_gl)](https://pub.dev/packages/maplibre_gl)
72 changes: 72 additions & 0 deletions docs/docs/getting-started/setup-android.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
sidebar_position: 3
---

# Setup Android

## Use a compatible Kotlin version

Ensure that you are using Kotlin version
**1.9.0** or newer. You can check the most recent Kotlin version on
[kotlinlang.org](https://kotlinlang.org/docs/releases.html#release-details).

#### (new) Gradle with a declarative plugins block

Open `android/settings.gradle` and set the Kotlin version like this:

```gradle title="android/settings.gradle"
plugins {
// ...
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}
```

In case you can't find the `plugins {}` block your app still uses the old apply
script method.

#### (old) In a legacy apply script gradle file:

Open `android/app/build.gradle` and set the Kotlin version like this:

```gradle title="android/app/build.gradle"
buildscript {
ext.kotlin_version = '1.9.0'
// ...
}
```

## Minimum SDK version

If you are using a flutter version below 3.22, you need to set the minimum SDK
version to 21 or higher in `android/app/build.gradle`.

```gradle title="android/app/build.gradle"
defaultConfig {
minSdk = 21 // previously flutter.minSdkVersion
// ...
}
```

If you are using the old apply script method in gradle, `minSdk` is named
`minSdkVersion`.

Starting from flutter 3.22, the minimum SDK version is set to 21 by default
and you can keep `flutter.minSdkVersion`.

## Use the location feature

If you want to show the user's location on the map you need to add
the `ACCESS_COARSE_LOCATION` or `ACCESS_FINE_LOCATION` permission in the
application manifest `android/app/src/main/AndroidManifest.xml`.

```xml title="android/app/src/main/AndroidManifest.xml"

<manifest>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
</manifest>
```

Starting from Android API level 23 you also need to request it at runtime. This
plugin does not handle this for you. Our example app uses the
[flutter plugin "location"](https://pub.dev/packages/location) for this.
41 changes: 41 additions & 0 deletions docs/docs/getting-started/setup-ios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sidebar_position: 2
---

# Setup iOS

There is no longer any specific setup needed to include the package on iOS.

## Use the location feature

If you access your users' location, you should also add the following key
to `ios/Runner/Info.plist` to explain why you need access to their location
data:

```xml title="ios/Runner/Info.plist"
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>[Your explanation here]</string>
</dict>
```

A possible explanation could be: "Shows your location on the map".

## Upgrading from a previous version

Previous versions of the package required you to add the following lines to
your `ios/Podfile`. You'll have to remove these lines from your `ios/Podfile`
or your project won't build.

<details>
<summary>View obsolete code</summary>

```ruby title="ios/Podfile"
source 'https://cdn.cocoapods.org/'
source 'https://github.com/m0nac0/flutter-maplibre-podspecs.git'

pod 'MapLibre'
pod 'MapLibreAnnotationExtension'
```

</details>
26 changes: 26 additions & 0 deletions docs/docs/getting-started/setup-web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
sidebar_position: 4
---

# Setup Web

Include the following JavaScript and CSS files in the `<head>` tag of
your `web/index.html` file:

```html title="web/index.html"
<!DOCTYPE html>
<html>
<head>
<!-- other html -->

<!-- MapLibre -->
<script src='https://unpkg.com/maplibre-gl@^4.3/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@^4.3/dist/maplibre-gl.css'
rel='stylesheet'/>
</head>
</html>
```

`^4.3` ensures that your app will always use the latest version of
[maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js) v4 but not suddenly
use an incompatible version.
Loading
Loading