Skip to content

Commit 0bf19e9

Browse files
committed
readme
1 parent f2cf5e0 commit 0bf19e9

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,8 @@ Documenting a component's API can be time consuming. We can simplify things by u
5656
npm run build-storybook
5757
```
5858

59-
### Publishing a component package
60-
61-
You can run `npm pack` for a preview of what the npm package would look like
62-
6359
## FAQ
6460

65-
### How do you publish a component package to npm?
66-
67-
Lit has documentation on [publishing your component package](https://lit.dev/docs/tools/publishing/) and if necessary, a [React framework wrapper](https://lit.dev/docs/frameworks/react/) too
68-
6961
### How would I recreate a similar repo like this one but from scratch?
7062

7163
Since we're using Lit, the first thing you'd have to do is run `npm create vite@latest` in your terminal and select `lit` from the CLI options. Then you'd run `npm install` to generate a `/node_modules`. Next, running `npx storybook@latest init` will include Storybook in your project.
@@ -115,6 +107,14 @@ We are also seeing a growing number of mapping libraries as React, Angular, web,
115107

116108
Choosing the best web mapping libraries that suit end user and developer needs is a crucial step for all web development involving maps and/or location services.
117109

110+
### How do you publish a component package to npm?
111+
112+
You can run `npm pack` for a preview of what an npm package of your components would look like. Additionally, Lit has documentation on [publishing your component package](https://lit.dev/docs/tools/publishing/) and if necessary, a [React 18 framework wrapper](https://lit.dev/docs/frameworks/react/) too. React 19 [seems to work fine](https://custom-elements-everywhere.com/) without a framework wrapper. This is demonstrated in one of the samples in this repo.
113+
114+
### What's the recommendation for documenting a component's API?
115+
116+
The [web components community](https://www.webcomponents.org/) recommends the [community standard custom-elements-manifest JSON](https://github.com/webcomponents/custom-elements-manifest).
117+
118118
### What challenges are there with creating a web component library?
119119

120120
If you're looking to write some truly "enterprise-ready" web components, you will face a series of challenges for consideration:
@@ -127,8 +127,8 @@ If you're looking to write some truly "enterprise-ready" web components, you wil
127127
- Documentation
128128
- E.g., TypeDoc, JSON, MDX, etc.
129129
- Support module formats other than [ECMAScript Modules](https://nodejs.org/api/esm.html) (ESM), like [AMD](https://en.wikipedia.org/wiki/Asynchronous_module_definition)
130-
- If we only support ESM applications then that means vanilla JavaScript script-tag users who prefer writing quick apps in an `index.html` file will struggle
131-
- How to handle styling (e.g., [adoptedStyleSheets](https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets), juggle light DOM / shadow DOM, etc.)
130+
- If we only support ESM applications then that means vanilla JavaScript script-tag users who prefer writing quick apps in an `index.html` file will struggle. The level of complexity for implementing this support can depend on how well your mapping library plays with certain module formats.
131+
- How to handle styling (e.g., [adoptedStyleSheets](https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets), light DOM / shadow DOM, etc.)
132132
- Asset management (if the component package requires assets)
133133
- Support disconnected / self-contained environment setups
134134
- Support [server-side rendering](https://www.debugbear.com/blog/server-side-rendering) (SSR)
@@ -148,10 +148,14 @@ These are only some of the considerations, but ultimately, if you're aiming for
148148

149149
Lit is a lightweight, un-opinionated, and customizable development system for writing web components. Since Lit doesn't have its own compiler, we use Vite for our development server and build tool. In comparison, Stencil has its own compiler but may not be flexible enough to adapt to the requirements of GIS web mapping libraries who want to be "enterprise-ready". Another comparison is that Stencil supports JSX, but Lit does not. FAST is also lightweight and doesn't include its own built-in compiler. Technically, you could write [web components with frameworks such as Vue](https://vuejs.org/guide/extras/web-components.html#building-custom-elements-with-vue), but then your component library might be less portable and become tightly coupled to that framework.
150150

151-
### How to debug
151+
### How to debug?
152152

153153
The component relies on MapLibre GL JS. You can look for errors in DevTools. For example, if an invalid `style.json` is passed to the `mapStyle` property then there will be an AJAX error in the console.
154154

155+
### What are some additional resources?
156+
157+
https://github.com/web-padawan/awesome-web-components
158+
155159
## Acknowledgements
156160

157-
This repo was prepared for a [session](https://whova.com/embedded/session/yES4SgdEKaaEK0AD6y4YnM1DD3NRWjkPECkzqJQHhCY%3D/4005893/?widget=primary) at [FOSS4G NA 2024](https://www.foss4gna.org/)
161+
This repo was prepared for a [session](https://whova.com/embedded/session/yES4SgdEKaaEK0AD6y4YnM1DD3NRWjkPECkzqJQHhCY%3D/4005893/?widget=primary) at [FOSS4G NA 2024](https://www.foss4gna.org/)

0 commit comments

Comments
 (0)