GithubHelp home page GithubHelp logo

cw1997 / website Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pingcap/website

0.0 0.0 0.0 17.04 MB

The website of PingCAP. Powered by Gatsby โš›๏ธ and Rocket ๐Ÿš€.

JavaScript 69.00% Rust 2.05% SCSS 28.95%

website's Introduction

PingCAP Logo

Website

The website of PingCAP. Powered by Gatsby โš›๏ธ and Rocket ๐Ÿš€.

Netlify Status

How to start

If you want to start to develop the PingCAP Website or you just want to contribute in one place. The Gatsby.js https://gatsbyjs.org is something you have to know. Because of PingCAP Website's development is highly dependent on Gatsby.js.

Also, in order to build a flexible site, a server is essential.

We use Rocket to build our restful APIs. So, Rust is also the main tech in our development.

Make sure node and rustup is installed. This is all we needed first.

Check it:

node -v
# v13.7.0

rustup -V
# rustup 1.21.1 (7832b2ebe 2019-12-20)

Also, we recommand you use yarn as package manager, check it:

yarn -v
# 1.21.1

All done.~

How to development

Into project, run:

yarn && yarn start

if your want to development the server side:

# Make sure nightly used
rustup default nightly

cd server && cargo build

# Boot the rocket server
cargo run

# Check your code
cargo check

GitHub Outh2 token

Because of most of our text data stored in GitHub. So, It's needed to apply a GitHub API token in development.

For more details, view https://developer.github.com/v3/#rate-limiting

You must set the token as an env when you start some commands, defined as:

GITHUB_AUTHORIZATION_TOKEN=token

If you are developing the rocket server, it use dotenv to load a .env file. First, create a .env file in the server folder and pass the GITHUB_AUTHORIZATION_TOKEN=token into it. Then you can read it by using dotenv!("GITHUB_AUTHORIZATION_TOKEN").

For detailed configuration of rocket server, view: server README

For frontend developing, some scripts will also need this env variable, for example:

GITHUB_AUTHORIZATION_TOKEN=token yarn download:blogs:dev

Style guides

If you want make a PR, you should read this part carefully.

We use husky and lint-staged to make sure all commits follow the prettier setting.

Don't break the rule!

The next need to be noticed is, we use Bulma as common components.

So, for example, our common scss codes _common.scss follow the bulma modifiers style, like:

// Use in navbar and footer item
@mixin has-item-active($bottom: false) {
  position: relative;
  color: $B4;

  &:hover {
    background: none;
    color: $primary;

    @if type-of($bottom) == number {
      &:after {
        content: '';
        position: absolute;
        bottom: $bottom;
        left: 50%;
        width: 20px;
        height: 3px;
        background: $primary;
        transform: translateX(-50%);
      }
    }
  }
}

You can view more details in https://bulma.io/documentation/modifiers/

Also, don't break the rule!

Authors

PingCAP FE

website's People

Contributors

g1eny0ung avatar yinixu9506 avatar cw1997 avatar mz921 avatar xuechunl avatar std4453 avatar dcalvin avatar cindy-li1997 avatar caitinchen avatar soullss avatar queenyjin avatar sivagao avatar irisk31 avatar lilin90 avatar sykp241095 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.