Skip to content

Commit

Permalink
Feature/fix dev (#39)
Browse files Browse the repository at this point in the history
* feat: github actionsでdockerイメージをビルドする

* fix: change workflow name and install ca

* fix: apt-getで運が悪いとコケる対策

* fix: 開発環境が動作するように

* enhance: 開発環境のtscをswcに変更

* feat: 開発環境をいい感じ™にした

* feat: add devcontainer
  • Loading branch information
cffnpwr authored Feb 24, 2023
1 parent e986052 commit b378ecc
Show file tree
Hide file tree
Showing 11 changed files with 296 additions and 49 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "taiyme/misskey dev",
"dockerComposeFile": ["../docker-compose.dev.yml"],
"service": "web",
"workspaceFolder": "/workspaces"
}
10 changes: 10 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:lts

RUN apt update && apt install -y git

COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages/backend/package.json ./packages/backend/
COPY packages/client/package.json ./packages/client/
COPY packages/sw/package.json ./packages/sw/

RUN corepack enable
41 changes: 41 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3'
services:
web:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- 3000:3000
networks:
- internal_network
- external_network
tty: true
volumes:
- .:/workspaces:cached
- ./.config:/misskey/.config:ro
depends_on:
- db
- redis

redis:
restart: always
image: redis:4.0-alpine
networks:
- internal_network
volumes:
- ./redis:/data

db:
restart: always
image: postgres:12.2-alpine
networks:
- internal_network
env_file:
- ./.config/docker.env
volumes:
- ./db:/var/lib/postgresql/data

networks:
internal_network:
internal: true
external_network:
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
web:
build:
context: .
cache_from:
cache_from:
- ghcr.io/taiyme/misskey:buildcache
restart: always
ports:
Expand All @@ -15,6 +15,9 @@ services:
volumes:
- ./files:/misskey/files
- ./.config:/misskey/.config:ro
depends_on:
- db
- redis

redis:
restart: always
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@
"js-yaml": "4.1.0"
},
"devDependencies": {
"@pnpm/logger": "^5.0.0",
"@types/gulp": "4.0.9",
"@types/gulp-rename": "2.0.1",
"@typescript-eslint/parser": "5.36.2",
"cross-env": "7.0.3",
"cypress": "10.7.0",
"start-server-and-test": "1.14.0",
"tasuku": "^2.0.1",
"typescript": "4.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"cbor": "8.1.0",
"chalk": "5.0.1",
"chalk-template": "0.4.0",
"chokidar": "3.5.3",
"cli-highlight": "2.1.11",
"color-convert": "2.0.1",
"content-disposition": "0.5.4",
Expand Down Expand Up @@ -183,6 +182,7 @@
"@types/ws": "8.5.3",
"@typescript-eslint/eslint-plugin": "5.36.2",
"@typescript-eslint/parser": "5.36.2",
"chokidar": "3.5.3",
"cross-env": "7.0.3",
"eslint": "8.23.0",
"eslint-plugin-import": "2.26.0",
Expand Down
17 changes: 1 addition & 16 deletions packages/backend/watch.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
import { execa } from 'execa';

(async () => {
// なぜかchokidarが動かない影響で、watchされない
/*
execa('tsc-alias', ['-w', '-p', 'tsconfig.json'], {
stdout: process.stdout,
stderr: process.stderr,
});
*/

setInterval(() => {
execa('tsc-alias', ['-p', 'tsconfig.json'], {
stdout: process.stdout,
stderr: process.stderr,
});
}, 3000);

execa('tsc', ['-w', '-p', 'tsconfig.json'], {
execa('swc', ['src', '-d', 'built', '-D', '-w'], {
stdout: process.stdout,
stderr: process.stderr,
});
Expand Down
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "client",
"private": true,
"scripts": {
"watch": "vite build --watch --mode development",
Expand Down
3 changes: 2 additions & 1 deletion packages/sw/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "sw",
"private": true,
"scripts": {
"watch": "node build.js watch",
Expand All @@ -14,4 +15,4 @@
"devDependencies": {
"eslint": "^8.2.0"
}
}
}
82 changes: 77 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b378ecc

Please sign in to comment.