Repository navigation
929 shift to npm approach map styles - #32
Conversation
…with branch main.
…on, and renames style components for npm packaging of map-styles.
|
Version 0.9.2 published at https://www.npmjs.com/package/@openhistoricalmap/map-styles. The styles are mature but the module isn't so I'd only bump to 1.0.0 once we're convinced the approach is sound and the integration with ohm-website works. |
There was a problem hiding this comment.
renames styles for internal consistency within map-styles and in ohm-website (e.g. entities known variously as main or original are now called historical to match the layer picker on the website)
Will each of the stylesheets’ public URLs change with respect to what we currently document? The last time we changed the URLs to these styles, it created quite a ripple effect: OpenHistoricalMap/issues#792 (comment). historical.json is a more descriptive name, and the new names of the other files are cleaner, but if these changes have any impact beyond this repository, we should save them for a different task separate from migrating to NPM.
There was a problem hiding this comment.
I'll argue that migrating to NPM (and a halving of the cartography team) gives us a unique opportunity to do a bit of housecleaning as regards filenames. git got confused between the root level main directory and the branch of the same name, searching codebases for railway rather than rail narrows results considerably, and the one file that began with ohm suggested that it was unique in some way but I couldn't detect any reason why that would be so. The forEach loop in prepare expects the filenames to adhere to the naming in the styles array.
There was a problem hiding this comment.
I agree that these changes make sense. However, if the URL https://www.openhistoricalmap.org/map-styles/main/main.json breaks, then it’s a backwards-incompatible change and we need to plan accordingly. If you’re up for tackling this increased scope, then let’s track the various steps explicitly in a ticket. Since the last renaming, multiple third parties have adopted these styles, and there may be others we don’t know about.
It might be worth investigating whether we can put in symlinks or HTTP redirects to keep the old paths or URLs working for the time being as a deprecation strategy.
|
We'll need to add documentation on how to use the new Node bits and pieces. A few questions to that end:
I think that updates/creates |
|
Thinking about the redirects and style names: From what I can tell, this PR combines all the map styles into a single output file, Due to my own expertise limitations I'm having a hard time parsing the website PR against the style deploy script. Question: After the map-styles and website PR are merged, will there be individual style JSON files similar to https://www.openhistoricalmap.org/map-styles/main/main.json for external providers to use (regardless of filenames, which as noted we'd need to solve with redirects)? Or just the one big JS with all the styles combined? So like https://www.openhistoricalmap.org/map-styles/historical.json or similar Also, another aspect of the deploy script that I imagine we would need to retain is the swapping of staging vs production vtiles endpoints, so ultimately we might end up with a three interdependent PRs:
|
Yes. That's essentially what currently happens with a Python script that runs as part of the deploy process. That script also replaces
A good question. The
This is correct. |
I'll do that. I don't think I'm using anything that doesn't have a long history with node but I use
I'll write it up over the weekend at the latest so they can review it in time for the Tuesday all-hands. Documentation is a bit chicken-and-egg as I didn't want to start writing until I got some feedback, but the basics need to be documented in order to solicit feedback. |
We definitely don’t want anyone to treat the GitHub Pages–deployed stylesheets as production stylesheets. Do we need to maintain those for testing during development, or should the embed site migrate to staging.openhistoricalmap.org? |
We still need somewhere that the carto team can test styles without having them already go through Rails deploy. So for now, we do need those GH Pages links at least for internal testing. That said, Vanessa had asked me yesterday about building a local testing environment within the That obv would merit a new ticket if the approach makes sense/is feasible. |
The easiest thing may be to just set up a minimal express.js server in this repo that responds to |
|
Ideally, Maputnik would have everything a designer would need to confidently visualize the style they’re designing. In an OHM context, that would require integrating the time slider into Maputnik: OpenHistoricalMap/issues#529. That entails building a new, resuable time slider UI: OpenHistoricalMap/issues#914. I don’t think the embed site is much more complex than whatever we would produce as part of this repository. Before we can rely on this repo’s demo page again, it needs to incorporate almost everything in the embed site, especially date filtering. Back in November, we had to roll back a deployment of the styles because we had migrated them to expressions (OpenHistoricalMap/issues#775) but the time slider didn’t support expressions yet (OpenHistoricalMap/issues#855). We didn’t notice beforehand that date filtering would be broken, because this repo’s demo didn’t have date filtering at all. The embed site has some other some bells and whistles, including the optional globe view and label localization. These features are already live in production, and we plan to incorporate them into the main site eventually (OpenHistoricalMap/issues#481 etc.). Since end users are already experiencing these features, anyone designing a style needs to have these features present too. Otherwise, they’d be designing in too sterile an environment. The only thing that probably isn’t essential for style design is the timelapse animations, which will eventually be moved to the time slider UI library anyways.
This is more or less implemented already:
We could add an additional option to load the style from an arbitrary location specified on the command line. Then map-styles could have openhistoricalmap-embed as a devDependency, cutting some steps out of the design workflow.
It would make sense to turn map-styles into an NPM package and have openhistoricalmap-embed depend on map-styles. However, this wouldn’t eliminate the need to continue distributing the stylesheets from a stable public location. Every week brings another external developer directly depending on these styles. |
… paste into twice-renamed file; how to rebase this using git evades me
… reference again
* new URL for historical style * note that Github.io links should not be used in any external applications * remove reference to Git-sha deploy method, which we're deprecating * Add note about suing `nvm use`
danrademacher
left a comment
There was a problem hiding this comment.
This overall looks good to me. One thing I noticed -- the dist artifacts are included in version control. Is that expected?
So when I ran npm build, I ended up with changes to dist/ohm-styles.js, which I didn't expect and didn't commit.
|
I neglected to run prepare after making sure all of Tim's recent layer changes had been brought over. That's why |
This is a fix for a change from OpenHistoricalMap/map-styles#32 that affected the name of the Historical (was Main) OHM map style in the map-styles repo
|
@erictheise I woke up this morning and realized I had not confirmed if you had separated out individual JSON files each style, as we discussed -- those are needed for external consumers (including the redirect we'll need from |
* Update staging URL for Historical Map Style This is a fix for a change from OpenHistoricalMap/map-styles#32 that affected the name of the Historical (was Main) OHM map style in the map-styles repo * Updated URLs to Railway, Japanese Scroll on staging --------- Co-authored-by: Minh Nguyễn <[email protected]>
* Update staging URL for Historical Map Style This is a fix for a change from OpenHistoricalMap/map-styles#32 that affected the name of the Historical (was Main) OHM map style in the map-styles repo * Updated URLs to Railway, Japanese Scroll on staging --------- Co-authored-by: Minh Nguyễn <[email protected]>
OpenHistoricalMap/issues#929 was opened in response to the different approaches that have been taken to integrate
map-stylesinto ohm-website, other OpenHistoricalMap projects, and non-OHM projects. This draft pull request does a few things:npm init, thus adding apackage.jsonfilepreparescript that can be run manually during development and that runs automatically as part ofnpm publishmap-stylesand inohm-website(e.g. entities known variously asmainororiginalare now calledhistoricalto match the layer picker on the website)The
preparescript functions similarly to theupdate_map_styles.pyscript inohm-deploybut is used earlier in the workflow allowing style versioning in ohm-website and openhistoricalmap-embed to be better understood.A companion branch and PR will be opened in ohm-website momentarily.