Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Latest commit

 

History

History
166 lines (108 loc) · 8.98 KB

FOR_DEVELOPERS.md

File metadata and controls

166 lines (108 loc) · 8.98 KB

For Developers

1. How to Set Up Environments

Install the following application to the environment for development.

Application name Application version(Fill in only if specified) Installation conditions
Node.js 18.14.2 or higher Required
Visual Studio Code If you use Visual Studio Code
yarn When executing this program with yarn
docker compose When executing this program with docker compose
Vagrant When executing this program with Vagrant

1-1. Extensions for Visual Studio Code

To use Visual Studio Code, install the following extension.

Extensions Installation conditions
ESLint Any
Vetur Any
TSLint Any
Debugger for Chrome Any
Remote Development When developing with Visual Studio Code and Remote Containers

2. Run this program

The command is executed in the working copy root directory.

2-1. Using yarn

2-1-1. Install dependencies

# install dependencies
$ yarn install

2-1-2. Run this program

After executing the following command, you can check the program under development by accessing http://localhost:3000 .

2-1-2-1. Normal
# serve with hot reload at localhost:3000
$ yarn dev
2-1-2-2. Faster

You can disable accessibility auditing, which would make your local server faster.

# serve with hot reload at localhost:3000
$ yarn dev-no-axe

2-1-3. Troubleshoot

2-1-3-1. How to resolve Cannot find module **** error

Build the dependency again and run the program.

2-2. Using docker compose

2-2-1. Install dependencies and run this program

After executing the following command, you can check the program under development by accessing http://localhost:3000 .

# serve with hot reload at localhost:3000
$ docker compose up --build

2-2-2. Troubleshoot

2-2-2-1. How to resolve Cannot find module **** error

Stop the program and execute the following command.

$ docker compose run --rm app yarn install

2-3. Using Vagrant

2-3-1. Install dependencies and run this program

After executing the following command, you can check the program under development by accessing http://localhost:3000 .

# serve with hot reload at localhost:3000
$ vagrant up

2-4. When developing with Visual Studio Code and Remote Containers

2-4-1. Install dependencies and run this program

If you select the “Open Folder in Container” root of this repository (as seen in the lower left Quick start: Try a dev container (external site)), the environment construction will start.

You can check the program under development by accessing http://localhost:3000 after building the environment.

2-4-2. Notes

  • If you want to change the settings, modify .devcontainer/devcontainer.json. Please refer to devcontainer.json reference for more details.
  • The extension "ESLint" is only valid when executing Remote Container. Please add it to the extensions of .devcontainer/devcontainer.json if necessary.
  • A detailed procedure can be found Managing extensions (external site).
  • When rebuilding the development environment, please execute “Rebuild Container” which can be found at the lower left.

3. Detect production/others environment

On the production environment, 'production' is assigned to process.env.GENERATE_ENV variable, on the other case 'development' is assigned to the variable.
Please use the variable to detect which enviroinment is used at the runtime.


4. Deployment to Staging & Production Environments

When the branch listed in the left column of the table below is updated, the branch and website will be updated automatically.

branch A branch where HTML is built and updated Website updated
master production The production site https://stopcovid19.metro.tokyo.lg.jp/
staging gh-pages The staging site https://stopcovid19-tokyo-staging.web.app/
development dev-pages The development site https://stopcovid19-tokyo-development.web.app/

5. Branch rules

Pull Request is allowed only for development. Please use the following naming rules for the branch when sending a Pull Request.

Types of changes Naming rules for the branch
Feature implementation feature/#{ISSUE_ID}-#{branch_title_name}
Hotfix commit hotfix/#{ISSUE_ID}-#{branch_title_name}

5-1. Basic branch

Purpose Branch Confirmation URL People who can make pull requests Remarks
Development development https://stopcovid19-tokyo-development.web.app/ All developers base branch. Basically send a Pull Request here
Staging staging https://stopcovid19-tokyo-staging.web.app/ Only administrators For final confirmation before production. Non-admin pull requests are prohibited.
Production master https://stopcovid19.metro.tokyo.lg.jp/ Only administrators Pull Requests other than Administrators are prohibited

5-2. Branch used by the system

Purpose Branch Confirmation URL Remarks
Production site HTML production https://stopcovid19.metro.tokyo.lg.jp/ Location where statically built HTML is located
Staging site HTML gh-pages https://stopcovid19-tokyo-staging.web.app/ Where to find statically built HTML
For OGP working directory deploy / new_ogp None For updating OGP

6. Data

  • data/data.json: the last updated date of the page header is taken from the lastUpdate value in this file. The time zone of the lastUpdate value in this file is Japan Standard Time (JST; UTC+9). This file is periodically updated and its data is managed by the Tokyo Metropolitan Government. See this issue comment for more details.