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

Improve documentation for build tool integration #72

Merged
merged 2 commits into from
Jun 8, 2021

Conversation

ddohler
Copy link
Collaborator

@ddohler ddohler commented May 27, 2021

Overview

Fleshes out the documentation to include more information on how to integrate Loam with build tooling, which has been a common pain-point for users. Includes an explicit example for create-react-app, since it's what we often use and is fairly popular.

Notes

Build tooling support for WebAssembly and Web Workers is astonishingly poor right now, and it's even worse for libraries because you can't rely on any specific build tool or version of a build tool being available. There are decent solutions for developers who are writing and managing their own Web Workers and/or WebAssembly within their own app, but I haven't found much help if you want to integrate 3rd-party Web Workers or WebAssembly into an app, which is what Loam essentially asks developers to do.

It seems like the build story would be much easier if Loam didn't provide a web-worker-based API, and forced developers to figure that part out themselves, but you'll almost always want to run GDAL on a separate thread, so that would in effect force every developer to re-invent roughly the same Web Worker communication code (or copy-paste a "blessed" template file into their project source). That seems even worse than the current problems with build tool integration, which make things kind of clunky but aren't insurmountable obstacles.

Hopefully improving the documentation, plus addressing #71 and #58, will smooth off enough rough edges that we can sit tight until the rest of the ecosystem catches up, but if there are any other approaches that I'm not thinking of, I'd love to hear them!

Testing Instructions

  • Read through the instructions and make sure they're clear.
  • Spin up a tiny create-react-app ... app and make sure the instructions work for you. Once you've followed the instructions, putting something like this inside App.js() should be all that's needed:
import logo from './logo.svg';
import './App.css';
import { useEffect, useState } from 'react';
import loam from 'loam'

function App() {
  const [loamStatus, setLoamStatus] = useState("not ready yet.");

  useEffect(() => {
    loam.initialize("/").then(() => setLoamStatus("ready!"));
  }, []);

  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Loam is {loamStatus}
        </p>
      </header>
    </div>
  );
}

export default App;

Checklist

  • Add entry to CHANGELOG.md
  • Update the README with any function signature changes

Resolves #68 and/or #62 (both of which were closed by their creators, but hopefully this will prevent other people from having similar trouble).

Including adding a suggested path for integrating with create-react-app.
@ddohler ddohler requested a review from alkamin May 27, 2021 19:43
@ddohler ddohler changed the base branch from master to develop May 27, 2021 19:43
@ddohler
Copy link
Collaborator Author

ddohler commented Jun 7, 2021

Added a suggestion from @pcaisse to improve the getting-started example.

Copy link

@alkamin alkamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice and the instructions were easy to follow to get a working example running.

@ddohler
Copy link
Collaborator Author

ddohler commented Jun 8, 2021

Thanks for reviewing!

@ddohler ddohler merged commit 39a6180 into develop Jun 8, 2021
@ddohler ddohler deleted the feature/dpd/better-build-documentation branch June 8, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asset locations
2 participants