Skip to content

Commit 1c808ed

Browse files
authored
upgrade library (#11)
1 parent 926c19f commit 1c808ed

38 files changed

+5834
-7470
lines changed

.github/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- github-actions
5+
labels:
6+
- release
7+
categories:
8+
- title: New Features
9+
labels:
10+
- 'enhancement'
11+
- title: Bug Fix
12+
labels:
13+
- 'bug'
14+
- title: Other Changes
15+
labels:
16+
- '*'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Automatically labeling pull request.
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
jobs:
8+
auto-labeling-pr:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
# ラベル名を取得する
18+
- name: Get label name
19+
id: label_name
20+
run: |
21+
branch_type=$(echo ${{github.head_ref}} | cut -d "/" -f1)
22+
if [ $branch_type == 'feature' ]; then
23+
label_name=$(echo "enhancement")
24+
elif [ $branch_type == 'bugfix' ] || [ $branch_type == 'hotfix' ]; then
25+
label_name=$(echo "bug")
26+
else
27+
label_name=""
28+
fi
29+
echo "::set-output name=label_name::$label_name"
30+
31+
# PRにラベルを付与する
32+
- name: Auto labeling
33+
if: ${{ steps.label_name.outputs.label_name }}
34+
run: |
35+
number=$(echo $GITHUB_REF | sed -e 's/[^0-9]//g')
36+
gh pr edit $number --add-label ${{ steps.label_name.outputs.label_name }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Create release tag and release note.
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
create-release-tag:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
TZ: 'Asia/Tokyo'
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
# 前回のりリースタグを取得する
19+
- name: Get previous tag
20+
id: pre_tag
21+
run: |
22+
echo "::set-output name=pre_tag::$(curl -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)"
23+
24+
# タグを生成する 「{YYYY.MM.DD}-{当日リリース回数}」
25+
- name: Generate release tag
26+
id: release_tag
27+
run: |
28+
today=$(date +'%Y.%m.%d')
29+
pre_release_date=$(echo ${{ steps.pre_tag.outputs.pre_tag }} | awk -F'-' '{print $1}')
30+
pre_release_count=$(echo ${{ steps.pre_tag.outputs.pre_tag }} | awk -F'-' '{print $2}')
31+
if [[ ! $pre_release_date = $today ]]; then
32+
echo "init count"
33+
pre_release_count=0
34+
fi
35+
echo "::set-output name=release_tag::v$today-$(($pre_release_count + 1))"
36+
37+
# 前回リリースからの差分をもとに、リリースノートの本文を生成する
38+
- name: Generate release note
39+
id: release_note
40+
run: |
41+
echo "::set-output name=release_note::$(curl -X POST -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/generate-notes -d '{"tag_name":"${{ steps.release_tag.outputs.release_tag }}", "previous_tag_name":"${{ steps.pre_tag.outputs.pre_tag }}"}' | jq .body | sed 's/"//g')"
42+
43+
# タグを切り、リリースノートを作成する
44+
- name: Create Release
45+
run: |
46+
curl -X POST \
47+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
48+
-d "{ \"tag_name\": \"${{ steps.release_tag.outputs.release_tag }}\", \"name\": \"${{ steps.release_tag.outputs.release_tag }}\", \"body\": \"${{ steps.release_note.outputs.release_note }}\"}" \
49+
https://api.github.com/repos/${{ github.repository }}/releases
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create a pull request for release.
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
7+
jobs:
8+
create-release-pr:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
# リリース用PRが既に存在するかどうかをチェック
18+
- name: Check if pr exists
19+
id: check_pr
20+
run: |
21+
pr_title='Release'
22+
base_branch='main'
23+
echo "::set-output name=count::$(gh pr list -S ${pr_title}' in:title' -B $base_branch | wc -l)"
24+
echo "::set-output name=pr_title::$pr_title"
25+
echo "::set-output name=base_branch::$base_branch"
26+
27+
# リリース用PRを作成
28+
- name: Create release pr
29+
if: ${{ steps.check_pr.outputs.count == 0 }}
30+
run: |
31+
gh pr create -B ${{ steps.check_pr.outputs.base_branch }} -t ${{ steps.check_pr.outputs.pr_title }} -b "" -l "release"

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.13.0

README.md

Lines changed: 181 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,183 @@
11
# Static Site Generator with Docker React
22

3-
[README](./static-site-generator)
3+
![GitHub release (with filter)](https://img.shields.io/github/v/release/InumberX/ssg-with-docker-react) ![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/InumberX/ssg-with-docker-react) ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/InumberX/ssg-with-docker-react) ![GitHub issues](https://img.shields.io/github/issues/InumberX/ssg-with-docker-react) ![GitHub closed issues](https://img.shields.io/github/issues-closed/InumberX/ssg-with-docker-react) ![GitHub pull requests](https://img.shields.io/github/issues-pr/InumberX/ssg-with-docker-react) ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/InumberX/ssg-with-docker-react)
4+
5+
## Development with Node.js
6+
7+
Start a shell such as PoworShell and navigate to the root of the project.
8+
9+
### Installing packages
10+
11+
Install the Node.js package.
12+
13+
```shell
14+
yarn install
15+
```
16+
17+
### Execution of development tasks
18+
19+
Execute the following command.
20+
21+
```shell
22+
yarn dev
23+
```
24+
25+
The following URL will take you to the screen.
26+
27+
http://localhost:3000/
28+
29+
- Press "Ctrl + C" to stop
30+
31+
### Execution of Storybook
32+
33+
Execute the following command.
34+
35+
```shell
36+
yarn storybook
37+
```
38+
39+
The following URL will take you to the screen.
40+
41+
http://localhost:6006/
42+
43+
- Press "Ctrl + C" to stop
44+
45+
### Build
46+
47+
Execute the following command to execute the build.
48+
49+
```shell
50+
yarn build
51+
```
52+
53+
### Syntax Check
54+
55+
```shell
56+
yarn lint
57+
```
58+
59+
### Formatter
60+
61+
#### Check
62+
63+
```shell
64+
yarn prettier
65+
```
66+
67+
#### Check and Format
68+
69+
```shell
70+
yarn prettier:fix
71+
```
72+
73+
### Formatter (SCSS)
74+
75+
#### Check
76+
77+
```shell
78+
yarn stylelint
79+
```
80+
81+
#### Check and Format
82+
83+
```shell
84+
yarn stylelint:fix
85+
```
86+
87+
## Development with Docker
88+
89+
Start a shell such as PoworShell and navigate to the root of the project.
90+
91+
### Launching Containers
92+
93+
The container is started by executing the following command.
94+
95+
```shell
96+
docker compose up -d
97+
```
98+
99+
### Installing packages
100+
101+
Install the Node.js package.
102+
103+
```shell
104+
docker compose exec node yarn install
105+
```
106+
107+
### Execution of development tasks
108+
109+
Execute the following command.
110+
111+
```shell
112+
docker compose exec node yarn dev
113+
```
114+
115+
The following URL will take you to the screen.
116+
117+
http://localhost:3000/
118+
119+
- Press "Ctrl + C" to stop
120+
121+
### Execution of Storybook
122+
123+
Execute the following command.
124+
125+
```shell
126+
docker compose exec node yarn storybook
127+
```
128+
129+
The following URL will take you to the screen.
130+
131+
http://localhost:6006/
132+
133+
- Press "Ctrl + C" to stop
134+
135+
### Build
136+
137+
Execute the following command to execute the build.
138+
139+
```shell
140+
docker compose exec node yarn build
141+
```
142+
143+
### Stopping Containers
144+
145+
Execute the following command to stop the container.
146+
147+
```shell
148+
docker compose down
149+
```
150+
151+
### Syntax Check
152+
153+
```shell
154+
docker compose exec frontend yarn lint
155+
```
156+
157+
### Formatter
158+
159+
#### Check
160+
161+
```shell
162+
docker compose exec frontend yarn prettier
163+
```
164+
165+
#### Check and Format
166+
167+
```shell
168+
docker compose exec frontend yarn prettier:fix
169+
```
170+
171+
### Formatter (SCSS)
172+
173+
#### Check
174+
175+
```shell
176+
docker compose exec frontend yarn stylelint
177+
```
178+
179+
#### Check and Format
180+
181+
```shell
182+
docker compose exec frontend yarn stylelint:fix
183+
```

static-site-generator/.eslintignore

Whitespace-only changes.

static-site-generator/.eslintrc.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"plugin:react/recommended",
9+
"standard",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
12+
"prettier"
13+
],
14+
"parser": "@typescript-eslint/parser",
15+
"parserOptions": {
16+
"ecmaFeatures": {
17+
"jsx": true
18+
},
19+
"ecmaVersion": "latest",
20+
"sourceType": "module",
21+
"project": "./tsconfig.json"
22+
},
23+
"plugins": ["react", "@typescript-eslint"],
24+
"rules": {
25+
"semi": [2, "never"],
26+
"indent": [
27+
"off",
28+
2,
29+
{
30+
"SwitchCase": 1,
31+
"offsetTernaryExpressions": true
32+
}
33+
],
34+
"import/no-extraneous-dependencies": ["off"],
35+
// function-componentの書き方の定義
36+
"react/function-component-definition": [
37+
2,
38+
{
39+
"namedComponents": "arrow-function",
40+
"unnamedComponents": "arrow-function"
41+
}
42+
],
43+
// オブジェクトスプレッド記法を許可
44+
"react/jsx-props-no-spreading": ["off"],
45+
// Reactのimportを明記しなくても良いことを許可
46+
"react/react-in-jsx-scope": ["off"],
47+
"@typescript-eslint/no-misused-promises": [
48+
"error",
49+
{
50+
"checksVoidReturn": {
51+
"attributes": false
52+
}
53+
}
54+
],
55+
"@typescript-eslint/no-unsafe-member-access": "warn"
56+
},
57+
"ignorePatterns": [".eslintrc.*"]
58+
}

0 commit comments

Comments
 (0)