Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup code Structure #280

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ node_modules/
workout-tracker.yaml
/workout-tracker
coverage.out
/assets/dist/
/internal/views/assets/dist/
.aider*
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUN make install-deps
COPY tailwind.config.js ./tailwind.config.js
COPY main.css ./main.css
COPY pkg ./pkg
COPY views ./views
COPY assets ./assets
COPY internal/views ./internal/views
COPY internal/views/assets ./internal/views/assets

RUN make build-dist build-tw

Expand All @@ -29,11 +29,11 @@ RUN go mod download
COPY main.go ./main.go
COPY pkg ./pkg
COPY vendor ./vendor
COPY views ./views
COPY assets ./assets
COPY internal/views ./internal/views
COPY internal/views/assets ./internal/views/assets
COPY translations ./translations
COPY --from=frontend /app/assets/output.css ./assets/output.css
COPY --from=frontend /app/assets/dist ./assets/dist
COPY --from=frontend /app/internal/views/assets/output.css ./internal/views/assets/output.css
COPY --from=frontend /app/internal/views/assets/dist ./internal/views/assets/dist

ENV CGO_ENABLED=0
RUN go build \
Expand Down
35 changes: 18 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ install-deps:
npm install

clean:
rm -fv ./assets/output.css ./workout-tracker
rm -rf ./tmp/ ./node_modules/ ./assets/dist/
rm -fv ./internal/views/assets/output.css ./workout-tracker
rm -rf ./tmp/ ./node_modules/ ./internal/views/assets/dist/

dev:
air
Expand All @@ -46,41 +46,42 @@ build-docker:
swagger:
swag init \
--parseDependency \
--dir ./pkg/app/,./,./vendor/gorm.io/gorm/,./vendor/github.com/codingsince1985/geo-golang/ \
--dir ./internal/pkg/app/,./,./vendor/gorm.io/gorm/,./vendor/github.com/codingsince1985/geo-golang/ \
--generalInfo api_handlers.go

build-tw:
npx tailwindcss -i ./main.css -o ./assets/output.css
npx tailwindcss -i ./main.css -o ./internal/views/assets/output.css

clean-dist:
rm -rf ./assets/dist/
rm -rf ./internal/views/assets/dist/

build-dist: clean-dist
mkdir -p ./assets/dist/images
cp -v ./node_modules/fullcalendar/index.global.min.js ./assets/dist/fullcalendar.min.js
cp -v ./node_modules/leaflet/dist/leaflet.css ./assets/dist/
cp -v ./node_modules/leaflet/dist/images/* ./assets/dist/images/
cp -v ./node_modules/leaflet/dist/leaflet.js ./assets/dist/
cp -v ./node_modules/shareon/dist/shareon.iife.js ./assets/dist/
cp -v ./node_modules/shareon/dist/shareon.min.css ./assets/dist/
cp -v ./node_modules/apexcharts/dist/apexcharts.min.js ./assets/dist/
cp -v ./node_modules/apexcharts/dist/apexcharts.css ./assets/dist/
cp -v ./node_modules/htmx.org/dist/htmx.min.js ./assets/dist/
mkdir -p ./internal/views/assets/dist/images
cp -v ./node_modules/fullcalendar/index.global.min.js ./internal/views/assets/dist/fullcalendar.min.js
cp -v ./node_modules/leaflet/dist/leaflet.css ./internal/views/assets/dist/
cp -v ./node_modules/leaflet/dist/images/* ./internal/views/assets/dist/images/
cp -v ./node_modules/leaflet/dist/leaflet.js ./internal/views/assets/dist/
cp -v ./node_modules/shareon/dist/shareon.iife.js ./internal/views/assets/dist/
cp -v ./node_modules/shareon/dist/shareon.min.css ./internal/views/assets/dist/
cp -v ./node_modules/apexcharts/dist/apexcharts.min.js ./internal/views/assets/dist/
cp -v ./node_modules/apexcharts/dist/apexcharts.css ./internal/views/assets/dist/
cp -v ./node_modules/htmx.org/dist/htmx.min.js ./internal/views/assets/dist/

watch-tw:
npx tailwindcss -i ./main.css -o ./assets/output.css --watch
npx tailwindcss -i ./main.css -o ./internal/views/assets/output.css --watch

build-translations: translations

translations:
xspreak -o translations/en.json -f json --template-keyword "i18n" -t "views/**/*.html"
xspreak -o translations/en.json -f json --template-keyword "i18n" -t "internal/views/**/*.html"
prettier --write translations/*.json

serve:
$(OUTPUT_FILE)

test: test-go test-assets

# TODO: add a mode to style code maybe: prettier --check . --write
test-assets:
prettier --check .

Expand Down
Loading
Loading