mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-26 20:40:41 +00:00

* Generate .d.ts file in build script Resolves: #2629 * Streamline configuration options Delete the JSConfig so we don't have to un-specify options when checking vs generating (and also to remove a config file). Steamline the options by re-using the NPM commands. * Remove type generating from dev script
38 lines
663 B
Bash
Executable File
38 lines
663 B
Bash
Executable File
#!/bin/bash
|
|
# This script is intended to be run from npm, via `npm run dist`
|
|
set -euo pipefail
|
|
|
|
HTMX_SRC="src/htmx.js"
|
|
|
|
# Clean the dist directory
|
|
rm -rf dist/*
|
|
|
|
# Regular IIFE script
|
|
cp $HTMX_SRC dist/htmx.js
|
|
|
|
# Generate minified script
|
|
uglifyjs -m eval -o dist/htmx.min.js dist/htmx.js
|
|
|
|
# Generate gzipped script
|
|
gzip -9 -k -f dist/htmx.min.js > dist/htmx.min.js.gz
|
|
|
|
# Generate AMD script
|
|
cat > dist/htmx.amd.js << EOF
|
|
define(() => {
|
|
$(cat $HTMX_SRC)
|
|
return htmx
|
|
})
|
|
EOF
|
|
|
|
# Generate CJS script
|
|
cat > dist/htmx.cjs.js << EOF
|
|
$(cat $HTMX_SRC)
|
|
module.exports = htmx;
|
|
EOF
|
|
|
|
# Generate ESM script
|
|
cat > dist/htmx.esm.js << EOF
|
|
$(cat $HTMX_SRC)
|
|
export default htmx
|
|
EOF
|