Git Product home page Git Product logo

nodecg-react-boilerplate's Introduction

nodecg-react-boilerplate

A boilerplate for NodeCG with React, TypeScript, Babel, and Webpack.

Features

  • React Fast Refresh
  • Supports an unlimited number of dashboards and graphic files
  • Storybook integration
  • TypeScript checking
  • Replicant/config JSON schema to TypeScript conversion

Setting up

GitHub Templates

Click the green "Use this template" button on this repository, which will create a new repository based on this one.

Clone your new repo into your NodeCG installation's bundles folder:

git clone [email protected]:<username>/my-awesome-bundle.git

Open package.json and change the name field to the name of your repository, otherwise NodeCG will refuse to start it.

Run yarn to install dependencies.

Manual setup

Clone this repo into your NodeCG installation's bundles folder. You'll likely want to use a different name, like so:

git clone [email protected]:ystv/nodecg-react-boilerplate.git my-awesome-bundle

If you used a different name, go into package.json and change the name field to the name of your folder, otherwise NodeCG will refuse to start it.

Run yarn to install dependencies.

Usage

To start, run yarn start, and run NodeCG in a separate terminal.

To create additional dashboards/graphics, create files called src/dashboard/index.{name}.tsx or src/graphics/index.{name}.tsx - each one will be wrapped into a HTML page called dashboard/{name}.html or graphics/{name}.html. Then just reference it in package.json under nodecg. (If you want to customise the generated HTML, create a file called index.{name}.html.)

You can import files from the src/common folder simply by using import foo from "common/foo" no matter how deep you are in a directory hierarchy.

If you use NodeCG's replicant schemas or bundle configuration, you can run yarn schema to generate a TypeScript declaration file from those schemas - these will be placed in src/common/types.

If you want to use Storybook with React, create files called {name}.stories.tsx following the Storybook standards and run yarn storybook.

nodecg-react-boilerplate's People

Contributors

dependabot[bot] avatar markspolakovs avatar probablybenallen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nodecg-react-boilerplate's Issues

Use webpack 5 asset modules

      {
        test: /\.css$/,
        use: [
          "style-loader",
          {
            loader: "css-loader",
            options: {
              importLoaders: 3,
              modules: true,
            },
          },
        ],
        include: /\.module\.css$/,
      },
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
        exclude: /\.module\.css$/,
      },
      {
        test: /\.(png|svg|jpg|gif)$/,
        type: "asset/resource",
      },

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.