Skip to content

maana-io/q-template-assistant-react-typescript

Repository files navigation

Maana Q Assistant Template (Basic)

Basic template for a create-react-app to be used as a maana Q assistant.

What's inside?

  • React App
  • Maana Q Assistant Client npm library installed
  • .env file with example variable printed in console (set in Dockerfile)
  • Dockerfile
  • nginx conf
  • Build/Run/Watch scripts

Default Functionality

  • Gets the current workspace.
  • Get the active graph from the workspace.
  • Creates a Function.
  • Adds the function as a node to the active graph in the workspace.

Resources

Development

As with any Node application, you must first install dependencies:

# install dependencies
npm i

# start watch mode, server, and tunnel service
npm run start

npm run start will log a URL to the console (your tunnel endpoint); copy this and register it with your instance of Q (see Registring a Custom Service).

Deployment:

Docker or local

  1. Docker:
    # build docker image
    sh dockerBuild.sh
    
    # start image
    sh dockerRun.sh
  2. Local
    npm run start

NPM Scripts

  1. start
    • starts all other processes for a single entrypoint for development
    • runs:
      1. watch
        • build application and start watch mode; builds to ./build
      2. serve
        • runs a local web server to host ./build
      3. tunnel
        • opens a tunnel to your local web server
  2. build
    • builds a production version of the application; output directory: ./build
  3. test
    • runs jest tests
  4. eject
  5. postinstall
    • handles patching react-scripts with some small changes to the Webpack configuration to improve the developer experience

Learn more about using the Maana Q Assistant Client library