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

View file

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

4
.gitignore vendored
View file

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

16
bw-dev
View file

@ -35,7 +35,7 @@ function initdb {
} }
function makeitblack { function makeitblack {
runweb black celerywyrm bookwyrm docker-compose run --rm dev-tools black celerywyrm bookwyrm
} }
function awscommand { function awscommand {
@ -97,7 +97,7 @@ case "$CMD" in
docker-compose restart celery_worker docker-compose restart celery_worker
;; ;;
pytest) pytest)
execweb pytest --no-cov-on-fail "$@" runweb pytest --no-cov-on-fail "$@"
;; ;;
collectstatic) collectstatic)
runweb python manage.py collectstatic --no-input runweb python manage.py collectstatic --no-input
@ -135,15 +135,17 @@ case "$CMD" in
makeitblack makeitblack
;; ;;
prettier) prettier)
npx prettier --write bookwyrm/static/js/*.js docker-compose run --rm dev-tools npx prettier --write bookwyrm/static/js/*.js
;; ;;
stylelint) 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) formatters)
makeitblack docker-compose run --rm dev-tools black celerywyrm bookwyrm && \
npx prettier --write bookwyrm/static/js/*.js npx prettier --write bookwyrm/static/js/*.js && \
npx stylelint bookwyrm/static/**/*.css --fix npx stylelint bookwyrm/static/css/*.css --fix --config dev-tools/.stylelintrc.js
;; ;;
update) update)
git pull 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": { "devDependencies": {
"eslint": "^8.9.0", "eslint": "^8.9.0",
"prettier": "2.5.1", "prettier": "2.5.1",
"stylelint": "^14.2.0", "stylelint": "^14.5.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-order": "^5.0.0",
"watch": "^0.13.0" "watch": "^0.13.0"
}, },
"dependencies": { "dependencies": {
"merge": "2.1.1", "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 - db
- redis_broker - redis_broker
restart: on-failure restart: on-failure
dev-tools:
build: dev-tools
env_file: .env
volumes:
- .:/app
volumes: volumes:
pgdata: pgdata:
static_volume: static_volume:

View file

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

1538
yarn.lock

File diff suppressed because it is too large Load diff