diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..47422e09 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,23 @@ +on: + pull_request: + push: + branches: [main] + schedule: + - cron: '30 8 * * *' + +permissions: + contents: write + +jobs: + pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: pip install virtualenv + - run: make + - run: make push + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 7b46b5f5..8658b840 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,4 @@ *.html -*.iml -*.swp -.DS_Store -.idea -.project -.pydevproject -/all-hooks.json -/bower_components +*.pyc /build -/nenv -/venv +/node_modules diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 43dff1ff..715ec127 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,19 +1,43 @@ -- repo: git@github.com:pre-commit/mirrors-scss-lint - sha: f840ac610d8d9d76b666062416241f2156b3f388 - hooks: - - id: scss-lint - language_version: 1.9.3-p547 -- repo: git@github.com:pre-commit/pre-commit-hooks - sha: 97b88d9610bcc03982ddac33caba98bb2b751f5f +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - - id: autopep8-wrapper - id: check-yaml - id: debug-statements - - id: flake8 -- repo: https://github.com/asottile/reorder_python_imports.git - sha: 50e0be95e292cac913cc3c6fd44b3d6b51d104c5 + - id: double-quote-string-fixer + - id: name-tests-test + - id: requirements-txt-fixer +- repo: https://github.com/asottile/reorder-python-imports + rev: v3.16.0 hooks: - id: reorder-python-imports - language_version: python2.7 + args: [--py310-plus, --add-import, 'from __future__ import annotations'] + - id: reorder-python-imports +- repo: https://github.com/asottile/add-trailing-comma + rev: v4.0.0 + hooks: + - id: add-trailing-comma +- repo: https://github.com/asottile/pyupgrade + rev: v3.21.2 + hooks: + - id: pyupgrade + args: [--py310-plus] +- repo: https://github.com/hhatto/autopep8 + rev: v2.3.2 + hooks: + - id: autopep8 +- repo: https://github.com/PyCQA/flake8 + rev: 7.3.0 + hooks: + - id: flake8 +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.20.1 + hooks: + - id: mypy +- repo: https://github.com/biomejs/pre-commit + rev: v2.4.11 + hooks: + - id: biome-check + additional_dependencies: ["@biomejs/biome@1.8.1"] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 58f669a1..00000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: python -python: - - "2.7" -script: make -branches: - except: - - master -env: - global: - - GH_REF: github.com/pre-commit/pre-commit.github.io.git - # GH_TOKEN - - secure: nNgNYmtwXquPRuAFi/6kXOVjSYroglxuIjvZHDun5eCYikV1KgvXM1Q9Yh3CWgNmIWG1LKt76nt/5u4tLleJiZ7AbjcmLMb9dw7679jFNaDd14tIGyWyYBzrqfqxnayTNLclcfp59l0Yi3ag1i7z4J94LM+7tp8D4jr7RyLd++I= -after_success: - - bash push_to_gh.sh -sudo: false -cache: - directories: - - $HOME/.cache/pip diff --git a/Makefile b/Makefile index 7d0785ac..81533eda 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,34 @@ -# To build scss continuously I use `watch -n 0.1 make build/main.css` - -all: install-hooks build/main.css all-hooks.json index.html hooks.html +all: install-hooks build/main_bs5.css index.html hooks.html .PHONY: install-hooks install-hooks: venv venv/bin/pre-commit install -build/main.css: nenv build scss/main.scss scss/_variables.scss - venv/bin/sassc -s compressed scss/main.scss build/main.css - -all-hooks.json: venv make_all_hooks.py all-repos.yaml - venv/bin/python make_all_hooks.py +build/main_bs5.css: node_modules build scss/main_bs5.scss scss/_variables.scss + node_modules/.bin/sass --style=compressed --load-path=. scss/main_bs5.scss build/main_bs5.css -index.html hooks.html: venv all-hooks.json base.mako index.mako hooks.mako make_templates.py +index.html hooks.html: venv base.mako index.mako hooks.mako make_templates.py template_lib.py sections/*.md venv/bin/python make_templates.py -venv: requirements-dev.txt +venv: requirements-dev.txt Makefile rm -rf venv - virtualenv venv + virtualenv venv -ppython3 venv/bin/pip install -r requirements-dev.txt -nenv: venv - rm -rf nenv - venv/bin/nodeenv nenv --prebuilt && \ - . nenv/bin/activate && \ - npm install -g bower && \ - bower install +node_modules: package.json + ( \ + npm install && \ + npm prune && \ + touch $@ \ + ) || touch $@ --reference $^ --date '1 day ago' + +push: venv + venv/bin/markdown-to-presentation push \ + .nojekyll README.md CNAME \ + build assets *.html *.png *.svg favicon.ico clean: - rm -rf venv nenv build bower_components *.html all-hooks.json + rm -rf venv build node_modules *.html build: mkdir -p build diff --git a/README.md b/README.md index 27365bc1..c311257b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -pre-commit.github.io -==================== +pre-commit.com +============== -[](https://travis-ci.org/pre-commit/pre-commit.github.io) +[](https://results.pre-commit.ci/latest/github/pre-commit/pre-commit.com/main) +[](https://github.com/pre-commit/pre-commit.com/actions) -This powers http://pre-commit.com +This powers https://pre-commit.com diff --git a/all-repos.yaml b/all-repos.yaml deleted file mode 100644 index b54712e3..00000000 --- a/all-repos.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# This file is used to generate all-hooks.json -- git://github.com/pre-commit/pre-commit-hooks -- git://github.com/pre-commit/mirrors-autopep8 -- git://github.com/pre-commit/mirrors-coffeelint -- git://github.com/pre-commit/mirrors-csslint -- git://github.com/pre-commit/mirrors-eslint -- git://github.com/pre-commit/mirrors-fixmyjs -- git://github.com/pre-commit/mirrors-jshint -- git://github.com/pre-commit/mirrors-puppet-lint -- git://github.com/pre-commit/mirrors-pylint -- git://github.com/pre-commit/mirrors-ruby-lint -- git://github.com/pre-commit/mirrors-scss-lint -- git://github.com/pre-commit/mirrors-yapf -- git://github.com/FalconSocial/pre-commit-mirrors-pep257 -- git://github.com/FalconSocial/pre-commit-python-sorter -- git://github.com/guykisel/pre-commit-robotframework-tidy -- git://github.com/guykisel/prospector-mirror -- git://github.com/asottile/reorder_python_imports -- git://github.com/asottile/cheetah_lint -- git://github.com/hootsuite/pre-commit-php -- git://github.com/pricematch/mirrors-rubocop -- git://github.com/pricematch/mirrors-closure-linter -- git://github.com/pricematch/pricematch-pre-commit-hooks -- git://github.com/elidupuis/mirrors-jscs -- git://github.com/elidupuis/mirrors-standard -- git://github.com/Lucas-C/pre-commit-hooks -- https://bitbucket.org/SamWhited/go-pre-commit.git -- git://github.com/chriskuehl/puppet-pre-commit-hooks -- git://github.com/dnephin/pre-commit-golang -- git://github.com/jordant/rubocop-pre-commit-hook diff --git a/assets/copy-icon.svg b/assets/copy-icon.svg new file mode 100644 index 00000000..16819e06 --- /dev/null +++ b/assets/copy-icon.svg @@ -0,0 +1 @@ + diff --git a/assets/copyable.js b/assets/copyable.js new file mode 100644 index 00000000..7d18e25b --- /dev/null +++ b/assets/copyable.js @@ -0,0 +1,27 @@ +'use strict'; + +(() => { + function copyTextToClipboard(text) { + const textArea = document.createElement('textarea'); + textArea.value = text; + textArea.style.position = 'fixed'; + textArea.style.left = '-1'; + textArea.style.top = '-1'; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + document.execCommand('copy'); + document.body.removeChild(textArea); + } + for (const block of document.getElementsByClassName('copyable')) { + const copyIcon = new Image(16, 16); + copyIcon.setAttribute('src', './assets/copy-icon.svg'); + copyIcon.setAttribute('alt', 'copy'); + copyIcon.setAttribute('title', 'copy to clipboard'); + block.insertBefore(copyIcon, block.children[0]); + copyIcon.addEventListener('click', () => { + const text = block.getElementsByTagName('pre')[0].innerText; + copyTextToClipboard(text); + }); + } +})(); diff --git a/base.mako b/base.mako index f4a85345..77ba61f4 100644 --- a/base.mako +++ b/base.mako @@ -2,76 +2,94 @@
- - - - - -