Skip to content

Refactor project to allow use as a dependency #146

@adamfranco

Description

@adamfranco

This project has started pretty organically and now that #137 is getting close, it may be time to think about refactoring the code for clarity for contributors.

Broadly, there are two ways that this project can be used:

  1. As a stand-alone map rendering/demo.
  2. As a dependency of another map, a style that another application would want to use as a basemap or to render its data.

The stand-alone map/demo case is currently what we've been focused on, but the inclusion of the style as a dependency of other projects shouldn't be too far off.

Here are some steps that might get us there, though I'm probably missing a few and these should be discussed:

  1. Move package.json to the root of the repository if there isn't a good reason to bury it in style/.
  2. Move index.html out of the style/ directory either to the root or to a demo/ or site/ subdirectory.
  3. Move the config and maplibre calls out of americana.js into an index.js or demo.js that goes with the demo's index.html. This should leave americana.js exporting a style object with all layers that is as complete as possible and which can be passed added in the demo or other map renderings after having the source tweaked to add the access key or change the source url.
  4. Any dependencies for the demo should be included when running npm i --include=dev. Any dependencies that are needed only when used as a library should be included by default.
  5. If the style needs to distribute built artifacts for consumption by downstream users, these should be added as addition tasks and packaged as releases.

Thoughts? What did I miss?

I think this is blocked by #137, but I could be wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions