From bb7845faeffa5afd47444841b7abf9fd2f64dffa Mon Sep 17 00:00:00 2001 From: David Reed Date: Mon, 12 Sep 2022 20:36:03 -0400 Subject: [PATCH] Remove git module in favor of NPM package. --- .gitmodules | 3 --- main.sh | 10 +--------- package-lock.json | 12 +++++++++++- package.json | 3 ++- src/index.js | 8 ++------ static | 1 - 6 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 .gitmodules delete mode 160000 static diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1b6138a..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "static"] - path = static - url = https://github.com/titaniumnetwork-dev/ultraviolet-site.git diff --git a/main.sh b/main.sh index 1a0105e..8ee71fa 100755 --- a/main.sh +++ b/main.sh @@ -2,12 +2,4 @@ # Set this to 1 to automatically attempt a fix when an error occurs while running npm start. fix=0 - -# Stuff to do at first run(submodule, npm install). -if [[ -d "static" && -n "$(find static -prune -empty 2>/dev/null)" ]] || [[ ! -d "static" ]]; then - npm install - git submodule update --init --recursive -fi - - -npm start || [[ $fix = 1 ]] && npm install && npm update && git submodule update --init --recursive \ No newline at end of file +npm start || [[ $fix = 1 ]] && npm install && npm start \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5ec853d..e1ffc21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,8 @@ "license": "GPL-3.0-or-later", "dependencies": { "@tomphttp/bare-server-node": "^1.0.2-beta-readme2", - "serve-static": "^1.15.0" + "serve-static": "^1.15.0", + "ultraviolet-static": "https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz" }, "devDependencies": { "eslint": "^8.23.0", @@ -1525,6 +1526,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ultraviolet-static": { + "version": "1.0.0", + "resolved": "https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz", + "integrity": "sha512-HrgerFmdzz991mbg+PcTlv7fBsOznSF+pIY0Nmn52IhXU1i+d7tlVYt9d6gNAeU7xbhMVJ8jJjgy8ZIZ2/NIUw==" + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -2660,6 +2666,10 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, + "ultraviolet-static": { + "version": "https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz", + "integrity": "sha512-HrgerFmdzz991mbg+PcTlv7fBsOznSF+pIY0Nmn52IhXU1i+d7tlVYt9d6gNAeU7xbhMVJ8jJjgy8ZIZ2/NIUw==" + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 08696fe..456d9ea 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "license": "GPL-3.0-or-later", "dependencies": { "@tomphttp/bare-server-node": "^1.0.2-beta-readme2", - "serve-static": "^1.15.0" + "serve-static": "^1.15.0", + "ultraviolet-static": "https://github.com/titaniumnetwork-development/Ultraviolet-Static/releases/download/v1.0.0/ultraviolet-static-1.0.0.tgz" }, "devDependencies": { "eslint": "^8.23.0", diff --git a/src/index.js b/src/index.js index 0f56670..c73bb19 100644 --- a/src/index.js +++ b/src/index.js @@ -1,14 +1,10 @@ import createServer from "@tomphttp/bare-server-node"; -import { fileURLToPath } from "url"; import http from "http"; import serveStatic from "serve-static"; +import { publicPath } from "ultraviolet-static"; const bare = createServer("/bare/"); -const serve = serveStatic( - fileURLToPath(new URL("../static/", import.meta.url)), - { fallthrough: false } -); - +const serve = serveStatic(publicPath, { fallthrough: false }); const server = http.createServer(); server.on("request", (req, res) => { diff --git a/static b/static deleted file mode 160000 index f7c4f10..0000000 --- a/static +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f7c4f10705c228a79da350c3d311c4b1fb2f7c97