Skip to content

Commit

Permalink
Merge pull request #8 from sjdonado/refactor/v2-elysia-htmx-jsx
Browse files Browse the repository at this point in the history
refactor: API v1.3 elysia htmx jsx
  • Loading branch information
sjdonado authored Oct 19, 2023
2 parents 612e240 + 6523bf6 commit bd89985
Show file tree
Hide file tree
Showing 108 changed files with 32,339 additions and 5,781 deletions.
38 changes: 9 additions & 29 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
{
"env": {
"browser": true
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict",
"plugin:solid/typescript"
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"overrides": [],
"parserOptions": {
"project": [
"./tsconfig.json"
]
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"solid"
"jsx"
],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"": "never"
}
],
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
],
"import/prefer-default-export": "off"
}
"rules": {}
}
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "deploy to sjdonado.de"
name: 'deploy to sjdonado.de'

on:
push:
Expand All @@ -16,5 +16,5 @@ jobs:
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: "ssh://[email protected]:22/idonthavespotify"
git_remote_url: 'ssh://[email protected]:22/idonthavespotify'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
28 changes: 9 additions & 19 deletions .github/workflows/e2e.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: e2e tests
name: run tests

on:
pull_request:
branches: [master]

env:
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
YOUTUBE_API_SEARCH_URL: https://www.googleapis.com/youtube/v3/search
YOUTUBE_API_SEARCH_URL: https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=
DEEZER_API_URL: https://api.deezer.com/search
YOUTUBE_BASE_URL: https://www.youtube.com
APPLE_MUSIC_BASE_URL: https://music.apple.com/search?term=
YOUTUBE_BASE_URL: https://www.youtube.com/
APPLE_MUSIC_BASE_URL: https://music.apple.com/us/search?term=
TIDAL_BASE_URL: https://listen.tidal.com/search?q=
SOUNDCLOUD_BASE_URL: https://soundcloud.com/search/sounds?q=
REDIS_URL: redis://localhost:6379
REDIS_URL: redis://127.0.0.1:6379
jobs:
test:
timeout-minutes: 60
Expand All @@ -29,18 +29,8 @@ jobs:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: yarn install
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: yarn e2e
- uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
run: bun install
- name: Run integration tests
run: bun run test
23 changes: 1 addition & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@

dist
.solid
.output
.vercel
.netlify
netlify

# dependencies
/node_modules
*.min.js

# IDEs and editors
/.idea
.project
.classpath
*.launch
.settings/

# Temp
gitignore

# System Files
.DS_Store
Thumbs.db

.env
/test-results/
/playwright-report/
/playwright/.cache/
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 90,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "css"
}
26 changes: 18 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
FROM node:19-alpine
FROM oven/bun

EXPOSE 5000
EXPOSE 3000

WORKDIR /usr/src/app

COPY package.json ./
COPY yarn.lock ./
ENV NODE_ENV production

RUN yarn install
COPY package.json .
COPY bun.lockb .

COPY . .
RUN bun install

RUN yarn build
COPY src src
COPY www www

CMD ["node", "./dist/server.js"]
COPY tsconfig.json .
COPY build.ts .
COPY tailwind.config.js .

RUN bun run build:js
RUN bun run build:css

COPY public public

CMD ["bun", "www/bin.ts"]
11 changes: 0 additions & 11 deletions Dockerfile.test

This file was deleted.

31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# I don't have Spotify
> More links coming soon :)
# Elysia with Bun runtime

