boilerplate-2021

Yet another boilerplate for TypeScript and React developers.

Usage

Since this repository is already a GitHub Template,
you can directly create a new GitHub repository from this template.

Alternatively, you can clone this repository to your local workspace.

git clone https://github.com/MagicCube/boilerplate-2021.git

Don't forget to replace all the boilerplate-2021 with your own repository name after cloning.


Install

It is STRONGLY recommended to install dependencies via Yarn.

yarn

Develop

Start a local development server for developing, debugging and testing.

yarn dev

Build

Build for production.

yarn build

Preview the production build.

yarn preview
yarn preview

Generate ES modules and TypeScript declarations.

yarn build:es

Build for GitHub pages.

yarn build:gh-pages

Deploy to GitHub Pages

In .travis.yml, we've already integrated our project with Travis' pages deployment,
which means every push to master branch will trigger Travis to build and update GitHub pages automatically.

You’ll need to generate a personal access token
with the public_repo or repo scope (repo is required for private repositories).
Since the token should be private, you’ll want to pass it to Travis securely in your repository settings or via encrypted variables in .travis.yml.

Alternatively, you can also run the following command from local to manually deploy GitHub pages.

yarn deploy

Visit GitHub Pages settings page to config your own site.


Themes

Two built-in themes are introduced in this boilerplate.

We use Light Theme by default.
Change the @theme variable to dark in src/styles/theme.less if you prefer dark mode.