Skip to content

Commit

Permalink
fix: dev container (#175)
Browse files Browse the repository at this point in the history
* fix: added env and volumes, husky

* feat: expanding an idea of dev container

* fix: getting prepared image

* chore: moved link to proper block

* chore: settings for vscode

* fix: url in profile menu
  • Loading branch information
hmbanan666 authored Jun 22, 2024
1 parent 1a6438e commit 7c8fd4f
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 43 deletions.
33 changes: 24 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
{
"service": "chat-game",
"dockerComposeFile": [
"../.docker/docker-compose.dev.yml"
],
"workspaceFolder": "app",
"build": {
"dockerfile": "../.docker/Dockerfile.dev",
"context": "../"
},
"name": "Chat Game",
"service": "app",
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "yarn install",

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint"
]
}
},

"portsAttributes": {
"3000": {
"label": "Application",
Expand Down
16 changes: 0 additions & 16 deletions .docker/Dockerfile.dev

This file was deleted.

9 changes: 0 additions & 9 deletions .docker/docker-compose.dev.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/common.sh"

npx --no -- commitlint --edit ${1}
8 changes: 8 additions & 0 deletions .husky/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Workaround for Windows 10, Git Bash, and Yarn
if command_exists winpty && test -t 1; then
exec < /dev/tty
fi
5 changes: 2 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/common.sh"

npx lint-staged
npx lint-staged
47 changes: 47 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"eslint.experimental.useFlatConfig": true,

"prettier.enable": false,
"editor.formatOnSave": false,

"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ Let's build a similar world together! ⭐️ Become a Stargazer ⭐️

## 🕹️ How to develop

Clone this repo and use standard commands:
You can develop in isolated container with prepared options:

[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/hmbanan666/chat-game)

Make a fork. Or clone this repo and use standard commands:

```shell
git clone https://github.com/hmbanan666/chat-game
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/Profile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const isSignedIn = !!$page.data.profile
const handleSignOut = () => {
void fetch('/auth/profile', {
void fetch('/en/auth/profile', {
method: 'DELETE',
headers: {
'content-type': 'application/json',
Expand All @@ -35,8 +35,8 @@
{#if menuOpened}
<div class='profile-menu'>
<div>
<a href='/p/{$page.data.profile.userName}'>{$page.data.profile.userName}</a>
<a href='/play'>Играть</a>
<a href='/{$page.data.locale}/p/{$page.data.profile.userName}'>{$page.data.profile.userName}</a>
<a href='/{$page.data.locale}/play'>Играть</a>
</div>
<button on:click={handleSignOut}>Выйти</button>
</div>
Expand Down

0 comments on commit 7c8fd4f

Please sign in to comment.