Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: jestによるテストができるように。誕生日コマンドの挙動を改善 #309

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ignores": [
"@types/node",
"run-z",
"@types/jest",
"typescript-json-schema"
]
}
10 changes: 4 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
},
"git.branchProtection": ["main", "master"],
"editor.formatOnSave": true
},
"vscode": {
"extensions": [
"esbenp.prettier-vscode"
]
}
},
"vscode": {
"extensions": ["esbenp.prettier-vscode"]
}
}
}
4 changes: 4 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ plugins:
rules:
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/ban-ts-comment': off
'@typescript-eslint/no-floating-promises':
- error
- { ignoreIIFE: true }
'unicorn/prefer-top-level-await': off
'unicorn/prevent-abbreviations': off
'unicorn/no-null': off
'no-console': error
15 changes: 15 additions & 0 deletions .github/workflows/add-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Auto add reviewer

on:
pull_request_target:
types:
- opened
- reopened
branches:
- main
- master

jobs:
add-reviewer:
name: Add reviewer
uses: book000/templates/.github/workflows/reusable-add-reviewer.yml@master
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ jobs:
secrets:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

18 changes: 18 additions & 0 deletions .github/workflows/nodejs-ci-pnpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Node.js でビルド・テストを実行する。バージョンは .node-version に記載されているものを利用する

name: Node CI

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
node-ci:
name: Node CI
uses: book000/templates/.github/workflows/reusable-nodejs-ci-pnpm.yml@master
60 changes: 0 additions & 60 deletions .github/workflows/nodejs-ci.yml

This file was deleted.

14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
FROM node:18-alpine

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME/bin:$PATH"

# hadolint ignore=DL3018
RUN apk update && \
apk upgrade && \
apk add --update --no-cache curl tzdata && \
apk add --update --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
echo "Asia/Tokyo" > /etc/timezone && \
apk del tzdata && \
curl -f https://get.pnpm.io/v6.32.js | \
node - add --global pnpm
corepack enable

WORKDIR /app

COPY pnpm-lock.yaml ./

RUN pnpm fetch
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm fetch

COPY package.json tsconfig.json ./
COPY src src

RUN pnpm install --frozen-lockfile --offline
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --offline

ENV NODE_ENV production
ENV CONFIG_PATH /data/config.json
Expand All @@ -30,4 +30,4 @@ ENV LOG_DIR /data/logs

VOLUME [ "/data" ]

ENTRYPOINT [ "pnpm", "start" ]
ENTRYPOINT [ "pnpm", "start" ]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Tomachi
Copyright (c) 2024 jao Community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
64 changes: 45 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
{
"name": "jaotan.ts",
"version": "0.0.0",
"description": "jaotan.ts",
"description": "jao Gamers Club Official Discord Bot for TypeScript",
"homepage": "https://github.com/jaoafa/jaotan.ts",
"bugs": {
"url": "https://github.com/jaoafa/jaotan.ts/issues"
},
"license": "MIT",
"author": "jao Community",
"private": true,
"main": "dist/main.js",
"repository": "[email protected]:jaoafa/jaotan.ts.git",
"repository": {
"type": "git",
"url": "[email protected]:jaoafa/jaotan.ts.git"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"clean": "rimraf dist output",
"compile": "tsc -p .",
"dev": "tsx watch ./src/main.ts",
"fix": "run-s fix:prettier fix:eslint",
"fix:eslint": "eslint . --ext ts,tsx --fix",
"fix:prettier": "prettier --write src",
"lint": "run-p -c lint:prettier lint:eslint lint:tsc",
"lint:eslint": "eslint . --ext ts,tsx",
"lint:prettier": "prettier --check src",
"lint:eslint": "eslint . --ext ts,tsx",
"start": "tsx ./src/main.ts",
"lint:tsc": "tsc",
"start": "tsx ./src/main.ts"
"fix": "run-z fix:prettier fix:eslint",
"fix:eslint": "eslint . --ext ts,tsx --fix",
"test": "jest --runInBand --passWithNoTests --detectOpenHandles --forceExit",
"fix:prettier": "prettier --write src",
"lint": "run-z lint:prettier,lint:eslint,lint:tsc",
"generate-schema": "typescript-json-schema --required src/config.ts ConfigInterface -o schema/Configuration.json"
},
"devDependencies": {
"@book000/node-utils": "1.12.14",
"@types/node": "20.8.7",
"@types/jest": "29.5.11",
"@types/node": "20.10.6",
"@types/node-cron": "3.0.11",
"@typescript-eslint/eslint-plugin": "6.17.0",
"@typescript-eslint/parser": "6.17.0",
Expand All @@ -38,16 +46,34 @@
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-unicorn": "50.0.1",
"node-cron": "3.0.3",
"jest": "29.7.0",
"jest-expect-message": "1.1.3",
"prettier": "3.1.1",
"run-z": "2.0.0",
"ts-jest": "29.1.1",
"tsx": "4.7.0",
"typescript": "5.3.3",
"yarn-run-all": "3.1.1"
},
"engines": {
"node": ">=18"
"typescript-json-schema": "0.62.0"
},
"volta": {
"node": "18.19.0"
"jest": {
"moduleFileExtensions": [
"js",
"ts"
],
"testMatch": [
"**/*.test.ts"
],
"transform": {
"^.+\\.ts$": [
"ts-jest",
{
"tsconfig": "tsconfig.json"
}
]
},
"setupFilesAfterEnv": [
"jest-expect-message"
]
},
"packageManager": "[email protected]"
}
}
Loading