Skip to content

Commit 091239e

Browse files
authored
fix: Source maps and djangocms-text-ckeditor plugin migration (#16)
1 parent 0affa2c commit 091239e

File tree

6 files changed

+61
-17
lines changed

6 files changed

+61
-17
lines changed

CHANGELOG.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
Changelog
33
=========
44

5-
0.2.1 (20-08-2024)
6-
==================
5+
0.2.2 / 0.2.1 (20-08-2024)
6+
==========================
77

8+
* fix: Let the migration only convert djangocms-text-ckeditor plugins if a corresponding table exists in the database
9+
* fix: Let webpack import js map files from node libraries to remove references to non-existing map files in the js bundles
810
* fix: Unnecessary call to `static` in widget Media class made djangocms-text fail with manifest file storages
911

1012
0.2.0 (24-07-2024)

djangocms_text/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
9. Publish the release when ready
1616
10. Github actions will publish the new package to pypi
1717
"""
18-
__version__ = "0.2.1"
18+
__version__ = "0.2.2"

djangocms_text/migrations/0003_auto_20240702_1409.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by Django 3.2.25 on 2024-07-02 14:09
22

3-
from django.db import migrations, models, OperationalError
3+
from django.db import migrations, models
44

55

66
def migrate_text_ckeditor_fields(apps, schema_editor):
@@ -20,17 +20,13 @@ class Meta:
2020
json = models.JSONField(blank=True, null=True)
2121
rte = models.CharField(max_length=16, blank=True)
2222

23-
try:
23+
if CKEditorText._meta.db_table in schema_editor.connection.introspection.table_names():
2424
existing_texts = Text_Text.objects.all().values_list("cmsplugin_ptr_id", flat=True)
2525
qs = CKEditorText.objects.using(schema_editor.connection.alias).exclude(cmsplugin_ptr_id__in=existing_texts)
2626
Text_Text.objects.using(schema_editor.connection.alias).bulk_create(
2727
Text_Text(body=ckeditor_text.body, rte="text_ckeditor4", cmsplugin_ptr_id=ckeditor_text.cmsplugin_ptr_id)
2828
for ckeditor_text in qs
2929
)
30-
except OperationalError as e:
31-
if "no such table" in str(e):
32-
return
33-
raise e
3430

3531

3632
class Migration(migrations.Migration):
@@ -42,5 +38,6 @@ class Migration(migrations.Migration):
4238
operations = [
4339
migrations.RunPython(
4440
code=migrate_text_ckeditor_fields,
41+
reverse_code=migrations.RunPython.noop,
4542
)
4643
]

package-lock.json

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

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"sass": "^1.72.0",
3030
"sass-loader": "^14.1.1",
3131
"slim-select": "^2.8.2",
32+
"source-map-loader": "^5.0.0",
3233
"style-loader": "^3.3.4",
3334
"webpack": "^5.90.3",
3435
"webpack-cli": "^5.1.4"

webpack.config.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ module.exports = {
7878
{
7979
test: /\.(s[ac]ss)$/i,
8080
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
81-
},
81+
},
82+
{
83+
test: /\.js$/,
84+
enforce: "pre",
85+
use: ["source-map-loader"],
86+
},
8287

8388
// {
8489
// test: /\.js$/,

0 commit comments

Comments
 (0)