Skip to content

Commit

Permalink
Merge pull request #71 from Jalle19/bumps
Browse files Browse the repository at this point in the history
Dependency bumps, typing and CI improvements
  • Loading branch information
Jalle19 authored Aug 29, 2024
2 parents 6155108 + 2b66d10 commit f2c2d74
Show file tree
Hide file tree
Showing 19 changed files with 509 additions and 411 deletions.
21 changes: 0 additions & 21 deletions .eslintrc.json

This file was deleted.

15 changes: 15 additions & 0 deletions .github/actions/prepare-workspace/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Prepare workspace
description: Prepares the workspace by configuring the runtime, installing dependencies etc.
runs:
using: composite
steps:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
shell: bash
- name: Install web interface dependencies
run: cd webif/ && npm ci
shell: bash
46 changes: 16 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
- uses: ./.github/actions/prepare-workspace
- name: Check formatting
run: npm run prettier-check
eslint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
- uses: ./.github/actions/prepare-workspace
- name: Run eslint
run: npm run lint
jest:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
- uses: ./.github/actions/prepare-workspace
- name: Run tests
run: npm run test
webif-prettier:
Expand All @@ -56,12 +41,7 @@ jobs:
working-directory: ./webif
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
- uses: ./.github/actions/prepare-workspace
- name: Check formatting
run: npm run prettier-check
webif-eslint:
Expand All @@ -72,14 +52,20 @@ jobs:
working-directory: ./webif
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
- uses: ./.github/actions/prepare-workspace
- name: Run eslint
run: npm run lint
webif-svelte-check:
name: svelte-check web interface
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./webif
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/prepare-workspace
- name: Run svelte-check
run: npm run check
build-docker:
name: Build Docker image
runs-on: ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
FROM node:20-bookworm-slim AS builder
FROM node:22-bookworm-slim AS builder

WORKDIR /app

# Copy all files needed to build the app
COPY package.json /app
COPY package-lock.json /app
COPY tsconfig.json /app
COPY .npmrc /app
COPY src/ /app/src
COPY webif/ /app/webif

# Install dependencies and build the app and web interface
RUN npm install
RUN npm run build-all

FROM node:20-bookworm-slim AS runtime
FROM node:22-bookworm-slim AS runtime

WORKDIR /app

# Copy everything needed to install dependencies
COPY package.json /app
COPY package-lock.json /app
COPY .npmrc /app
RUN npm install --omit=dev --ignore-scripts

# Copy the built apps
Expand Down
38 changes: 38 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
},

parser: tsParser,
ecmaVersion: 2021,
sourceType: "module",
},

rules: {
"no-console": "error",
},
},
];
Loading

0 comments on commit f2c2d74

Please sign in to comment.