Giter Site home page Giter Site logo

cube-playground-templates's Introduction

Cube.js

WebsiteDocsExamplesBlogSlackTwitter

Cube.js Playground Templates

This repository contains the templates used by the Cube Playground to scaffold various Dashboard Apps.

Contributing

You can contribute to this repository by creating new templates or extending the existing ones.

Structure overview

To better understand the structure, you can look at the manifest.json file containing the information about templates and packages. It also describes the way these components interact with each other.

Packages

Each package contains the information on where it can be installed to (installsTo) and what it can receive (receives).

For example, a root package may look like this:

{
  "name": "create-react-app",
  "version": "0.0.1",
  "installsTo": null,
  "receives": {
    "react-ui-framework": "0.0.1"
  }
}

The installsTo and receives fields represent interfaces. That means that the concrete package implementation (e.g., create-react-app) can receive any package that can be installed to the react-ui-framework interface.

For example:

{
  "name": "react-antd-dynamic",
  "version": "0.0.1",
  "installsTo": {
    "react-ui-framework": "0.0.1"
  },
  "receives": {}
}

Templates

Each template contains the comprehensive information required for template installation. The following fields name, description and coverUrl will be used to display the template in the Cube Playground on the Dashboard App page.

The templatePackages field describes all the packages the template consists of. During template installation, all packages defined in templatePackages will be downloaded and resolved accordingly.

{
  "name": "Dynamic Dashboard with React, AntD, and Recharts",
  "description": "Use this template to create a dynamic dashboard application with React, AntD, and Chart.js. It comes with a dynamic query builder and Apollo GraphQL client. Use it when you want to allow users to edit dashboards.",
  "coverUrl": "https://cube.dev/downloads/template-react-dashboard.png",
  "templatePackages": [
    "create-react-app",
    "react-antd-dynamic",
    "react-credentials",
    "recharts-charts",
    "antd-tables"
  ],
  "version": "0.0.1"
}

Development & Testing

In production, the manifest.json file, along with all the packages, are fetched from the https://github.com/cube-js/cubejs-playground-templates master branch.

You can avoid this behavior and make the server "fetch" those packages from a local folder. To do so, go through the next steps:

  1. run the server using the TEST_TEMPLATES env variable
TEST_TEMPLATES=true yarn start
  1. create a .tmp folder, where the cubejs-playground-templates will be stored
mkdir /Users/username/Projects/cubejs-app/node_modules/.tmp
  1. create a symlink to the local repository
ln -s /Users/username/Projects/cubejs-playground-templates /Users/username/Projects/cubejs-app/node_modules/.tmp/cubejs-playground-templates

Now, when you open the templates gallery in the Playground (by default at http://localhost:4000/#/template-gallery), you'll see the templates you're developing locally.

cube-playground-templates's People

Contributors

dondondondondondon avatar ovr avatar paveltiunov avatar rksh1997 avatar vasilev-alex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.