This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,643 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/post_create_custom.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# +----------------------------------------------------------------------------------------+ # | ||
# | _____ _ _ | # | ||
# | | __ \ | | (_) | # | ||
# | | | | | ___ __ __ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ | # | ||
# | | | | | / _ \ \ \ / / / __| / _ \ | '_ \ | __| / _` | | | | '_ \ / _ \ | '__| | # | ||
# | | |__| | | __/ \ V / | (__ | (_) | | | | | \ |_ | (_| | | | | | | | | __/ | | | # | ||
# | |_____/ \___| \_/ \___| \___/ |_| |_| \__| \__,_| |_| |_| |_| \___| |_| | # | ||
# | | # | ||
# +----------------------------------------------------------------------------------------+ # | ||
|
||
# Node.js 20 image on Debian 12 (bookworm) | ||
FROM node:20-bookworm AS devcontainer | ||
ARG USERNAME=node | ||
|
||
RUN apt-get update | ||
|
||
# Install sudo | ||
RUN apt-get install -y sudo | ||
RUN echo "node ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/node | ||
|
||
# Install pnpm | ||
RUN corepack enable pnpm | ||
|
||
# Switch user | ||
# この操作により権限が一般ユーザーになります。 | ||
USER $USERNAME | ||
WORKDIR /home/$USERNAME/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "Development", | ||
"dockerComposeFile": "../compose.development.yaml", | ||
"service": "devcontainer", | ||
"workspaceFolder": "/workspaces", | ||
"postCreateCommand": "/workspaces/.devcontainer/post_create.sh", | ||
"remoteUser": "node", | ||
"shutdownAction": "none", | ||
"mounts": [ | ||
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/node/.ssh,readonly,type=bind" | ||
], | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"github.vscode-github-actions", | ||
"timonwong.shellcheck", | ||
"ms-azuretools.vscode-docker", | ||
"ms-vscode-remote.remote-containers", | ||
"editorconfig.editorconfig", | ||
"bierner.markdown-mermaid" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
# +----------------------------------------------------------------------------------------+ # | ||
# | _____ _ _ | # | ||
# | | __ \ | | (_) | # | ||
# | | | | | ___ __ __ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ | # | ||
# | | | | | / _ \ \ \ / / / __| / _ \ | '_ \ | __| / _` | | | | '_ \ / _ \ | '__| | # | ||
# | | |__| | | __/ \ V / | (__ | (_) | | | | | \ |_ | (_| | | | | | | | | __/ | | | # | ||
# | |_____/ \___| \_/ \___| \___/ |_| |_| \__| \__,_| |_| |_| |_| \___| |_| | # | ||
# | | # | ||
# +----------------------------------------------------------------------------------------+ # | ||
|
||
# Bash Strict Mode (http://redsymbol.net/articles/unofficial-bash-strict-mode/) | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
# Constants | ||
WORKSPACE_PATH=/workspaces | ||
BACKEND_PACKAGE_PATH="${WORKSPACE_PATH}/backend" | ||
FRONTEND_PACKAGE_PATH="${WORKSPACE_PATH}/frontend" | ||
CUSTOM_POST_CREATE_SCRIPT_PATH="${WORKSPACE_PATH}/.devcontainer/post_create_custom.sh" | ||
|
||
# 各パッケージの package.json を参照して pnpm と依存関係をインストールする | ||
echo "Install backend dependencies..." | ||
cd "$BACKEND_PACKAGE_PATH" | ||
corepack pnpm install --frozen-lockfile | ||
|
||
echo "Install frontend dependencies..." | ||
cd "$FRONTEND_PACKAGE_PATH" | ||
corepack pnpm install --frozen-lockfile | ||
|
||
# Run custom post create script | ||
if [ -f "$CUSTOM_POST_CREATE_SCRIPT_PATH" ]; then | ||
echo "Run custom post create script ($CUSTOM_POST_CREATE_SCRIPT_PATH)..." | ||
eval "$CUSTOM_POST_CREATE_SCRIPT_PATH" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Bash Strict Mode (http://redsymbol.net/articles/unofficial-bash-strict-mode/) | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
# Install Vim | ||
sudo apt-get install vim --yes | ||
|
||
# [README] | ||
# Dev Containerのコンテナー作成後にお好きな処理 (お気に入りのエディターのインストールなど)をコンテナーで実行させたい場合は | ||
# このファイルと同じディレクトリーに post_create_custom.sh という名前のファイルを作り | ||
# このファイルのようにシェルスクリプトを記述してください。 | ||
# | ||
# 実行権を付与 (chmod +x)する必要があることに注意してください。(このファイルをコピーするとよいでしょう) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for more information: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
# https://containers.dev/guide/dependabot | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "devcontainers" | ||
directory: "/" | ||
schedule: | ||
interval: weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ESLint CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- "frontend/src/**" | ||
- ".github/workflows/front-lint.yml" | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: frontend | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: "latest" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "latest" | ||
cache: "pnpm" | ||
cache-dependency-path: ./frontend/pnpm-lock.yaml | ||
- run: pnpm i | ||
- run: pnpm lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"[typescript][typescriptreact][javascript][javascriptreact][html][scss][json][jsonc][markdown]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# snow-spec | ||
A human-friendly, language for describing your API spec that generates OpenAPI file. | ||
|
||
## License | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# +----------------------------------------------------------------------------------------+ # | ||
# | _____ _ _ | # | ||
# | | __ \ | | (_) | # | ||
# | | | | | ___ __ __ ___ ___ _ __ | |_ __ _ _ _ __ ___ _ __ | # | ||
# | | | | | / _ \ \ \ / / / __| / _ \ | '_ \ | __| / _` | | | | '_ \ / _ \ | '__| | # | ||
# | | |__| | | __/ \ V / | (__ | (_) | | | | | \ |_ | (_| | | | | | | | | __/ | | | # | ||
# | |_____/ \___| \_/ \___| \___/ |_| |_| \__| \__,_| |_| |_| |_| \___| |_| | # | ||
# | | # | ||
# +----------------------------------------------------------------------------------------+ # | ||
|
||
name: snow-development | ||
|
||
services: | ||
devcontainer: | ||
build: | ||
context: . | ||
dockerfile: ./.devcontainer/Dockerfile | ||
target: devcontainer | ||
volumes: | ||
- .:/workspaces:cached | ||
working_dir: /workspaces | ||
command: sleep infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
syntax = "snow-spec-1.0"; | ||
|
||
// | ||
// common | ||
// | ||
|
||
type UUID = string { | ||
pattern "([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})"; | ||
caseSensitive false; | ||
}; | ||
|
||
type Name = string { | ||
pattern "[A-Za-z0-9-]*"; | ||
minLength 1; | ||
}; | ||
|
||
// | ||
// users | ||
// | ||
|
||
type DisplayName = string { | ||
minLength 1; | ||
}; | ||
|
||
type User = object { | ||
field userId: UUID; | ||
field name: Name; | ||
field displayName: DisplayName; | ||
}; | ||
|
||
POST /api/users { | ||
body: object { | ||
field name: Name; | ||
field displayName: DisplayName; | ||
}; | ||
response: User; | ||
} | ||
|
||
GET /api/users/:id { | ||
parameter id: UUID; | ||
response: User; | ||
} | ||
|
||
DELETE /api/users/:id { | ||
parameter id: UUID; | ||
} | ||
|
||
// | ||
// account | ||
// | ||
|
||
type Account = object { | ||
field accountId: UUID; | ||
field name: Name; | ||
field users: User[]; | ||
}; | ||
|
||
GET /api/me { | ||
response: Account; | ||
} |
Oops, something went wrong.