Used when we want to fetch data from APIs in order to display it. This provides a declarative and composable approach to state management


Keywords
runbook
License
MIT
Install
npm install @focuson/fetcher@1.44.3

Documentation

What is this project?

This project is a number of projects bundled together in a mono repo

The code on demand is still work in progress.

Getting started

These show how to use the lenses for state management in React.

Working with the project

You can optionally use the laoban tool to help manage the monorepo. There are currently 16 projects in the repo and it is difficult to manage them without some automation. Laoban provides that automation

Compiling

This project uses yarn workspaces. Normally the sequence of commands to build / run everything is

# from the root directory
yarn             # this gets all the dependencies
laoban tsc       # this executes tsc in all the projects
laoban test      # This executes the tests in all the projects that have tests in them
laoban status    # This shows the status of tsc and the tests
laoban start     # This executes 'yarn start' in all the react projects

Editing in an IDE

Unfortunately IDEs don't seem to work well with mono repos. When using an IDE such as IntelliJ it can be helpful to run the scripts in the scripts directory

  • ideify.sh - This changes imports such as @focuson/lens to relative addresses, which allows the ide access to the code
  • prepare.sh - This changes the imports back again. You should do this before running anything (such as tests/the actual code in react)

This is quite painful:

  • To run the tests from the command line you must run scripts/prepare.sh first
  • To run the examples in react you must run scripts/prepare.sh first
  • to edit the files in the IDE with codeinsight., compiling and linking working you must run scripts/ideify.sh first

Publishing

Setting up to publish

# From the root directory...
scripts/stage.sh
# Please check the status is suitable for publishing

And the publish itself

# From the root directory...
laoban publish && laoban status  
#Check the status of the publish