Git Product home page Git Product logo

vite-react's Introduction

React + Vite

code style: prettier Ko-fi

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Contents

Usage

Install pnpm, if you don't have it installed already

npm install -g pnpm

Scaffold the project, replacing my-project with your desired project name

pnpm dlx degit CostasAK/vite-react#main my-project
cd my-project
pnpm install
pnpm prepare
pnpm start

When committing changes, you should use pnpm commit instead of git commit. pnpm commit will help you write better commit messages to pass the commitlint rules.

Project Setup

  • Update .github/CODEOWNERS
  • Update .github/FUNDING.yml
  • Update assignee in .github/dependabot.yml

Metadata

  • In env/.env, set the name and description for your app. These will be used in the HTML meta, openGraph, etc.
  • In public/oembed.json, set the author info. oEmbed is used by Discord to create preview embeds.
  • Update the LICENCE file.
  • Update the package name in package.json.
  • (Optional) Update labels.json. Add old names to aliases, such that labels are updated, instead of removed. If the labels are not automatically updated, manually run the labels workflow on main.

GitHub Pages

If Cloudflare Pages is not setup, pushes to main will trigger a workflow to publish to GitHub Pages. For it to work, the repository needs to be setup for GitHub Pages using Actions. You can set this by going to:

  • Settings → Pages → Build and deployment → Source: GitHub Actions

Cloudflare Pages

Setting up the following secrets and variable will cause Cloudflare Pages to be used instead of GitHub Pages. Additionally, pull requests from branches in the repository will also trigger a Cloudflare Pages upload, so they can be previewed.

  • Cloudflare Pages project name
    • Secrets and variables → Actions → Variables → New repository variable → CLOUDFLARE_PROJECTNAME
  • Cloudflare account ID
    • Secrets and variables → Actions → New repository variable → CLOUDFLARE_ACCOUNT_ID
    • Secrets and variables → Dependabot → New repository variable → CLOUDFLARE_ACCOUNT_ID
  • Cloudflare API token
    • Secrets and variables → Actions → New repository variable → CLOUDFLARE_API_TOKEN
    • Secrets and variables → Dependabot → New repository variable → CLOUDFLARE_API_TOKEN

GitHub Repository Setup

Auto-merge Dependabot PRs

To auto-merge PRs and to allow workflows to be triggered off of them, a PAT is needed with access to the repository and the following permissions:

  • Repository permissions
    • Read
      • Metadata
    • Read and Write
      • Code
      • Pull Requests
      • Workflows

Once you have the token, set the following:

  • Settings
    • General → Pull Requests → Allow auto-merge
    • Actions → General → Workflow permissions → Allow GitHub Actions to create and approve pull requests
    • Secrets and variables
      • Set your token in the following 2 places:
        • Actions → New repository secret → APPROVAL_TOKEN
        • Dependabot → New repository secret → APPROVAL_TOKEN
      • Set the username of the actor of the token:
        • Actions → Variables → New repository variable → APPROVAL_ACTOR

Main branch protection

These settings especially important when using auto-merge for Dependabot PRs.

  • Settings
    • Branches → Branch Protection Rule
      • Branch name pattern: main
      • Protect matching branches
        • Require a pull request before merging
        • Require approvals
        • Dismiss stale pull request approvals when new commits are pushed
        • Require review from Code Owners
        • Require status checks to pass before merging → Require branches to be up to date before merging:
          • test
          • lint
          • format
          • commitlint
        • Require conversation resolution before merging

Suggestions

vite-react's People

Contributors

costasak avatar dependabot[bot] avatar github-actions[bot] avatar

Stargazers

 avatar

Watchers

 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.