-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from thismatters/spruce-up
Better handling of CSS
- Loading branch information
Showing
65 changed files
with
2,702 additions
and
77 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
cache: pip | ||
cache-dependency-path: | | ||
setup.py | ||
tox.ini | ||
- name: Install pypa/build | ||
run: >- | ||
python3 -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-pypi: | ||
name: >- | ||
Publish Python 🐍 distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: release | ||
url: https://pypi.org/p/django-svelte | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
name: >- | ||
Sign the Python 🐍 distribution 📦 with Sigstore | ||
and upload them to GitHub Release | ||
needs: | ||
- publish-to-pypi | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/gh-action-sigstore-python@v1.2.3 | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "" | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' | ||
# publish-to-testpypi: | ||
# name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
# needs: | ||
# - build | ||
# runs-on: ubuntu-latest | ||
|
||
# environment: | ||
# name: testpypi | ||
# url: https://test.pypi.org/p/django-svelte | ||
|
||
# permissions: | ||
# id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
# steps: | ||
# - name: Download all the dists | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
# - name: Publish distribution 📦 to TestPyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# repository-url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Test | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
cache-dependency-path: | | ||
setup.py | ||
tox.ini | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh-actions | ||
- name: Test with tox | ||
run: tox -v | ||
- name: Upload coverage | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
name: Python ${{ matrix.python-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
**/__pycache__/* | ||
**/node_modules/* | ||
*.pyc | ||
*.sqlite3 | ||
*.log | ||
*.final | ||
*.egg-info/* | ||
|
||
.coverage | ||
coverage.xml | ||
.tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changelog | ||
|
||
## Version 0.2.0 | ||
### Added | ||
* This changelog! | ||
* Demo project into this package illustrating working Svelte 4 deployment. | ||
* Unittests! | ||
* Setting `DJANGO_SVELTE_VITE_MANIFEST_PATH` which locates the Vite build manifest so that hashed files can be looked up. | ||
* Setting `DJANGO_SVELTE_ENTRYPOINT_PREFIX` with default (`src/`) to indicate the directory of the Svelte entrypoint files (formerly referred to like `main-<componentname>.js`, now format like `<ComponentName>.js` is preferred) | ||
* Setting `DJANGO_SVELTE_VITE_ASSETSDIR` with default (`assets/`) to indicate the directory where Vite will output the various bundles for reference. | ||
* Support for looking up hashed file names from the Vite manifest. | ||
### Changed | ||
* Handling of CSS to dedicated templatetag which can appropriately be invoked in the `head` of the template. | ||
* Documentation to speak more directly to handling CSS in the two most common use cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
TEST_PATH = "" | ||
|
||
migrations: | ||
cd demo_project/django_svelte_demo && python manage.py makemigrations | ||
init: | ||
cd demo_project/django_svelte_demo && python manage.py migrate | ||
run: | ||
cd demo_project/django_svelte_demo && python manage.py runserver 0.0.0.0:8000 | ||
lint: | ||
black django_svelte | ||
isort django_svelte | ||
cd django_svelte && pflake8 | ||
test: | ||
DJANGO_SETTINGS_MODULE=django_svelte_demo.settings.test pytest --cov=django_svelte --cov-report term-missing tests/$(TEST_PATH) |
Oops, something went wrong.