Skip to content

Commit

Permalink
initial: 🎉 first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dino3616 committed Nov 28, 2024
0 parents commit baced76
Show file tree
Hide file tree
Showing 30 changed files with 740 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "tic-tac-toe",
"workspaceFolder": "/workspaces/tic-tac-toe/",
"dockerComposeFile": ["../docker/docker-compose.development.yaml"],
"service": "app",
"customizations": {
"vscode": {
"extensions": ["biomejs.biome", "editorconfig.editorconfig", "esbenp.prettier-vscode", "oven.bun-vscode"]
}
}
}
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# deliverable
**/build/
**/dist/
**/out/

# dependency
**/node_modules/

# env file
**/.env*
!**/.env.example

# log
**/*.tsbuildinfo

# misc
**/.DS_Store
**/*.pem
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
35 changes: 35 additions & 0 deletions .github/workflows/app-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: app test

on: push

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.36

- name: get bun cache directory
id: get-bun-cache-directory
run: echo "STORE_PATH=$(bun pm cache)" >> $GITHUB_OUTPUT

- name: cache bun dependencies
uses: actions/cache@v4
with:
path: ${{ steps.get-bun-cache-directory.outputs.STORE_PATH }}
key: ${{ runner.os }}-bun-dependencies-${{ hashFiles('**/bun.lockb') }}
restore-keys: ${{ runner.os }}-bun-dependencies-

- name: install dependencies
run: bun install --frozen-lockfile

- name: check
run: bun run check

- name: test
run: bun run test
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# deliverable
build/
dist/
out/

# dependency
node_modules/

# env file
.env*
!.env.example

# log
*.tsbuildinfo

# misc
.DS_Store
*.pem
1 change: 1 addition & 0 deletions .prototools
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bun = "1.1.36"
30 changes: 30 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.encoding": "utf8",
"files.eol": "\n",
"[css]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MIT License

Copyright © 2024 neo-wakuwaku-club

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- markdownlint-disable MD024 -->

# Tic Tac Toe 🎮

Tic Tac Toe (三目並べ) は、TypeScript と React のチュートリアルのために用意された二人対戦のボードゲームです。

## Setup with Dev Containers 📦

Tic Tac Toe の開発環境を Dev Containers で簡単に立ち上げることができます。

### Attention

- 事前に [Docker](https://docs.docker.com/get-docker)[Visual Studio Code](https://code.visualstudio.com) をインストールしておく必要があります。

### 1. clone git repository

```bash
git clone "https://github.com/neo-wakuwaku-club/tic-tac-toe" && cd "./tic-tac-toe"
```

### 2. launch container

VSCodeの拡張機能 [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) を使用してコンテナを起動してください。

### 3. install dependencies

```bash
bun install
```

### 4. start development server

```bash
bun run dev
```

## Setup locally 🖥️

Tic Tac Toe の開発環境をローカルで立ち上げる場合は以下の手順に従ってください。

### Attention

- 事前に [proto](https://moonrepo.dev/docs/proto/install) をインストールしておく必要があります。
- [Optional] 事前に [`.devcontainer/devcontainer.json`](./.devcontainer/devcontainer.json#L8C7-L8C112) に記載されている拡張機能をインストールしておくことを推奨します。

### 1. clone git repository

```bash
git clone "https://github.com/neo-wakuwaku-club/tic-tac-toe" && cd "./tic-tac-toe"
```

### 2. install package manager

```bash
proto use
```

### 3. install dependencies

```bash
bun install
```

### 4. start development server

```bash
bun run dev
```
91 changes: 91 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["dist/", "generated/", "node_modules/"],
"include": ["**/*.*js*", "**/*.*ts*"]
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"linter": {
"rules": {
"a11y": {
"useButtonType": "off"
},
"complexity": {
"noExcessiveCognitiveComplexity": "error",
"noForEach": "off",
"useLiteralKeys": "off",
"useSimplifiedLogicExpression": "error"
},
"correctness": {
"noUndeclaredVariables": "error",
"noUnusedImports": "error",
"noUnusedPrivateClassMembers": "error",
"useHookAtTopLevel": "error"
},
"style": {
"noDefaultExport": "error",
"noNamespace": "error",
"noNonNullAssertion": "off",
"useForOf": "error"
},
"suspicious": {
"noArrayIndexKey": "off",
"noConsoleLog": "off",
"useAwait": "error"
}
}
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 120
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "single",
"trailingCommas": "all",
"arrowParentheses": "asNeeded",
"bracketSpacing": true
},
"globals": ["chrome"]
},
"json": {
"parser": {
"allowComments": true
}
},
"css": {
"parser": {
"cssModules": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true
}
},
"overrides": [
{
"include": ["./*.ts", "./app/**/*.*ts*"],
"linter": {
"rules": {
"style": {
"noDefaultExport": "off"
}
}
}
}
]
}
Binary file added bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[install]
exact = true
19 changes: 19 additions & 0 deletions docker/Dockerfile.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# hadolint ignore=DL3007
FROM ubuntu:latest

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get --no-install-recommends -y install ca-certificates curl git gnupg2 unzip xz-utils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists

RUN curl -fsSL https://moonrepo.dev/install/proto.sh | bash -s -- --yes \
&& echo "export PATH=$PATH:/root/.proto/bin:/root/.proto/shims" >> ~/.bashrc \
&& source ~/.bashrc

WORKDIR /workspaces/tic-tac-toe/

COPY ./ ./
RUN /root/.proto/bin/proto use && /root/.proto/shims/bun install --frozen-lockfile
12 changes: 12 additions & 0 deletions docker/docker-compose.development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: tic-tac-toe
services:
app:
container_name: tic-tac-toe-app
build:
context: ../
dockerfile: ./docker/Dockerfile.development
volumes:
- type: bind
source: ../
target: /workspaces/tic-tac-toe/
tty: true
7 changes: 7 additions & 0 deletions lefthook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pre-commit:
parallel: true
commands:
check-fix:
glob: "*.*{js,ts,json}*"
run: bun biome check --write {staged_files}
stage_fixed: true
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "tic-tac-toe",
"version": "0.1.0",
"repository": "https://github.com/neo-wakuwaku-club/tic-tac-toe.git",
"license": "MIT",
"private": true,
"type": "module",
"packageManager": "bun@1.1.36",
"scripts": {
"prepare": "lefthook install",
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"check": "biome check .",
"check:fix": "biome check --write .",
"test": "bun test"
},
"dependencies": {
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@tsconfig/strictest": "2.0.5",
"@tsconfig/vite-react": "3.0.2",
"@types/bun": "1.1.13",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react-swc": "3.7.1",
"lefthook": "1.8.4",
"typescript": "5.7.2",
"vite": "6.0.1"
}
}
Loading

0 comments on commit baced76

Please sign in to comment.