Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
chore(build): add source map support (#654)
Browse files Browse the repository at this point in the history
* chore(build): add source map support

this creates two new files:

```
//# sourceMappingURL=algoliasearch.helper.js.map
//# sourceMappingURL=dist/algoliasearch.helper.min.js.map
```

- add exorcist for having the source map via browserify (otherwise only inline)
- add appropriate options for uglifyJS

Further nothing is changed. This setup is compatible with `source-map-explorer`

IFW-622

* chore(build): more readable commands

* pin

* Update scripts/build.sh

Co-Authored-By: Haroenv <fingebimus@me.com>
  • Loading branch information
Haroenv committed May 9, 2019
1 parent a4b328e commit 4372889
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"eslint": "1.10.3",
"eslint-config-airbnb": "0.0.8",
"eslint-config-algolia": "3.0.0",
"exorcist": "1.0.1",
"gh-pages": "1.0.0",
"gulp": "3.9.1",
"gulp-cli": "1.3.0",
Expand Down
14 changes: 11 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ bundle='algoliasearch.helper'

echo "Build"

browserify index.js -s algoliasearchHelper -o dist/algoliasearch.helper.js
browserify index.js \
--standalone algoliasearchHelper \
--debug | \
exorcist dist/algoliasearch.helper.js.map > dist/algoliasearch.helper.js

echo "..Minify"

uglifyjs dist/algoliasearch.helper.js --mangle --compress=warnings=false > dist/algoliasearch.helper.min.js
uglifyjs dist/algoliasearch.helper.js \
--mangle \
--compress=warnings=false \
--in-source-map "dist/algoliasearch.helper.js.map" \
--source-map "dist/algoliasearch.helper.min.js.map" \
--output dist/algoliasearch.helper.min.js

echo '..Gzipped file size'

echo "${bundle}.min.js gzipped will weight" $(cat dist/"${bundle}".min.js | gzip -9 | wc -c | pretty-bytes)
echo "${bundle}.min.js gzipped will weigh" $(cat dist/"${bundle}".min.js | gzip -9 | wc -c | pretty-bytes)
30 changes: 29 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4388,6 +4388,16 @@ exit@^0.1.2:
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=

exorcist@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/exorcist/-/exorcist-1.0.1.tgz#79316e3c4885845490f7bb405c0e5b5db1167c52"
integrity sha1-eTFuPEiFhFSQ97tAXA5bXbEWfFI=
dependencies:
is-stream "~1.1.0"
minimist "0.0.5"
mkdirp "~0.5.1"
mold-source-map "~0.4.0"

expand-brackets@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b"
Expand Down Expand Up @@ -6443,7 +6453,7 @@ is-retry-allowed@^1.0.0:
resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34"
integrity sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=

is-stream@^1.0.0, is-stream@^1.1.0:
is-stream@^1.0.0, is-stream@^1.1.0, is-stream@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
Expand Down Expand Up @@ -8396,6 +8406,11 @@ minimatch@~0.2.11:
lru-cache "2"
sigmund "~1.0.0"

minimist@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.5.tgz#d7aa327bcecf518f9106ac6b8f003fa3bcea8566"
integrity sha1-16oye87PUY+RBqxrjwA/o7zqhWY=

minimist@0.0.8, minimist@~0.0.1:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
Expand Down Expand Up @@ -8467,6 +8482,14 @@ module-deps@^4.0.8:
through2 "^2.0.0"
xtend "^4.0.0"

mold-source-map@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/mold-source-map/-/mold-source-map-0.4.0.tgz#cf67e0b31c47ab9badb5c9c25651862127bb8317"
integrity sha1-z2fgsxxHq5uttcnCVlGGISe7gxc=
dependencies:
convert-source-map "^1.1.0"
through "~2.2.7"

ms@0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.6.2.tgz#d89c2124c6fdc1353d65a8b77bf1aac4b193708c"
Expand Down Expand Up @@ -11828,6 +11851,11 @@ through@2, "through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8, through@~2.3, t
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=

through@~2.2.7:
version "2.2.7"
resolved "https://registry.yarnpkg.com/through/-/through-2.2.7.tgz#6e8e21200191d4eb6a99f6f010df46aa1c6eb2bd"
integrity sha1-bo4hIAGR1OtqmfbwEN9Gqhxusr0=

thunkify-wrap@~1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/thunkify-wrap/-/thunkify-wrap-1.0.4.tgz#b52be548ddfefda20e00b58c6096762b43dd6880"
Expand Down

0 comments on commit 4372889

Please sign in to comment.