Skip to content

Latest commit

 

History

History

Getting Started with Create React App

This project was bootstrapped with Create React App.

Contents 📖

Features ✅

  • ✅ Works with Crestron CH5 CrComLib out of the box.
    • No need to manually edit the CrComLib package.json 👍
  • ✅ React v18 Ready
  • ✅ Eruda Setup
  • ✅ Basic Redux Setup
  • ✅ Basic GitHub Actions CI
  • ✅ Multiple Build Options
    • ✅ React App
    • ✅ Crestron CH5 Archive (.ch5z)
    • ✅ Docker Image
    • ✅ Electron App

Inside the Box 📦

  • Crestron CH5 CrComLib
    • Crestron HTML5 (CH5) Components Library
  • Crestron CH5 WebXPanel
    • Browser control of ch5 components library
  • Crestron CH5 CLI
    • Crestron CH5 utilities
  • Crestron CH5 Helper
    • A helper collection of Crestron CH5 constants 😀
  • Typescript
    • A superset of JavaScript that compiles to clean JavaScript output
  • React Router
    • Declarative routing for React
  • Redux
    • Predictable state container for JavaScript apps
  • React Redux
    • Official React bindings for Redux
  • Redux Toolkit
    • The official, opinionated, batteries-included toolset for efficient Redux development
  • Styled Components
    • Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps 💅
  • TailwindCSS
    • A utility-first CSS framework for rapid UI development
  • clsx
    • A tiny (228B) utility for constructing className strings conditionally
  • React Icons
    • svg react icons of popular icon packs
  • React Crestron CH5 Hooks
    • A collection of Crestron CH5 hooks ⚓ for React 😀
  • Rooks
    • Essential React custom hooks ⚓ to super charge your components!
  • Eruda
    • Console for mobile browsers
  • Axios
    • Promise based HTTP client for the browser and node.js
  • ESLint
    • Find and fix problems in your JavaScript code
  • Prettier
    • An opinionated code formatter
  • Husky
    • Git hooks made easy 🐶 woof!
    • NOTE This feature needs to be manually enabled. See here for more details.
  • Lint-Staged
    • 🚫💩 — Run linters on git staged files
    • Requires Husky to be enabled.
  • Commitizen
    • Create committing rules for projects 🚀 auto bump versions ⬆️ and auto changelog generation 📂
  • commitlint
    • 📓 Lint commit messages
    • Requires Husky to be enabled.
  • GitHub Actions CI
    • Automate your workflow from idea to production
  • VSCode Workspace Settings
  • EditorConfig
  • Docker Support
    • Build safer, share wider, run faster
    • Requires Docker and Docker-Compose to be installed on your local machine. Portainer is also recommended as a front end for managing Docker containers. It is free and open-source.
  • Electron Support
    • Build cross-platform desktop apps with JavaScript, HTML, and CSS

Enable Husky Git Hooks 🐶

Currently, to use the Husky Git Hooks feature provided by this template you must manually run the following command within the project directory after the bootstrap completes. This will update the local git configuration to use the hooks in the .husky directory.

npm run husky:install

# or

yarn husky:install

Project Configuration ⚡

To upload to a Crestron touchscreen or control system using the scripts provided by this template, add the IP address or hostname to the project properties in package.json.

{
    "crestron": {
        "project": {
            "touchscreen": {
                "url": "Enter IP/Hostname of Crestron Touchpanel here...",
                "type": "touchscreen"
            },
            "web": {
                "url": "Enter IP/Hostname of Crestron Processor here...",
                "type": "web",
                "config": {
                    "host": "localhost",
                    "ipId": "0x03",
                    "roomId": ""
                }
            }
        }
    }
}

Available Scripts 🚀

In the project directory, you can run:

Create React App

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

yarn test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

yarn build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

yarn eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Crestron CH5

yarn build:archive

Builds a Crestron CH5 .ch5z archive file from the most recent build and outputs to the dist folder.

yarn build:deploy:touchscreen

Deploys the Crestron CH5 .ch5z archive file from the dist folder to a touchscreen.

yarn build:onestep:touchscreen

Executes the build, archive and deploy steps in sequence.

yarn build:deploy:web

Deploy the Crestron CH5 .ch5z archive file from the dist folder to a control system.

yarn build:onestep:web

Executes the build, archive and deploy steps in sequence.

Docker

yarn build:docker

Builds the application into a lightweight Docker image.
Creates a Docker container from the image running on the port specified in the .env file.
The default port is 8080.
You can then view your application at http://localhost:8080.

Electron

yarn build:electron

Builds the application into a standalone Electron desktop application and outputs to the app directory.

yarn electron:dev

Starts the Electron application in development mode.
The page will reload if you make edits.
You will also see any lint errors in the console.

General

yarn clean:all

Deletes the app, build and dist directories.

yarn commit

Invokes the Commitizen CLI and walks you through a series of prompts to fill out the commit message in the Conventional Commits format.

yarn lint

Will run the linter on the project and report any errors.

yarn lint:fix

Will run the linter on the project and automatically fix any fixable errors.
This script is run automatically by Lint-Staged on any files being committed to the Git repository if Husky is enabled. See here to enable Husky.

yarn pretty:fix

Applies the Prettier formatting rules to the project.
This script is run automatically by Lint-Staged on any files being committed to the Git repository if Husky is enabled. See here to enable Husky.

Learn More 📚

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

To learn Crestron CH5, check out the Crestron CH5 documentation.