Allow multiple webpacked targets per package

This commit is contained in:
Tony Garnock-Jones 2018-11-21 14:22:31 +00:00
parent 04403f1cb3
commit 6f2d731867
6 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet">
<script src="dist/main.js"></script>
<script src="dist/chat.js"></script>
</head>
<body>
<section>

View File

@ -2,7 +2,10 @@ cd "$(dirname "$1")"
case "$1" in
*/all)
for d in src/*.js; do [ -f "$d" ] && echo lib/$(basename "$d"); done | xargs redo-ifchange
[ -f webpack.config.js ] && redo-ifchange dist/main.js
for d in *.webpack.config.js
do
[ -f "$d" ] && echo dist/$(basename "$d" .webpack.config.js).js
done | xargs redo-ifchange
[ -f _all.do ] && redo-ifchange _all || true
;;
*/clean)

View File

@ -1,4 +1,4 @@
# To be invoked with PACKAGENAME/lib/FOO.js or PACKAGENAME/dist/main.js
# To be invoked with PACKAGENAME/lib/FOO.js or PACKAGENAME/dist/FOO.js
targettempfile="$(pwd)/$3"
mkdir -p "$(dirname "$1")"
cd "$(dirname "$1")"/..
@ -21,9 +21,9 @@ case "$1" in
npx syndicate-babel "src/$file"
;;
*/dist/*)
for d in src/*.js; do echo lib/$(basename $d); done | xargs redo-ifchange
redo-ifchange webpack.config.js
for maybedep in $(npx webpack --json -o "$targettempfile" | jq -r '.modules[].identifier')
configfile=$(basename "$1" .js).webpack.config.js
redo-ifchange $configfile
for maybedep in $(npx webpack --config "$configfile" --json -o "$targettempfile" | jq -r '.modules[].identifier')
do
[ -f "$maybedep" ] && echo "$maybedep"
done | xargs redo-ifchange