Merge pull request #1941 from bookwyrm-social/dev-tools

Adds dev tools docker image
This commit is contained in:
Mouse Reeve 2022-02-16 18:05:22 -08:00 committed by GitHub
commit 839d91e4d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 1559 deletions

View file

@ -8,7 +8,7 @@ on:
- '.github/workflows/**'
- 'static/**'
- '.eslintrc'
- '.stylelintrc'
- '.stylelintrc.js'
pull_request:
branches: [ main, ci, frontend ]
@ -22,17 +22,16 @@ jobs:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
run: npm install stylelint stylelint-config-recommended stylelint-config-standard stylelint-order eslint
# See .stylelintignore for files that are not linted.
- name: Run stylelint
run: >
yarn stylelint bookwyrm/static/**/*.css \
--report-needless-disables \
--report-invalid-scope-disables
npx stylelint bookwyrm/static/css/*.css \
--config dev-tools/.stylelintrc.js
# See .eslintignore for files that are not linted.
- name: Run ESLint
run: >
yarn eslint bookwyrm/static \
npx eslint bookwyrm/static \
--ext .js,.jsx,.ts,.tsx

View file

@ -17,8 +17,7 @@ jobs:
- uses: actions/checkout@v2
- name: Install modules
run: npm install .
run: npm install prettier
# See .stylelintignore for files that are not linted.
- name: Run Prettier
run: npx prettier --check bookwyrm/static/js/*.js

4
.gitignore vendored
View file

@ -24,7 +24,9 @@
.idea
#Node tools
/node_modules/
node_modules/
package-lock.json
yarn.lock
#nginx
nginx/default.conf

16
bw-dev
View file

@ -35,7 +35,7 @@ function initdb {
}
function makeitblack {
runweb black celerywyrm bookwyrm
docker-compose run --rm dev-tools black celerywyrm bookwyrm
}
function awscommand {
@ -97,7 +97,7 @@ case "$CMD" in
docker-compose restart celery_worker
;;
pytest)
execweb pytest --no-cov-on-fail "$@"
runweb pytest --no-cov-on-fail "$@"
;;
collectstatic)
runweb python manage.py collectstatic --no-input
@ -135,15 +135,17 @@ case "$CMD" in
makeitblack
;;
prettier)
npx prettier --write bookwyrm/static/js/*.js
docker-compose run --rm dev-tools npx prettier --write bookwyrm/static/js/*.js
;;
stylelint)
npx stylelint bookwyrm/static/**/*.css --fix
docker-compose run --rm dev-tools npx stylelint \
bookwyrm/static/css/*.css --fix \
--config dev-tools/.stylelintrc.js
;;
formatters)
makeitblack
npx prettier --write bookwyrm/static/js/*.js
npx stylelint bookwyrm/static/**/*.css --fix
docker-compose run --rm dev-tools black celerywyrm bookwyrm && \
npx prettier --write bookwyrm/static/js/*.js && \
npx stylelint bookwyrm/static/css/*.css --fix --config dev-tools/.stylelintrc.js
;;
update)
git pull

14
dev-tools/Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM python:3.9
ENV PYTHONUNBUFFERED 1
RUN mkdir /app
WORKDIR /app
COPY package.json requirements.txt .stylelintrc.js .stylelintignore /app/
RUN pip install -r requirements.txt
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
RUN npm install .

View file

@ -5,13 +5,14 @@
"devDependencies": {
"eslint": "^8.9.0",
"prettier": "2.5.1",
"stylelint": "^14.2.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-order": "^5.0.0",
"stylelint": "^14.5.0",
"watch": "^0.13.0"
},
"dependencies": {
"merge": "2.1.1",
"postcss": "^8.4.6"
"postcss": "^8.4.6",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-order": "^5.0.0"
}
}

View file

@ -0,0 +1 @@
black==21.4b2

View file

@ -84,6 +84,11 @@ services:
- db
- redis_broker
restart: on-failure
dev-tools:
build: dev-tools
env_file: .env
volumes:
- .:/app
volumes:
pgdata:
static_volume:

View file

@ -25,7 +25,6 @@ opentelemetry-instrumentation-django==0.27b0
opentelemetry-instrumentation-celery==0.27b0
# Dev
black==21.4b2
pytest-django==4.1.0
pytest==6.1.2
pytest-cov==2.10.1

1538
yarn.lock

File diff suppressed because it is too large Load diff