Giter Site home page Giter Site logo

happy-christmas's Introduction

license ci codecov.io

Vite, React and Github Actions

This a React v18 + TypeScript + Vitest and React Testing Library + Github Actions starter template built with Vite.

Demo

Features

Overview

Coding Style

Git Hooks

Github Actions

  • Build, Test and Coverage Analysis (with Codecov) at each commit
  • Deploy to Github Pages on main branch (see deployment of this repo here)

Getting Started

Copy template

npx degit pchmn/happy-christmas app_name

Usage

Project was built using pnpm. If you want to use npm or yarn, just don't forget to update Github Actions workflow (.github/workflows/ci.yml).

Install

pnpm i

Dev

pnpm dev

Build

# normal build
pnpm build

# build with 404.html file added for Github Pages included
pnpm build:ci

See explanation of 404.html file here

Test

# without coverage
pnpm test

# with coverage
pnpm test:ci

Serve

pnpm serve

Configuration for Github Actions

If you want to use Github Actions in your repo, you'll need to make little configuration.

Actual workflow is:

image

Build & Test job

Build and test application on all commits

Create a Github personal access token (with repo and workflow permissions) and add it as a PERSONAL_ACCESS_TOKEN secret in your repo

Coverage job

Run Codecov analysis on all commits

Create a Codecov token for your repo and add it as a CODECOV_TOKEN secret in your repo

Deploy job

Manual deploy to Github Pages (only main branch)

  • Replace base config in vite.config.ts to match your repo name
  • Create GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL secrets in your repo (it will be the author of commits to gh-pages branch)
  • If you want to keep manual deployments, you need to create a new environment with manual approve in your repo, and then replace environment config in the deploy job in .github/workflows/ci.yml:
    • environment.name = name of the environment created in your repo
    • environment.url = link to your github pages

Github Pages

There are modifications on index.html, and a new 404.html file in the project to make it work well with Github Pages.

See https://github.com/rafgraph/spa-github-pages for more info.

happy-christmas's People

Contributors

pchmn 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.