Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
da84d9ef
Verified
Commit
da84d9ef
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
review optional js-bundling
parent
0c06c64b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!36
merge f-boot-tour to dev
Pipeline
#8764
passed with warnings
3 years ago
Stage: linting
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
misc/merge_js.sh
+50
-15
50 additions, 15 deletions
misc/merge_js.sh
test/core/index.html
+1
-1
1 addition, 1 deletion
test/core/index.html
with
52 additions
and
17 deletions
Makefile
+
1
−
1
View file @
da84d9ef
...
@@ -69,7 +69,7 @@ merge_xsl:
...
@@ -69,7 +69,7 @@ merge_xsl:
merge_js
:
merge_js
:
for
f
in
${
BUILDFILELIST
}
;
do
source
"
$$
f"
;
done
;
\
for
f
in
${
BUILDFILELIST
}
;
do
source
"
$$
f"
;
done
;
\
misc/merge_js.sh
$${
MODULE_DEPENDENCIES[
*
]
}
BUILD_JS_DIST_BUNDLE
=
$${
BUILD_JS_DIST_BUNDLE
}
misc/merge_js.sh
$${
MODULE_DEPENDENCIES[
*
]
}
EXCLUDE_EXPR
=
%~ %.backup
EXCLUDE_EXPR
=
%~ %.backup
BUILDFILELIST
=
$(
filter-out
$(
EXCLUDE_EXPR
)
,
$(
wildcard build.properties.d/
*
))
BUILDFILELIST
=
$(
filter-out
$(
EXCLUDE_EXPR
)
,
$(
wildcard build.properties.d/
*
))
...
...
This diff is collapsed.
Click to expand it.
misc/merge_js.sh
+
50
−
15
View file @
da84d9ef
...
@@ -33,11 +33,44 @@
...
@@ -33,11 +33,44 @@
CORE_MODULES
=
$@
CORE_MODULES
=
$@
SOURCE_DIR
=
public/js/
PUBLIC_JS_DIR
=
public/js/
TARGET
=
public/webcaosdb.dist.js
DIST_BUNDLE
=
webcaosdb.dist.js
DIST_BUNDLE_TARGET
=
public/
${
DIST_BUNDLE
}
JSHEADER_TARGET
=
public/xsl/jsheader.xsl
JSHEADER_TARGET
=
public/xsl/jsheader.xsl
ALL_SOURCES
=()
_create_jsheader
()
{
_create_jsheader
()
{
_JS_INCLUDE
=
if
[
"
$BUILD_JS_DIST_BUNDLE
"
==
"TRUE"
]
;
then
_SIZE
=
$((
$(
wc
-c
${
DIST_BUNDLE_TARGET
}
|
awk
'{print $1}'
)
/
1024
))
echo
"including
${
DIST_BUNDLE
}
(
${
_SIZE
}
kB) into
${
JSHEADER_TARGET
}
"
_JS_INCLUDE
=
"
<xsl:element name=
\"
script
\"
>
<xsl:attribute name=
\"
src
\"
>
<xsl:value-of select=
\"
concat(
\$
basepath,'webinterface/
\$
{BUILD_NUMBER}/
${
DIST_BUNDLE
}
')
\"
/>
</xsl:attribute>
</xsl:element>
"
sed
-i
"s|^
\(
.*JS_INCLUDE.*
\)
$|
<script src=
\"
${
DIST_BUNDLE
}
\"
><
\/
script>
\n\1
|g"
public/index.html
;
else
_ALL_SOURCES
=
$@
echo
"
${
_ALL_SOURCES
}
"
for
_SOURCE
in
${
_ALL_SOURCES
[@]
}
;
do
_SIZE
=
$((
$(
wc
-c
${
_SOURCE
}
|
awk
'{print $1}'
)
/
1024
))
_SOURCE
=
js/
${
_SOURCE
/
${
PUBLIC_JS_DIR
}
/
}
echo
"including
${
_SOURCE
}
(
${
_SIZE
}
kB) into
${
JSHEADER_TARGET
}
"
_JS_INCLUDE
=
"
${
_JS_INCLUDE
}
<xsl:element name=
\"
script
\"
>
<xsl:attribute name=
\"
src
\"
>
<xsl:value-of select=
\"
concat(
\$
basepath,'webinterface/
\$
{BUILD_NUMBER}/
${
_SOURCE
}
')
\"
/>
</xsl:attribute>
</xsl:element>
"
sed
-i
"s|^
\(
.*JS_INCLUDE.*
\)
$|
<script src=
\"
${
_SOURCE
}
\"
><
\/
script>
\n\1
|g"
public/index.html
;
done
fi
echo
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
echo
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
<!-- THIS FILE IS AUTO-GENERATED BY THE merge_js.sh SCRIPT -->
<!-- THIS FILE IS AUTO-GENERATED BY THE merge_js.sh SCRIPT -->
<xsl:stylesheet version=
\"
1.0
\"
xmlns:xsl=
\"
http://www.w3.org/1999/XSL/Transform
\"
>
<xsl:stylesheet version=
\"
1.0
\"
xmlns:xsl=
\"
http://www.w3.org/1999/XSL/Transform
\"
>
...
@@ -46,16 +79,15 @@ _create_jsheader () {
...
@@ -46,16 +79,15 @@ _create_jsheader () {
<script>
<script>
window.sessionStorage.caosdbBasePath =
\"
<xsl:value-of select=
\"\$
basepath
\"
/>
\"
;
window.sessionStorage.caosdbBasePath =
\"
<xsl:value-of select=
\"\$
basepath
\"
/>
\"
;
</script>
</script>
<xsl:element name=
\"
script
\"
>
${
_JS_INCLUDE
}
<xsl:attribute name=
\"
src
\"
>
<xsl:value-of select=
\"
concat(
\$
basepath,'webinterface/
\$
{BUILD_NUMBER}/webcaosdb.dist.js')
\"
/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:template>
</xsl:stylesheet>"
>
${
JSHEADER_TARGET
}
</xsl:stylesheet>"
>
${
JSHEADER_TARGET
}
}
}
function
_merge
()
{
function
_merge
()
{
if
[
"
$BUILD_JS_DIST_BUNDLE
"
!=
"TRUE"
]
;
then
return
0
fi
_SOURCE
=
$2
_SOURCE
=
$2
_TARGET
=
$3
_TARGET
=
$3
...
@@ -70,21 +102,24 @@ function _merge () {
...
@@ -70,21 +102,24 @@ function _merge () {
}
}
# clean up old
# clean up old
rm
$TARGET
||
true
rm
$
DIST_BUNDLE_
TARGET
||
true
touch
$TARGET
touch
$
DIST_BUNDLE_
TARGET
for
_SOURCE
in
${
CORE_MODULES
[@]
}
;
do
for
_SOURCE
in
${
CORE_MODULES
[@]
}
;
do
_merge
"core"
"
${
SOURCE_DIR
}${
_SOURCE
}
"
$TARGET
[[
!
"
${
ALL_SOURCES
[@]
}
"
=
~
"
${
_SOURCE
}
"
]]
&&
ALL_SOURCES+
=(
${
PUBLIC_JS_DIR
}${
_SOURCE
}
)
_merge
"core"
"
${
PUBLIC_JS_DIR
}${
_SOURCE
}
"
$DIST_BUNDLE_TARGET
done
done
# load other js files but exclude any subdirectory
# load other js files but exclude any subdirectory
for
_SOURCE
in
$(
find
${
SOURCE_DIR
}*
-prune
-iname
"*.js"
)
;
do
for
_SOURCE
in
$(
find
${
PUBLIC_JS_DIR
}*
-prune
-iname
"*.js"
)
;
do
_merge
"extension"
${
_SOURCE
}
$TARGET
[[
!
"
${
ALL_SOURCES
[@]
}
"
=
~
"
${
_SOURCE
}
"
]]
&&
ALL_SOURCES+
=(
${
_SOURCE
}
)
_merge
"extension"
${
_SOURCE
}
$DIST_BUNDLE_TARGET
done
done
# for `make test`
# for `make test`
for
_SOURCE
in
$(
find
${
SOURCE_DIR
}
-ipath
"
${
SOURCE_DIR
}
modules/*.js"
)
;
do
for
_SOURCE
in
$(
find
${
PUBLIC_JS_DIR
}
-ipath
"
${
PUBLIC_JS_DIR
}
modules/*.js"
)
;
do
_merge
"extension"
${
_SOURCE
}
$TARGET
[[
!
"
${
ALL_SOURCES
[@]
}
"
=
~
"
${
_SOURCE
}
"
]]
&&
ALL_SOURCES+
=(
${
_SOURCE
}
)
_merge
"extension"
${
_SOURCE
}
$DIST_BUNDLE_TARGET
done
done
_create_jsheader
_create_jsheader
${
ALL_SOURCES
[@]
}
This diff is collapsed.
Click to expand it.
test/core/index.html
+
1
−
1
View file @
da84d9ef
...
@@ -35,6 +35,6 @@
...
@@ -35,6 +35,6 @@
<script>
<script>
var
_caosdb_modules_auto_init
=
false
;
var
_caosdb_modules_auto_init
=
false
;
</script>
</script>
<
script
src=
"webcaosdb.dist.js"
></script
>
<
!--JS_INCLUDE--
>
</body>
</body>
</html>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment