Skip to content

Commit

Permalink
Add script comment, remove amd and cjs support
Browse files Browse the repository at this point in the history
  • Loading branch information
marisst committed Dec 19, 2024
1 parent 7fed94b commit 19a23a8
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions scripts/dist-all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# This script must be run from npm, via `npm run dist`, in order to access the `uglifyjs` command
# This script must be run from `npm run dist` in order to access `node` and `uglifyjs` commands
# Make sure you have the permissions to execute the file with `chmod +x scripts/dist-all.sh`
set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
Expand All @@ -25,22 +26,8 @@ for dir in $SCRIPT_DIR/../src/*; do
# Generate gzipped script
gzip -9 -k -f dist/$EXTENSION_NAME.min.js > dist/$EXTENSION_NAME.min.js.gz

# Generate AMD script
cat > dist/$EXTENSION_NAME.amd.js << EOF
require(['htmx'], htmx => {
$(cat $EXTENSION_SRC)
})
EOF


# Generate CJS script
cat > dist/htmx.cjs.js << EOF
const htmx = require('htmx.org');
$(cat $EXTENSION_SRC)
EOF

# Generate ESM script
cat > dist/htmx.esm.js << EOF
cat > dist/$EXTENSION_NAME.esm.js << EOF
import htmx from 'htmx.org';
$(cat $EXTENSION_SRC)
EOF
Expand Down

0 comments on commit 19a23a8

Please sign in to comment.