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

Add pre-commit hooks - resolves #77 #78

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
};
14 changes: 6 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: Node.js CI

on:
push:
branches: [master]
pull_request:
branches: [master]
on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}

strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]
node-version: [16.x, 17.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm ci
- run: npm run eslint
- run: npm run build
- run: npm test
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run pretty
npm run eslint
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VERSION=16.9.1-buster
ARG VERSION=16.13-buster-slim
FROM node:${VERSION}
ENV NODE_ENV production
ENV BOT_TOKEN=""
Expand All @@ -7,14 +7,12 @@ WORKDIR /opt/cerealbot

RUN useradd -ms /bin/bash cerealbot && \
apt-get update -y && \
apt-get install ffmpeg -y && \
apt-get install ffmpeg libc6 -y && \
rm -rf /var/lib/apt/lists/*

COPY . /opt/cerealbot
COPY --chown=cerealbot:cerealbot . /opt/cerealbot

RUN npm install --only=production

RUN chown -R cerealbot /opt/cerealbot
RUN npm install --only=production --ignore-scripts

USER cerealbot

Expand Down
Loading