Working makefile #6

Merged
steino merged 9 commits from makefile into master 2022-11-22 07:51:04 +00:00
6 changed files with 45 additions and 10 deletions

3
.gitignore vendored
View File

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

View File

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

36
Makefile Normal file
View File

@ -0,0 +1,36 @@
.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

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

View File

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