1 Workflow specification

1.1 the Git specification

Git Branch Name

Project resident branch
  • Master: The master branch, which records iterations of the live version. The branch code is exactly the same as the live code.
  • Pre: closed test branch. Pre-released branch code.
  • Stage: Test branch. Branch code for testing after testing.
Development branch

Are created by the master branch and synchronized to the remote

  • Business development branch, namedEnglish name/Shenbing User Story Request Numberlikeleon/CDP00060-1, (if there is no single number, it can be replaced by English requirements) and synchronized to remote, delete the branch after the function goes online
  • Urgent bug fix named asEnglish name/hotfixAnd synchronize to remote, delete the branch after the function goes online

Git Commit Message format

type : subject

Type Submission type Subject Submit description
Feat: Added feature The corresponding content is a short description of the commit purpose, which usually contains no more than 50 characters
Fix: Fixes bugs
Docs: Only modified documents, such as README, CHANGELOG, etc
Style: Just change Spaces, indent format, do not change code logic
Refactor: Code refactored without adding new features or fixing bugs
Perf: Optimization related, such as improved performance, experience
Chore: Change the build process, or add dependency libraries, tools, etc

1.2 Development Process

  1. Developers create new development branches from master,English name/JIRA tracking number
  2. Git merges into the stage branch after local development
  3. Stage test passed, go to the pre branch and execute git mergeEnglish name/JIRA tracking number
  4. If the pre test passes, go to the master branch and run Git mergeEnglish name/JIRA tracking number
  5. Type the current time in a Tag format, such as V202008121509, accurate to minutes
  6. Operate and maintain the release code from the latest Tag

2 Coding Specifications

2.1 Formatting Specifications

Format project code with uniform. Prettierrc and the vscode Prettier plug-in

  • The number of indent Spaces is 2
  • The semicolon is omitted at the end of the statement
  • Use single quotes instead of double quotes
  • Object trailing comma
  • Print Spaces after ({) and before (}) the curly braces used in object literal declarations

Js 2.2 specification

named

  • Variables: small hump, prefix noun
  • Constant: delimiter _ for all uppercase and multiple words
  • Function: small hump, prefix verb

other

  • Constants should be stored separately. Self-interpretation named after the function. Special notes are required

  • It is recommended to use variables to extract a single condition or encapsulate a function during development and write notes

  • function

    • Function parameters should not be too many, more than three parameters consider object encapsulation
    • Self-explanatory with accurate function names
    • Function to followSingle responsibilityIt is recommended to decouple functions that have too many functions and encapsulate functions separately
  • Code to minimize duplication. It is recommended to encapsulate the two or three times

  • Don’t leave commented out code in your code base

  • Code robustness. Consider potential exception or error handling. For example, error capture

  • Consider code performance and efficiency