Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/dev_server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dev_server
assets/local
node_modules
6 changes: 3 additions & 3 deletions ui/dev_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Dev Server is a simple HTTP server with a page for each UI fragment that can be

## Instructions

Run `./copy.sh && go build && ./dev_server`
Run `./install.sh && go build && ./dev_server`

The `copy` script copies assets from the UI packages into the Dev Server's `assets/local` folder. Add any new files
The `install` script installs third party node dependencies, and copies these assets and the assets from the UI packages into the Dev Server's `assets/local` folder. Add any new files
that are needed for the UI fragments to this script, as well as the wrapper HTML in `server.go`

Then in the browser navigate to, for example:
`localhost:8080/geonetfooter`
`localhost:8080/geonetfooter`
6 changes: 0 additions & 6 deletions ui/dev_server/assets/bootstrap.v5.bundle.min.js

This file was deleted.

6 changes: 0 additions & 6 deletions ui/dev_server/assets/bootstrap.v5.min.css

This file was deleted.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions ui/dev_server/assets/font/css/font-awesome-6.1.1.min.css

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ui/dev_server/assets/font/webfonts/fa-solid-900.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 0 additions & 9 deletions ui/dev_server/copy.sh

This file was deleted.

34 changes: 34 additions & 0 deletions ui/dev_server/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -e

npm install-clean

OUT_DIR=assets/dependencies
mkdir -p $OUT_DIR

MODULE=@fortawesome/fontawesome-free
mkdir -p $OUT_DIR/$MODULE/css
mkdir -p $OUT_DIR/$MODULE/webfonts
cp node_modules/$MODULE/css/all.min.css $OUT_DIR/$MODULE/css/all.min.css
cp node_modules/$MODULE/webfonts/fa-brands-400.woff2 $OUT_DIR/$MODULE/webfonts/fa-brands-400.woff2
cp node_modules/$MODULE/webfonts/fa-brands-400.ttf $OUT_DIR/$MODULE/webfonts/fa-brands-400.ttf
cp node_modules/$MODULE/webfonts/fa-regular-400.woff2 $OUT_DIR/$MODULE/webfonts/fa-regular-400.woff2
cp node_modules/$MODULE/webfonts/fa-regular-400.ttf $OUT_DIR/$MODULE/webfonts/fa-regular-400.ttf
cp node_modules/$MODULE/webfonts/fa-solid-900.woff2 $OUT_DIR/$MODULE/webfonts/fa-solid-900.woff2
cp node_modules/$MODULE/webfonts/fa-solid-900.ttf $OUT_DIR/$MODULE/webfonts/fa-solid-900.ttf
cp node_modules/$MODULE/webfonts/fa-v4compatibility.woff2 $OUT_DIR/$MODULE/webfonts/fa-v4compatibility.woff2
cp node_modules/$MODULE/webfonts/fa-v4compatibility.ttf $OUT_DIR/$MODULE/webfonts/fa-v4compatibility.ttf

MODULE=geonet-bootstrap
mkdir -p $OUT_DIR/$MODULE
cp node_modules/$MODULE/dist/js/bootstrap.bundle.v5.min.js $OUT_DIR/$MODULE/bootstrap.bundle.v5.min.js
cp node_modules/$MODULE/dist/js/bootstrap.bundle.v5.min.js.map $OUT_DIR/$MODULE/bootstrap.bundle.v5.min.js.map
cp node_modules/$MODULE/dist/css/bootstrap.v5.min.css $OUT_DIR/$MODULE/bootstrap.v5.min.css
cp node_modules/$MODULE/dist/css/bootstrap.v5.min.css.map $OUT_DIR/$MODULE/bootstrap.v5.min.css.map

# Copy required CSS/JS files to assets folder
mkdir -p assets/local
cp ../geonet_header/header.css assets/local/
cp ../geonet_header/header.js assets/local/
cp ../geonet_header_basic/header_basic.css assets/local/
cp ../geonet_footer/footer.js assets/local/
cp ../geonet_footer/footer.css assets/local/
59 changes: 59 additions & 0 deletions ui/dev_server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions ui/dev_server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "ui",
"version": "1.0.0",
"description": "UI dev server",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "GeoNet",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "6.7.2",
"geonet-bootstrap": "https://static.geonet.org.nz/packages/npm/geonet-bootstrap/geonet-bootstrap-1.0.0.tgz"
}
}
6 changes: 3 additions & 3 deletions ui/dev_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func testUIhandler(w http.ResponseWriter, req *http.Request) {
// Add leading HTML. Every page includes Bootstrap CSS/JS and fonts.
// Each page can then also have its own custom CSS/JS files.
leadingHTML := `<!DOCTYPE html><html><head>
<link rel="stylesheet" href="/bootstrap.v5.min.css">
<link rel="stylesheet" href="/font/css/font-awesome-6.1.1.min.css">`
<link rel="stylesheet" href="/dependencies/geonet-bootstrap/bootstrap.v5.min.css">
<link rel="stylesheet" href="/dependencies/@fortawesome/fontawesome-free/css/all.min.css">`

path := req.URL.Path
switch path {
Expand Down Expand Up @@ -134,7 +134,7 @@ func testUIhandler(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(http.StatusNotFound)
}

leadingHTML += `<script src="/bootstrap.v5.bundle.min.js"></script></head><body>`
leadingHTML += `<script src="/dependencies/geonet-bootstrap/bootstrap.bundle.v5.min.js"></script></head><body>`

// Write leading HTML to writer
_, err = w.Write([]byte(leadingHTML))
Expand Down
Loading