Compare commits

..

No commits in common. "09fe6ae380a6b492a991add54d68999be9045e5d" and "bb29c92cc0d620144a6f329ac0aeffd31d265d68" have entirely different histories.

6 changed files with 10 additions and 45 deletions

3
.gitignore vendored
View File

@ -10,9 +10,8 @@ js/*.min.js
cache cache
bin bin
ambiance ambiance/*.mp3
*.yml *.yml
public/ public/
node_modules/ node_modules/
src/node_modules

View File

@ -2,8 +2,10 @@
# docker run -it -v $(pwd)/public:/app/public dndmusicbot-js-build # docker run -it -v $(pwd)/public:/app/public dndmusicbot-js-build
FROM node:19-alpine3.16 FROM node:19-alpine3.16
RUN mkdir /public && chmod 777 /public
WORKDIR /app WORKDIR /app
ENTRYPOINT ["yarn"] COPY . /app
RUN yarn
ENTRYPOINT ["yarn", "build"]

View File

@ -1,36 +0,0 @@
.DEFAULT_GOAL := build
APPLICATION_NAME ?= dndmusicbot
CURRENT_UID := $(shell id -u)
BIN := src/node_modules/.bin
YARN = docker run --rm --user $(CURRENT_UID) -v $(CURDIR)/src:/app -v $(CURDIR)/public:/public dndmusicbot-js-build
PHONY: js image build clean
js: image public/script.js
image: .jsimage
.jsimage: Dockerfile
@docker build -t dndmusicbot-js-build .
@touch .jsimage
src/node_modules:
mkdir -p $@
public:
mkdir -p $@
src/yarn.lock: public src/node_modules src/package.json
$(YARN)
@touch -mr $(shell ls -Atd $? | head -1) $@
public/script.js: src/script.js src/yarn.lock
$(YARN) build
$(APPLICATION_NAME): *.go ffmpeg/*.go speaker/*.go
@go build
build: image js $(APPLICATION_NAME)
clean:
rm -r public/* src/node_modules .jsimage $(APPLICATION_NAME)

View File

@ -157,11 +157,11 @@ window.onload = function () {
addInteractHandler(document.querySelector("#addambiance"), (e, isTouch) => { addInteractHandler(document.querySelector("#addambiance"), (e, isTouch) => {
isTouch && e.preventDefault() isTouch && e.preventDefault()
//output.innerText = "" output.innerText = ""
var title = document.querySelector("#inputambiance > input[name='title']") var title = document.querySelector("#inputambiance > input[name='title']")
var url = document.querySelector("#inputambiance > input[name='url']") var url = document.querySelector("#inputambiance > input[name='url']")
if (title.value == "" || url.value == "") { if (title.value == "" || url.value == "") {
console.log("Title or Url is empty!") output.innerText = "Title or Url is empty!"
return return
} }
@ -177,7 +177,7 @@ window.onload = function () {
addInteractHandler(submit, (e, isTouch) => { addInteractHandler(submit, (e, isTouch) => {
isTouch && e.preventDefault() isTouch && e.preventDefault()
//output.innerText = "" output.innerText = ""
var title = document.querySelector("#inputplaylist > input[name='title']") var title = document.querySelector("#inputplaylist > input[name='title']")
var url = document.querySelector("#inputplaylist > input[name='url']") var url = document.querySelector("#inputplaylist > input[name='url']")
if (title.value == "" || url.value == "") { if (title.value == "" || url.value == "") {

View File

@ -1,6 +1,6 @@
{ {
"scripts": { "scripts": {
"build": "esbuild script.js --bundle --outdir=/public/" "build": "esbuild js/script.js --bundle --outdir=public/"
}, },
"dependencies": { "dependencies": {
"esbuild": "^0.15.14", "esbuild": "^0.15.14",