Skip to content

Commit 21ae3ad

Browse files
Upgrade to Webpack 5 (torchbox#192)
Co-authored-by: Thibaud Colas <[email protected]>
1 parent 7018dd2 commit 21ae3ad

File tree

9 files changed

+5081
-7684
lines changed

9 files changed

+5081
-7684
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
# See https://docs.djangoproject.com/en/4.0/faq/install/#what-python-version-can-i-use-with-django for the official matrix.
2828
# Additionally test on Django’s main branch with the most recent Python version.
2929
- python: "3.7"
30-
toxenv: py37-dj22,py37-dj32
30+
toxenv: py37-dj32
3131
- python: "3.8"
32-
toxenv: py38-dj22,py38-dj32,py38-dj40,py38-dj41
32+
toxenv: py38-dj32,py38-dj40,py38-dj41
3333
- python: "3.9"
34-
toxenv: py39-dj22,py39-dj32,py39-dj40,py39-dj41
34+
toxenv: py39-dj32,py39-dj40,py39-dj41
3535
- python: "3.10"
3636
# Skip testing Django 4.0, already tested in previous workflow job.
3737
toxenv: py310-dj32,py310-dj41,py310-djmain

.github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
language: ["javascript", "python"]
2424

2525
steps:
26-
- uses: actions/checkout@v2
27-
- uses: github/codeql-action/init@v1
26+
- uses: actions/checkout@v3
27+
- uses: github/codeql-action/init@v2
2828
with:
2929
languages: ${{ matrix.language }}
30-
- uses: github/codeql-action/analyze@v1
30+
- uses: github/codeql-action/analyze@v2

docs/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ poetry add --dev django-pattern-library
1717

1818
We support:
1919

20-
- Django 2.2, 3.2, 4.0, 4.1 (experimental), 4.2 (experimental)
20+
- Django 3.2, 4.0, 4.1 (experimental), 4.2 (experimental)
2121
- Python 3.7, 3.8, 3.9, 3.10, 3.11 (experimental)
2222
- Django Templates only, no Jinja support
2323
- Modern “evergreen” desktop and mobile browsers

package-lock.json

+5,057-7,645
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"build": "webpack --mode production"
1919
},
2020
"devDependencies": {
21-
"@babel/core": "^7.11.6",
22-
"@babel/preset-env": "^7.11.5",
23-
"babel-loader": "^8.1.0",
24-
"css-loader": "^4.3.0",
25-
"sass": "^1.26.11",
26-
"sass-loader": "^10.0.2",
27-
"style-loader": "^1.2.1",
28-
"webpack": "^4.44.2",
29-
"webpack-cli": "^3.3.12"
21+
"@babel/core": "^7.17.8",
22+
"@babel/preset-env": "^7.16.11",
23+
"babel-loader": "^8.2.4",
24+
"css-loader": "^6.7.1",
25+
"sass": "^1.52.1",
26+
"sass-loader": "^12.6.0",
27+
"style-loader": "^3.3.1",
28+
"webpack": "^5.70.0",
29+
"webpack-cli": "^4.9.2"
3030
},
3131
"dependencies": {
32-
"highlight.js": "^10.2.0"
32+
"highlight.js": "^11.5.0"
3333
}
3434
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import hljs from 'highlight.js/lib/core';
2+
import django from 'highlight.js/lib/languages/django';
3+
import yaml from 'highlight.js/lib/languages/yaml';
24

35
export default function() {
4-
hljs.initHighlightingOnLoad();
5-
['django', 'yaml'].forEach((langName) => {
6-
const langModule = require(`highlight.js/lib/languages/${langName}`);
7-
hljs.registerLanguage(langName, langModule);
8-
});
6+
hljs.registerLanguage('django', django);
7+
hljs.registerLanguage('yaml', yaml);
8+
hljs.highlightAll();
99
}

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ classifiers = [
2323
"Programming Language :: Python :: 3.10",
2424
"Programming Language :: Python :: 3.11",
2525
"Framework :: Django",
26-
"Framework :: Django :: 2.2",
2726
"Framework :: Django :: 3.2",
2827
"Framework :: Django :: 4.0",
2928
"Framework :: Django :: 4.1",
@@ -45,7 +44,7 @@ exclude = [
4544

4645
[tool.poetry.dependencies]
4746
python = "^3.7"
48-
Django = ">=2.2,<4.2"
47+
Django = ">=3.2,<4.2"
4948
PyYAML = ">=5.1,<7.0"
5049
Markdown = "^3.1"
5150

tox.ini

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{37,38,39,310,311}-dj{22,32,40,41,main}, lint
2+
envlist = py{37,38,39,310,311}-dj{32,40,41,main}, lint
33
skipsdist = true
44

55
[testenv]
@@ -11,7 +11,6 @@ commands =
1111
poetry run python -X dev -W error runtests.py
1212
poetry run django-admin render_patterns --settings=tests.settings.dev --pythonpath=. --dry-run
1313
deps =
14-
dj22: Django>=2.2,<2.3
1514
dj32: Django>=3.2,<3.3
1615
dj40: Django>=4.0,<4.1
1716
; Switch to version range upon stable release.

webpack.config.js

-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
const path = require('path');
2-
const webpack = require('webpack');
3-
const sass = require('sass');
42

53
const staticDir = path.resolve(__dirname, 'pattern_library', 'static', 'pattern_library');
64

@@ -31,7 +29,6 @@ module.exports = {
3129
{
3230
loader: 'sass-loader', // compiles Sass to CSS
3331
options: {
34-
implementation: sass,
3532
sassOptions: {
3633
outputStyle: 'compressed',
3734
},
@@ -41,14 +38,4 @@ module.exports = {
4138
}
4239
]
4340
},
44-
plugins: [
45-
// Rather than import the entire contents of the
46-
// highlight lib (which includes languages we’re not using)
47-
// you can just import the languages you want to highlight,
48-
// therefore drastically reducing the bundle size
49-
new webpack.ContextReplacementPlugin(
50-
/highlight\.js\/lib\/languages$/,
51-
new RegExp(`^./(${['django', 'yaml'].join('|')})$`)
52-
)
53-
],
5441
};

0 commit comments

Comments
 (0)