Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit c4ad57a

Browse files
myan9starpit
authored andcommitted
feat: use webpack to build html template
Fixes #3544
1 parent 360280e commit c4ad57a

File tree

17 files changed

+98
-462
lines changed

17 files changed

+98
-462
lines changed

bin/watch-webpack.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export CLIENT=${CLIENT-default}
1414
CLIENT_DEFN_PLUGIN=`cat clients/"$CLIENT"/package.json | jq --raw-output .kui.client`
1515
THEME=$(cd node_modules/@kui-shell/client && pwd)
1616

17-
# rebuild the html in case the user has changed CLIENT
18-
npm run build:html
19-
2017
# rebuild the node-pty native code, in case the user is switching from
2118
# electron to webpack (each of which may use a different node ABI)
2219
if [ "$TARGET" = "electron-renderer" ]; then
@@ -51,10 +48,6 @@ mkdir -p clients/$CLIENT/$TARGETDIR/css
5148
for i in "$THEME"/css/*; do ln -sf $i; done \
5249
)
5350

54-
# link in any config.json settings that the CLIENT definition may specify
55-
(cd node_modules/@kui-shell/settings && \
56-
rm -f config-dev.json; if [ -f "$THEME"/config.d/config.json ]; then echo "linking config-dev.json"; cp "$THEME"/config.d/config.json config-dev.json; fi)
57-
5851
# display extra build progress?
5952
if [ -z "$TRAVIS_JOB_ID" ]; then
6053
PROGRESS="--progress"

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test3": "PORT_OFFSET=2 npm run testv2",
1414
"test4": "PORT_OFFSET=3 npm run testv2",
1515
"kill": "kill $(lsof -t -i:908${PORT_OFFSET-0}) > /dev/null 2> /dev/null || true",
16-
"watch:webpack": "npm run compile:prescan && npm run kill; ./bin/watch-webpack.sh",
16+
"watch:webpack": "npm run compile:prescan && npm run link && npm run kill; ./bin/watch-webpack.sh",
1717
"watch:electron": "TARGET=electron-renderer npm run watch:webpack",
1818
"proxy": "npm run pty:nodejs && cd packages/proxy/app && npm install && PORT=8081 KUI_USE_HTTP=true ../../../tools/travis/proxy.sh ..",
1919
"watch": "tsc --build . --watch",
@@ -32,8 +32,8 @@
3232
"pty:rebuild": "kui-pty-rebuild",
3333
"pty:electron": "npm run pty:rebuild electron",
3434
"pty:nodejs": "npm run pty:rebuild node",
35-
"build:html": "CLIENT=${CLIENT-default}; rm -f node_modules/@kui-shell/settings/config-dev.json; npm run pty:electron && CLIENT_HOME=\"$(cd ./clients/$CLIENT && pwd)\" node packages/builder/lib/configure.js && CLIENT_HOME=\"$(cd ./clients/$CLIENT && pwd)\" ./packages/builder/dist/dev/build.sh && CLIENT_HOME=\"$(cd ./clients/$CLIENT && pwd)\" ./packages/builder/bin/seticon.js",
36-
"postinstall": "npm run build:html && npm run compile",
35+
"link": "CLIENT=${CLIENT-default}; CLIENT_HOME=\"$(cd ./clients/$CLIENT && pwd)\" ./packages/builder/dist/dev/build.sh; CLIENT=${CLIENT-default}; CLIENT_HOME=\"$(cd ./clients/$CLIENT && pwd)\" ./packages/builder/bin/seticon.js",
36+
"postinstall": "npm run compile",
3737
"open": "electron . shell",
3838
"start": "npm run watch:electron && npm run open"
3939
},

packages/builder/bin/compile.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ else
5151
npx tsc -b ${1-.}
5252
fi
5353

54-
# initialize the html bits
55-
CLIENT_HOME="$CLIENT_HOME" KUI_STAGE="$CLIENT_HOME" node node_modules/@kui-shell/builder/lib/configure.js
54+
if [ ! -d node_modules/@kui-shell/build ]; then
55+
mkdir -p node_modules/@kui-shell/build
56+
fi
5657

5758
# link in the theme bits
5859
(cd node_modules/@kui-shell/build && rm -rf css && mkdir css && cd css && for i in ../../../../node_modules/@kui-shell/core/web/css/*; do ln -sf $i; done && for i in ../../client/css/*; do ln -sf $i; done)

packages/builder/bin/seticon.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
2020
TOPDIR="${SCRIPTDIR}/../../.."
21-
CONFDIR="$TOPDIR"/node_modules/@kui-shell/settings
2221
THEME="${TOPDIR}"/node_modules/@kui-shell/client
2322

2423
echo "Using CLIENT_HOME=$CLIENT_HOME"

packages/builder/dist/dev/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ TOPDIR="${SCRIPTDIR}/../../../.."
2121
STAGING="${TOPDIR}"/node_modules/@kui-shell/build
2222
THEME="${TOPDIR}"/node_modules/@kui-shell/client
2323

24+
if [ ! -d "$STAGING" ]; then
25+
mkdir -p "$STAGING"
26+
fi
27+
2428
(cd "$STAGING" && rm -f css && ln -s "$TOPDIR"/packages/core/web/css)
2529

2630
if [ -d "$THEME"/icons ]; then

packages/builder/dist/electron/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ function tarCopy {
112112

113113
# TODO share this with headless/build.sh, as they are identical
114114
function configure {
115-
CLIENT_HOME="$CLIENT_HOME" KUI_STAGE="$STAGING" node "$BUILDER_HOME"/lib/configure.js
116115
UGLIFY=true npx --no-install kui-prescan
117116
}
118117

packages/builder/dist/headless/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ function tarCopy {
157157

158158
function configure {
159159
UGLIFY=true npx --no-install kui-prescan
160-
CLIENT_HOME=$CLIENT_HOME KUI_STAGE="$STAGING"/kui node "$BUILDER_HOME"/lib/configure.js
161160
echo "nothing to do"
162161
}
163162

packages/builder/lib/configure.js

Lines changed: 0 additions & 269 deletions
This file was deleted.

packages/builder/lib/module-exists.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)