Skip to content

Commit 9d526a8

Browse files
committed
Added NPM frontend
1 parent 2434eb5 commit 9d526a8

File tree

20 files changed

+6123
-49
lines changed

20 files changed

+6123
-49
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
*.pb.go
99
.vscode
1010
.DS_Store
11+
12+
# Build files
1113
build
14+
15+
# sqlie files
1216
.sqlite
1317
.sqlite-journal
18+
19+
# NPM ignores
20+
dist/
21+
node_modules/

Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
# Paths to packages
22
GO=$(shell which go)
3+
NPM=$(shell which npm)
34

45
# Paths to locations, etc
56
BUILD_DIR = "build"
7+
PLUGIN_DIR = $(wildcard plugin/*)
8+
NPM_DIR = $(wildcard npm/*)
9+
10+
# Build flags
611
BUILD_MODULE = "github.com/djthorpe/go-server"
712
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitSource=${BUILD_MODULE}
813
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitTag=$(shell git describe --tags)
914
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitBranch=$(shell git name-rev HEAD --name-only --always)
1015
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitHash=$(shell git rev-parse HEAD)
1116
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GoBuildTime=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
1217
BUILD_FLAGS = -ldflags "-s -w $(BUILD_LD_FLAGS)"
13-
BUILD_VERSION = $(shell git describe --tags)
14-
PLUGIN_DIR = $(wildcard plugin/*)
1518

16-
.PHONY: all server plugins dependencies mkdir clean
19+
.PHONY: all server npm plugins dependencies mkdir clean
1720

18-
all: clean plugins server
21+
all: clean plugins server npm
1922

2023
server: dependencies mkdir
2124
@echo Build server
2225
@${GO} build -o ${BUILD_DIR}/server ${BUILD_FLAGS} github.com/djthorpe/go-server/cmd/server
2326

27+
npm: $(NPM_DIR)
28+
29+
$(NPM_DIR): FORCE
30+
@echo Build npm $(notdir $@)
31+
@cd $@ && ${NPM} run build
32+
2433
plugins: $(PLUGIN_DIR)
2534
@echo Build plugin httpserver
2635
@${GO} build -buildmode=plugin -o ${BUILD_DIR}/httpserver.plugin ${BUILD_FLAGS} github.com/djthorpe/go-server/plugin/httpserver
2736
@echo Build plugin log
2837
@${GO} build -buildmode=plugin -o ${BUILD_DIR}/log.plugin ${BUILD_FLAGS} github.com/djthorpe/go-server/plugin/log
38+
@echo Build plugin static
39+
@${GO} build -buildmode=plugin -o ${BUILD_DIR}/static.plugin ${BUILD_FLAGS} github.com/djthorpe/go-server/plugin/static
2940

3041
$(PLUGIN_DIR): FORCE
3142
@echo Build plugin $(notdir $@)
@@ -37,6 +48,9 @@ dependencies:
3748
ifeq (,${GO})
3849
$(error "Missing go binary")
3950
endif
51+
ifeq (,${NPM})
52+
$(error "Missing npm binary")
53+
endif
4054

4155
mkdir:
4256
@install -d ${BUILD_DIR}

npm/sqlite3/.eslintrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
env:
2+
browser: true
3+
es2021: true
4+
extends:
5+
- airbnb-base
6+
parserOptions:
7+
ecmaVersion: 12
8+
sourceType: module
9+
rules: {}

npm/sqlite3/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@djthorpe:registry=https://npm.pkg.github.com

npm/sqlite3/css/index.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
@import url('@djthorpe/js-framework/dist/index.css');

npm/sqlite3/html/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width">
7+
<title>sqlite</title>
8+
<meta name="description" content="sqlite api">
9+
<link rel="icon" href="/assets/favicon/favicon.ico">
10+
<link rel="stylesheet" href="/index.css" media="all">
11+
<script src="/index.js"></script>
12+
</head>
13+
<body>
14+
<!-- NAVIGATION -->
15+
<nav class="navbar sticky-top navbar navbar-dark navbar-expand-md bg-primary border-bottom border-white" id="nav">
16+
<div class="container-fluid">
17+
<a class="navbar-brand" href="/"><strong>sqlite</strong></a>
18+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-items"
19+
aria-expanded="false">
20+
<span class="navbar-toggler-icon"></span>
21+
</button>
22+
<div class="collapse navbar-collapse" id="navbar-items">
23+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
24+
<li class="nav-item">
25+
<a class="nav-link" href="#">Home</a>
26+
</li>
27+
</ul>
28+
</div>
29+
</div>
30+
</nav>
31+
<!-- TOAST -->
32+
<div class="toast-container position-absolute bottom-0 end-0 p-3 d-none" style="z-index: 9999;">
33+
<div class="toast" id="toast" role="alert">
34+
<div class="toast-header">
35+
<strong class="me-auto _title"></strong>
36+
<small class="text-muted _code"></small>
37+
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
38+
</div>
39+
<div class="toast-body _reason"></div>
40+
</div>
41+
</div>
42+
</body>
43+
</html>

npm/sqlite3/js/index.js

Whitespace-only changes.

0 commit comments

Comments
 (0)