| Raycast API | Web Page |
| -------------| --------- |
| ![Uptime Badge](https://uptime.sjdonado.de/api/badge/3/uptime/24?labelPrefix=API%20&labelSuffix=h) ![Uptime Badge](https://uptime.sjdonado.de/api/badge/3/ping/24?labelPrefix=API%20) | ![Uptime Badge](https://uptime.sjdonado.de/api/badge/2/uptime/24?labelPrefix=Web%20Page%20&labelSuffix=h) ![Uptime Badge](https://uptime.sjdonado.de/api/badge/2/ping/24?labelPrefix=Web%20Page%20) |
## Getting Started
To get started with this template, simply paste this command into your terminal:
```bash
bun create elysia ./elysia-example
```

## Web
<div align="center">
<img alt="Website screenshot" src="https://user-images.githubusercontent.com/27580836/232951519-e536c69d-0207-4c40-806c-5772f62f1377.png">
</div>
## Development
To start the development server run:
```bash
bun run dev
```

## Raycast Extension
<a href="https://raycast.com/sjdonado/idonthavespotify" target="_blank">
<div align="center">
<img alt="Raycast Extension screenshot" src="https://user-images.githubusercontent.com/27580836/230833330-9759063b-04d4-4559-b3b2-859e4a13f947.png">
</div>
</a>

## More info
<img width=50 src="https://user-images.githubusercontent.com/27580836/227801051-a71d389e-2510-4965-a23e-d7478fe28f13.jpeg"/>
Icon Generated by https://deepai.org/machine-learning-model/text2img
Open http://localhost:3000/ with your browser to see the result.
11 changes: 11 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const output = await Bun.build({
entrypoints: ['./src/views/js/audio-preview.js', './src/views/js/search-bar.js'],
outdir: './public/assets/js',
naming: '[dir]/[name].min.[ext]',
target: 'browser',
minify: true,
});

console.log(output.outputs);

export {};
Binary file added bun.lockb
Binary file not shown.
20 changes: 5 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
version: '3'
services:
app:
image: idonthavespotify
env_file: .env
ports:
- 3000:3000
redis:
image: redis:7.0-alpine
ports:
- 6379:6379
app:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
env_file:
- .env
environment:
REDIS_URL: redis://redis:6379
command: yarn e2e
ports:
- 3000:3000
- 9323:9323
63 changes: 28 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
{
"name": "idonthavespotify",
"version": "1.0.0",
"license": "MIT",
"engines": {
"node": ">=16"
},
"version": "1.0.50",
"scripts": {
"dev": "solid-start dev",
"build": "solid-start build",
"start": "solid-start start",
"e2e": "playwright test"
"dev": "bun run build:js && bun run build:css && bun run --watch www/bin.ts",
"test": "REDIS_URL=redis://null:6379 bun test --coverage",
"build:js": "bun run build.ts",
"build:css": "tailwindcss -i ./src/views/css/index.css -o ./public/assets/css/index.css"
},
"type": "module",
"dependencies": {
"@solidjs/meta": "^0.28.2",
"@solidjs/router": "^0.8.2",
"@types/string-similarity": "^4.0.0",
"@elysiajs/html": "^0.7.3",
"@elysiajs/static": "^0.7.1",
"axios": "^1.5.1",
"cheerio": "^1.0.0-rc.12",
"ioredis": "^5.3.1",
"solid-js": "^1.6.11",
"solid-start": "^0.2.26",
"string-similarity": "^4.0.4",
"undici": "^5.15.1"
"elysia": "latest",
"ioredis": "^5.3.2",
"pino": "^8.16.0",
"pino-pretty": "^10.2.3",
"string-similarity": "^4.0.4"
},
"devDependencies": {
"@playwright/test": "^1.32.1",
"@types/cheerio": "^0.22.31",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"autoprefixer": "^10.4.13",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-solid": "^0.11.0",
"postcss": "^8.4.21",
"solid-start-node": "^0.2.19",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.4",
"vite": "^4.2.1"
}
"@types/string-similarity": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"axios-mock-adapter": "^1.22.0",
"bun-types": "latest",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx": "^0.1.0",
"eslint-plugin-prettier": "^5.0.0",
"ioredis-mock": "^8.9.0",
"prettier": "^3.0.3",
"tailwindcss": "^3.3.3",
"typescript": "^5.2.2"
},
"module": "www/bin.js"
}
46 changes: 0 additions & 46 deletions playwright.config.ts

This file was deleted.

Loading

0 comments on commit bd89985

Please sign in to comment.