chore: organize file structure

* Move all packaging-related stuff into a subdirectory
* Remove workspace defaulting to `frontend` directory. Now users
must `cd` in the frontend directory themselves.
This commit is contained in:
Fernando Fernández 2023-10-21 10:22:04 +00:00 committed by GitHub
parent c64623e1d7
commit 0a2a46ac90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 120 additions and 106 deletions

View File

@ -1,36 +0,0 @@
# Dockerfile
Dockerfile
# Coverage directory used by tools like istanbul
coverage
# Dependency directories
node_modules/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Output of 'npm pack'
*.tgz
# dotenv environment variables file
.env
# IDE / Editor
.idea
.run
.vscode
# macOS
.DS_Store
# Vim swap files
*.swp
# Github & CI
.github
.devcontainer
.ci

View File

@ -28,6 +28,9 @@ jobs:
lint: lint:
name: Lint 🔬 name: Lint 🔬
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps: steps:
- name: Checkout ⬇️ - name: Checkout ⬇️
@ -50,6 +53,9 @@ jobs:
typecheck: typecheck:
name: Typecheck 🈯 name: Typecheck 🈯
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps: steps:
- name: Checkout ⬇️ - name: Checkout ⬇️
@ -96,6 +102,7 @@ jobs:
uses: docker/build-push-action@v5.0.0 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: packaging/docker/Dockerfile
platforms: ${{ matrix.platform }} platforms: ${{ matrix.platform }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
@ -135,6 +142,9 @@ jobs:
- "macos-latest" - "macos-latest"
- "ubuntu-latest" - "ubuntu-latest"
- "windows-latest" - "windows-latest"
defaults:
run:
working-directory: packaging/tauri
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
@ -150,7 +160,7 @@ jobs:
check-latest: true check-latest: true
- name: Install dependencies 📦 - name: Install dependencies 📦
run: npm ci --no-audit -w tauri run: npm ci --no-audit
- name: Install webkit2gtk (ubuntu only) - name: Install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest' if: matrix.platform == 'ubuntu-latest'
@ -159,10 +169,10 @@ jobs:
sudo apt-get install -y webkit2gtk-4.0 sudo apt-get install -y webkit2gtk-4.0
- name: Generate Tauri icons 🖌️ - name: Generate Tauri icons 🖌️
run: "npm run tauri:icon -w tauri" run: "npm run tauri:icon"
- name: Build Tauri 🛠️ - name: Build Tauri 🛠️
run: "npm run tauri:build -w tauri" run: "npm run tauri:build"
- name: Upload artifact (Linux) ⬆️🐧 - name: Upload artifact (Linux) ⬆️🐧
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
@ -170,8 +180,8 @@ jobs:
with: with:
name: jellyfin-vue_linux-amd64 name: jellyfin-vue_linux-amd64
path: | path: |
tauri/target/release/bundle/deb/*.deb packaging/tauri/target/release/bundle/deb/*.deb
tauri/target/release/bundle/appimage_deb packaging/tauri/target/release/bundle/appimage_deb
- name: Upload artifact (MacOS) ⬆️🍎 - name: Upload artifact (MacOS) ⬆️🍎
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
@ -179,15 +189,15 @@ jobs:
with: with:
name: jellyfin-vue_macOS name: jellyfin-vue_macOS
path: | path: |
tauri/target/release/bundle/macos packaging/tauri/target/release/bundle/macos
tauri/target/release/bundle/dmg/*.dmg packaging/tauri/target/release/bundle/dmg/*.dmg
- name: Upload artifact (Windows) ⬆️🪟 - name: Upload artifact (Windows) ⬆️🪟
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
with: with:
name: jellyfin-vue_windows_amd64 name: jellyfin-vue_windows_amd64
path: tauri/target/release/jellyfin-vue.exe path: packaging/tauri/target/release/jellyfin-vue.exe
pr_context: pr_context:
name: Save PR context as artifact name: Save PR context as artifact

View File

@ -41,6 +41,7 @@ jobs:
uses: docker/build-push-action@v5.0.0 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: packaging/docker/Dockerfile
push: true push: true
platforms: linux/amd64,linux/arm64,linux/arm platforms: linux/amd64,linux/arm64,linux/arm
build-args: | build-args: |
@ -58,6 +59,7 @@ jobs:
uses: docker/build-push-action@v5.0.0 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: packaging/docker/Dockerfile
push: true push: true
platforms: linux/amd64,linux/arm64,linux/arm platforms: linux/amd64,linux/arm64,linux/arm
build-args: | build-args: |
@ -77,6 +79,9 @@ jobs:
- "macos-latest" - "macos-latest"
- "ubuntu-latest" - "ubuntu-latest"
- "windows-latest" - "windows-latest"
defaults:
run:
working-directory: packaging/tauri
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
@ -92,7 +97,7 @@ jobs:
check-latest: true check-latest: true
- name: Install dependencies 📦 - name: Install dependencies 📦
run: npm ci --no-audit -w tauri run: npm ci --no-audit
- name: Install webkit2gtk (ubuntu only) - name: Install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest' if: matrix.platform == 'ubuntu-latest'
@ -101,10 +106,10 @@ jobs:
sudo apt-get install -y webkit2gtk-4.0 sudo apt-get install -y webkit2gtk-4.0
- name: Generate Tauri icons 🖌️ - name: Generate Tauri icons 🖌️
run: "npm run tauri:icon -w tauri" run: "npm run tauri:icon"
- name: Build Tauri 🛠️ - name: Build Tauri 🛠️
run: "npm run tauri:build -w tauri" run: "npm run tauri:build"
- name: Upload artifact (Linux) ⬆️🐧 - name: Upload artifact (Linux) ⬆️🐧
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
@ -112,8 +117,8 @@ jobs:
with: with:
name: jellyfin-vue_linux-amd64 name: jellyfin-vue_linux-amd64
path: | path: |
tauri/target/release/bundle/deb/*.deb packaging/tauri/target/release/bundle/deb/*.deb
tauri/target/release/bundle/appimage_deb packaging/tauri/target/release/bundle/appimage_deb
- name: Upload artifact (MacOS) ⬆️🍎 - name: Upload artifact (MacOS) ⬆️🍎
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
@ -121,12 +126,12 @@ jobs:
with: with:
name: jellyfin-vue_macOS name: jellyfin-vue_macOS
path: | path: |
tauri/target/release/bundle/macos packaging/tauri/target/release/bundle/macos
tauri/target/release/bundle/dmg/*.dmg packaging/tauri/target/release/bundle/dmg/*.dmg
- name: Upload artifact (Windows) ⬆️🪟 - name: Upload artifact (Windows) ⬆️🪟
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
with: with:
name: jellyfin-vue_windows_amd64 name: jellyfin-vue_windows_amd64
path: tauri/target/release/jellyfin-vue.exe path: packaging/tauri/target/release/jellyfin-vue.exe

View File

@ -53,6 +53,7 @@ jobs:
uses: docker/build-push-action@v5.0.0 uses: docker/build-push-action@v5.0.0
with: with:
context: . context: .
file: packaging/docker/Dockerfile
push: true push: true
platforms: linux/amd64,linux/arm64,linux/arm platforms: linux/amd64,linux/arm64,linux/arm
tags: | tags: |
@ -83,6 +84,9 @@ jobs:
- "macos-latest" - "macos-latest"
- "ubuntu-latest" - "ubuntu-latest"
- "windows-latest" - "windows-latest"
defaults:
run:
working-directory: packaging/tauri
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
@ -98,7 +102,7 @@ jobs:
check-latest: true check-latest: true
- name: Install dependencies 📦 - name: Install dependencies 📦
run: npm ci --no-audit -w tauri run: "npm ci --no-audit"
- name: Install webkit2gtk (ubuntu only) - name: Install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest' if: matrix.platform == 'ubuntu-latest'
@ -107,10 +111,10 @@ jobs:
sudo apt-get install -y webkit2gtk-4.0 sudo apt-get install -y webkit2gtk-4.0
- name: Generate Tauri icons 🖌️ - name: Generate Tauri icons 🖌️
run: "npm run tauri:icon -w tauri" run: "npm run tauri:icon"
- name: Build Tauri 🛠️ - name: Build Tauri 🛠️
run: "npm run tauri:build -w tauri" run: "npm run tauri:build"
- name: Upload artifact (Linux) ⬆️🐧 - name: Upload artifact (Linux) ⬆️🐧
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
@ -118,8 +122,8 @@ jobs:
with: with:
name: jellyfin-vue_linux-amd64 name: jellyfin-vue_linux-amd64
path: | path: |
tauri/target/release/bundle/deb/*.deb packaging/tauri/target/release/bundle/deb/*.deb
tauri/target/release/bundle/appimage_deb packaging/tauri/target/release/bundle/appimage_deb
- name: Upload artifact (MacOS) ⬆️🍎 - name: Upload artifact (MacOS) ⬆️🍎
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
@ -127,12 +131,12 @@ jobs:
with: with:
name: jellyfin-vue_macOS name: jellyfin-vue_macOS
path: | path: |
tauri/target/release/bundle/macos packaging/tauri/target/release/bundle/macos
tauri/target/release/bundle/dmg/*.dmg packaging/tauri/target/release/bundle/dmg/*.dmg
- name: Upload artifact (Windows) ⬆️🪟 - name: Upload artifact (Windows) ⬆️🪟
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
with: with:
name: jellyfin-vue_windows_amd64 name: jellyfin-vue_windows_amd64
path: tauri/target/release/jellyfin-vue.exe path: packaging/tauri/target/release/jellyfin-vue.exe

6
.gitignore vendored
View File

@ -93,8 +93,4 @@ sw.js
*.swp *.swp
# Debian build artifacts # Debian build artifacts
debian/.debhelper packaging/jellyfin-vue*
debian/debhelper-build-stamp
debian/files
debian/jellyfin-vue*
vue/

1
.npmrc
View File

@ -1,7 +1,6 @@
fund=false fund=false
lockfile-version=3 lockfile-version=3
save-exact=true save-exact=true
workspace=frontend
engine-strict=true engine-strict=true
## Fix timeout errors in CI ## Fix timeout errors in CI

1
debian/install vendored
View File

@ -1 +0,0 @@
vue usr/share/jellyfin/

21
debian/rules vendored
View File

@ -1,21 +0,0 @@
#! /usr/bin/make -f
export DH_VERBOSE=1
%:
dh $@
# disable "make check"
override_dh_auto_test:
# disable stripping debugging symbols
override_dh_clistrip:
override_dh_auto_build:
npm ci --no-audit
npm run build
mv $(CURDIR)/frontend/dist $(CURDIR)/vue
override_dh_auto_clean:
test -d $(CURDIR)/frontend/dist && rm -rf '$(CURDIR)/frontend/dist' || true
test -d $(CURDIR)/vue && rm -rf '$(CURDIR)/vue' || true
test -d $(CURDIR)/node_modules && rm -rf '$(CURDIR)/node_modules' || true

View File

@ -22,8 +22,8 @@
"check": "npm run lint && npm run typecheck", "check": "npm run lint && npm run typecheck",
"start": "vite", "start": "vite",
"serve": "vite preview", "serve": "vite preview",
"lint": "eslint . --ignore-path ../.gitignore --max-warnings=0 --cache --cache-location node_modules/.cache", "lint": "eslint . --ignore-path ../.gitignore --max-warnings=0 --cache --cache-location ../node_modules/.cache/eslint",
"lint-fix": "eslint . --fix --ignore-path ../.gitignore --max-warnings=0 --cache --cache-location node_modules/.cache", "lint-fix": "eslint . --fix --ignore-path ../.gitignore --max-warnings=0 --cache --cache-location ../node_modules/.cache/eslint",
"prod": "npm run build && npm run serve", "prod": "npm run build && npm run serve",
"typecheck": "vue-tsc --noEmit --skipLibCheck", "typecheck": "vue-tsc --noEmit --skipLibCheck",
"vue-i18n-extract": "vue-i18n-extract", "vue-i18n-extract": "vue-i18n-extract",

View File

@ -24,6 +24,7 @@ export default defineConfig(({ mode }): UserConfig => {
const config: UserConfig = { const config: UserConfig = {
appType: 'spa', appType: 'spa',
base: './', base: './',
cacheDir: '../node_modules/.cache/vite',
define: { define: {
__COMMIT_HASH__: JSON.stringify(process.env.COMMIT_HASH || '') __COMMIT_HASH__: JSON.stringify(process.env.COMMIT_HASH || '')
}, },

6
package-lock.json generated
View File

@ -8,7 +8,7 @@
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"workspaces": [ "workspaces": [
"frontend", "frontend",
"tauri" "packaging/tauri"
], ],
"engines": { "engines": {
"node": ">=18.12.0 <19.0.0", "node": ">=18.12.0 <19.0.0",
@ -986,7 +986,7 @@
"link": true "link": true
}, },
"node_modules/@jellyfin-vue/tauri": { "node_modules/@jellyfin-vue/tauri": {
"resolved": "tauri", "resolved": "packaging/tauri",
"link": true "link": true
}, },
"node_modules/@jellyfin/sdk": { "node_modules/@jellyfin/sdk": {
@ -7784,7 +7784,7 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"tauri": { "packaging/tauri": {
"name": "@jellyfin-vue/tauri", "name": "@jellyfin-vue/tauri",
"version": "0.0.0", "version": "0.0.0",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",

View File

@ -13,7 +13,7 @@
"author": "jellyfin-vue Contributors (https://github.com/jellyfin/jellyfin-vue/graphs/contributors)", "author": "jellyfin-vue Contributors (https://github.com/jellyfin/jellyfin-vue/graphs/contributors)",
"workspaces": [ "workspaces": [
"frontend", "frontend",
"tauri" "packaging/tauri"
], ],
"engines": { "engines": {
"node": ">=18.12.0 <19.0.0", "node": ">=18.12.0 <19.0.0",

9
packaging/deb/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
debian/.debhelper
debian/debhelper-build-stamp
debian/files
debian/jellyfin-vue*
dist/
frontend
package-lock.json
package.json
.npmrc

7
packaging/deb/README.md Normal file
View File

@ -0,0 +1,7 @@
1. Install `build-essential` and `debhelper`:
`sudo apt install build-essential debhelper`
2. Build the package:
`dpkg-buildpackage -us -uc`

View File

@ -3,7 +3,7 @@ Section: misc
Priority: optional Priority: optional
Maintainer: Jellyfin Team <team@jellyfin.org> Maintainer: Jellyfin Team <team@jellyfin.org>
Build-Depends: debhelper (>= 10), Build-Depends: debhelper (>= 10),
npm | nodejs nodejs
Standards-Version: 3.9.4 Standards-Version: 3.9.4
Homepage: https://jellyfin.org/ Homepage: https://jellyfin.org/
Vcs-Git: https://github.org/jellyfin/jellyfin-vue.git Vcs-Git: https://github.org/jellyfin/jellyfin-vue.git

View File

@ -0,0 +1 @@
dist usr/share/jellyfin/

26
packaging/deb/debian/rules Executable file
View File

@ -0,0 +1,26 @@
#! /usr/bin/make -f
export DH_VERBOSE=1
%:
dh $@
# disable "make check"
override_dh_auto_test:
# disable stripping debugging symbols
override_dh_clistrip:
override_dh_auto_build:
cp -ra root/{package.json,package-lock.json,.npmrc,frontend} $(CURDIR)/
npm ci --no-audit -w frontend
npm run build -w frontend
mv $(CURDIR)/frontend/dist $(CURDIR)/dist
rm -rf $(CURDIR)/frontend rm -rf $(CURDIR)/node_modules $(CURDIR)/package.json $(CURDIR)/package-lock.json $(CURDIR)/.npmrc
override_dh_auto_clean:
test -d $(CURDIR)/frontend && rm -rf '$(CURDIR)/frontend' || true
test -d $(CURDIR)/dist && rm -rf '$(CURDIR)/dist' || true
test -d $(CURDIR)/node_modules && rm -rf '$(CURDIR)/node_modules' || true
test -d $(CURDIR)/package.json && rm -rf '$(CURDIR)/package.json' || true
test -d $(CURDIR)/package-lock.json && rm -rf '$(CURDIR)/package-lock.json' || true
test -d $(CURDIR)/.npmrc && rm -rf '$(CURDIR)/.npmrc' || true

1
packaging/deb/root Symbolic link
View File

@ -0,0 +1 @@
../..

View File

@ -12,21 +12,23 @@ ENV DEFAULT_SERVERS=$DEFAULT_SERVERS
ENV HISTORY_ROUTER_MODE=$HISTORY_ROUTER_MODE ENV HISTORY_ROUTER_MODE=$HISTORY_ROUTER_MODE
ENV IS_STABLE=$IS_STABLE ENV IS_STABLE=$IS_STABLE
WORKDIR /app COPY package.json package-lock.json .npmrc /app/
COPY . . COPY .git /app/.git
COPY frontend /app/frontend
WORKDIR /app/frontend
# Install dependencies # Install dependencies
RUN npm ci --no-audit RUN npm ci --no-audit --ignore-scripts
# Build client # Build client
RUN if [ $IS_STABLE = "0" ] ; then export COMMIT_HASH=$(git rev-parse HEAD) ; fi && npm run build RUN if [ $"IS_STABLE" = "0" ] ; then export COMMIT_HASH=$(git rev-parse HEAD) ; fi && npm run build
# Deploy built distribution to nginx # Deploy built distribution to nginx
FROM nginx:stable-alpine-slim FROM nginx:stable-alpine-slim
COPY --from=build /app/frontend/dist/ /usr/share/nginx/html/ COPY --from=build /app/frontend/dist/ /usr/share/nginx/html/
COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf COPY packaging/docker/contents/nginx.conf /etc/nginx/conf.d/default.conf
COPY .docker/*.sh / COPY packaging/docker/contents/*.sh /
RUN apk add --no-cache jq && \ RUN apk add --no-cache jq && \
rm -rf /docker-entrypoint.d /.dockerenv /usr/sbin/nginx-debug && \ rm -rf /docker-entrypoint.d /.dockerenv /usr/sbin/nginx-debug && \
chmod +x /*.sh chmod +x /*.sh

View File

@ -0,0 +1,11 @@
This Dockerfile must have it's context at the root of the repository. From this folder:
``
docker build ../.. -t your/tag -f Dockerfile
``
Alternatively, with the shell at the root of this repository:
``
docker build . -t your/tag -f packaging/docker/Dockerfile
``

View File

@ -5,7 +5,7 @@
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"scripts": { "scripts": {
"tauri": "tauri", "tauri": "tauri",
"tauri:icon": "tauri icon ../frontend/public/icon.png", "tauri:icon": "tauri icon ../../frontend/public/icon.png",
"tauri:build": "tauri build", "tauri:build": "tauri build",
"tauri:dev": "tauri dev" "tauri:dev": "tauri dev"
}, },

View File

@ -1,13 +1,13 @@
{ {
"package": { "package": {
"productName": "jellyfin-vue", "productName": "jellyfin-vue",
"version": "../frontend/package.json" "version": "../../frontend/package.json"
}, },
"build": { "build": {
"distDir": "../frontend/dist", "distDir": "../../frontend/dist",
"devPath": "http://127.0.0.1:3000", "devPath": "http://127.0.0.1:3000",
"beforeDevCommand": "cd .. && npm start -w frontend", "beforeDevCommand": "cd ../../frontend && npm start",
"beforeBuildCommand": "cd .. && npm run build -w frontend" "beforeBuildCommand": "cd ../../frontend && npm run build"
}, },
"tauri": { "tauri": {
"bundle": { "bundle": {