Skip to content

Commit 97e3ad5

Browse files
committed
minimizing JS is done by esbuild
1 parent 636f08a commit 97e3ad5

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
- name: Build Client
3535
run: |
3636
npm run build
37-
npm run minify
3837
- name: Patch templates
3938
run: |
4039
mkdir -p adminsortable2/templates/adminsortable2/edit_inline

.github/workflows/tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
- name: Build Client
4646
run: |
4747
npm run build
48-
npm run minify
4948
- name: Patch templates
5049
run: |
5150
mkdir -p adminsortable2/templates/adminsortable2/edit_inline

client/build.cjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
const { build } = require('esbuild');
2+
const buildOptions = require('yargs-parser')(process.argv.slice(2), {
3+
boolean: ['debug'],
4+
});
25

36
build({
47
entryPoints: ['client/admin-sortable2.ts'],
58
bundle: true,
6-
minify: false,
7-
outfile: 'adminsortable2/static/adminsortable2/js/adminsortable2.js',
9+
minify: !buildOptions.debug,
10+
sourcemap: buildOptions.debug,
11+
outfile: 'adminsortable2/static/adminsortable2/js/adminsortable2' + (buildOptions.debug ? '' : '.min') + '.js',
812
plugins: [],
9-
sourcemap: false,
1013
target: ['es2020', 'chrome84', 'firefox84', 'safari14', 'edge84']
1114
}).catch(() => process.exit(1));

docs/source/contributing.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@ Writing Code
1919
Before hacking into the code, adopt your IDE to respect the projects's `.editorconfig`_ file.
2020

2121
When installing from GitHub, you *must* build the JavaScript client using the esbuild_ TypeScript
22-
compiler:
22+
compiler. Ensure that you have a recent version of NodeJS (18+) installed. Then run the following
23+
commands:
2324

2425
.. code-block:: shell
2526
2627
git clone https://github.com/jrief/django-admin-sortable2.git
2728
cd django-admin-sortable2
28-
npm install --also=dev
29+
npm install --include=dev
2930
npm run build
3031
31-
# and optionally for a minimized version
32-
npm run minify
32+
# for an unminimized version including a sourcemap, run
33+
npm run build -- --debug
3334
3435
This then builds and bundles the JavaScript file
35-
``adminsortable2/static/adminsortable2/js/adminsortable2.js`` which later on is imported by the
36-
sortable-admin mixin classes. The minimized version can be imported as
37-
``adminsortable2/static/adminsortable2/js/adminsortable2.min.js``
36+
``adminsortable2/static/adminsortable2/js/adminsortable2.min.js`` which later on is imported by the
37+
sortable-admin mixin classes. The unminimized version can be imported as
38+
``adminsortable2/static/adminsortable2/js/adminsortable2.js``
3839

3940
.. _.editorconfig: https://editorconfig.org/
4041
.. _esbuild: https://esbuild.github.io/

0 commit comments

Comments
 (0)