Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Mar 26, 2024
2 parents a5e2935 + 41900b0 commit bc517e0
Show file tree
Hide file tree
Showing 96 changed files with 3,803 additions and 3,653 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/publishImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,28 @@ on:
- '**.md'

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
- name: Install dev dependencies
run: npm ci
- name: Build Backend
run: 'npm run build:backend'
- name: Test Backend
run: npm run test

push_to_registry:
name: Push Docker image to Docker Hub
name: Build and push container images
runs-on: ubuntu-latest
needs: test
strategy:
fail-fast: false
matrix:
Expand All @@ -26,7 +45,7 @@ jobs:
suffix: '-debian'
# can't build arm64 due to a TLS issue when running npm install??
# https://github.com/FoxxMD/multi-scrobbler/issues/126
platforms: 'linux/amd64'
platforms: 'linux/amd64,linux/arm64'
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
permissions:
packages: write
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Docker image to Dockerhub

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
- name: Install dev dependencies
run: npm ci
- name: Build Backend
run: 'npm run build:backend'
- name: Test Backend
run: npm run test
4 changes: 3 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"reporter": "dot"
"reporter": "dot",
"extension": "ts",
"import": "tsx/esm"
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.16.0
v18.19.1
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ ENV TZ=Etc/GMT
RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
alpine-base \
avahi \
avahi-tools \
git \
nodejs \
npm \
#yarn \
openssh && \
&& \
echo "**** cleanup ****" && \
rm -rf \
/root/.cache \
Expand All @@ -26,9 +23,6 @@ ENV CONFIG_DIR=$data_dir

COPY docker/root/ /

RUN npm install -g patch-package \
&& chown -R root:root /usr/local/lib/node_modules/patch-package

WORKDIR /app

FROM base as build
Expand All @@ -41,8 +35,7 @@ FROM base as build
COPY --chown=abc:abc package*.json tsconfig.json ./
COPY --chown=abc:abc patches ./patches


RUN npm install \
RUN npm ci \
&& chown -R root:root node_modules
#RUN yarn install

Expand All @@ -66,6 +59,7 @@ COPY --from=base /usr/local/lib /usr/local/lib

ENV NODE_ENV=production
ENV IS_DOCKER=true
ENV COLORED_STD=true
#
#RUN yarn global add patch-package \
# && yarn install --production=true \
Expand All @@ -75,7 +69,7 @@ ENV IS_DOCKER=true
# && rm -rf node_modules/ts-node \
# && rm -rf node_modules/typescript

RUN npm install --omit=dev \
RUN npm ci --omit=dev \
&& npm cache clean --force \
&& chown -R abc:abc node_modules \
&& rm -rf node_modules/@types
Expand Down
6 changes: 1 addition & 5 deletions debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ghcr.io/linuxserver/baseimage-debian:bookworm as base

ENV TZ=Etc/GMT
ENV NODE_VERSION 18.19.0
ENV NODE_VERSION 20.11.1

# borrowing openssl header removal trick from offical docker-node
# https://github.com/nodejs/docker-node/blob/main/18/bookworm-slim/Dockerfile#L8
Expand Down Expand Up @@ -57,10 +57,6 @@ ENV CONFIG_DIR=$data_dir

COPY docker/root /

RUN npm install -g \
patch-package \
&& chown -R root:root /usr/lib/node_modules/patch-package

WORKDIR /app

FROM base as build
Expand Down
43 changes: 43 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @ts-check

import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import arrow from 'eslint-plugin-prefer-arrow-functions';

export default tsEslint.config(
eslint.configs.recommended,
...tsEslint.configs.recommended,
// use to enable typed linting (way more errors) https://typescript-eslint.io/linting/typed-linting
/* ...tsEslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigDirName: import.meta.dirname,
},
},
},*/
{
files: ['src/backend/**/*.ts'],
ignores: ['eslint.config.js'],
plugins: {
"prefer-arrow-functions": arrow
},
rules: {
'no-useless-catch': 'off',
'@typescript-eslint/no-unused-vars': 'off',
"prefer-arrow-functions/prefer-arrow-functions": [
"warn",
{
"allowNamedFunctions": false,
"classPropertiesAllowed": false,
"disallowPrototype": false,
"returnStyle": "unchanged",
"singleReturnOnly": false
}
],
"arrow-body-style": ["warn", "as-needed"],
"@typescript-eslint/no-explicit-any": "warn"
}
}
);
7 changes: 6 additions & 1 deletion flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
<id>io.github.foxxmd.multiscrobbler</id>
<provides>
<id>io.github.foxxmd.multiscrobbler.desktop</id>
<binary>multiscrobbler</binary>
</provides>
<launchable type="desktop-id">io.github.foxxmd.multiscrobbler.desktop</launchable>
<name>multi-scrobbler</name>
<summary>Scrobbles music from many sources to many clients</summary>
<summary>Scrobbles music from many sources</summary>
<url type="homepage">https://foxxmd.github.io/multi-scrobbler</url>
<url type="help">https://foxxmd.github.io/multi-scrobbler/docs/configuration</url>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<developer id="tld.vendor">
<name>FoxxMD</name>
</developer>
<description>
<p>
Track your music listening history from many different sources:
Expand Down Expand Up @@ -45,6 +49,7 @@
</screenshot>
</screenshots>
<releases>
<release version="0.7.0" date="2024-03-26"/>
<release version="0.6.5" date="2024-02-05"/>
<release version="0.6.4" date="2024-01-29"/>
<release version="0.6.3" date="2024-01-10"/>
Expand Down
17 changes: 11 additions & 6 deletions flatpak/io.github.foxxmd.multiscrobbler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ modules:
- mkdir -p /app/bin /app/lib /app/lib/dist /app/lib/src /app/lib/assets
- cp -a /usr/lib/sdk/node18/bin/{node,npm} /app/bin
- cp -a /usr/lib/sdk/node18/lib/* /app/lib
- rm -r /app/lib/node_modules/npm/{docs,man}
- rm -r /app/lib/node_modules/npm/{docs,man} # remove this when updating to newer runtime-version

# remove dev dependencies
- npm prune --production

# copy node_modules needed to run app
- cp -r node_modules/. /app/lib/node_modules

# even if not using package.json for scripts it must be present
# so that tsx/node runs as esm (needs to see "type": "module" in file)
- cp package.json /app/lib/package.json

# copy app files to runtime dir
- cp -r dist/. /app/lib/dist
- cp -r src/. /app/lib/src
Expand All @@ -59,11 +63,12 @@ modules:
subdir: main
sources:
# use for official releases
- type: git
url: https://github.com/FoxxMD/multi-scrobbler
tag: 0.6.3
commit: 4bd996eb466137ffc5c3f48305afabde03720525
dest: main
# - type: git
# url: https://github.com/FoxxMD/multi-scrobbler
# tag: 0.6.3
# commit: 4bd996eb466137ffc5c3f48305afabde03720525
# dest: main

# use if developing locally
# - type: dir
# path: /home/yourUser/multi-scrobbler
Expand Down
Loading

0 comments on commit bc517e0

Please sign in to comment.