Skip to content

Commit

Permalink
Merge branch 'master' into matiss/move-components
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Feb 11, 2025
2 parents 7000fcb + 52ce2a1 commit 4f8c669
Show file tree
Hide file tree
Showing 386 changed files with 17,167 additions and 542 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ jobs:
with:
name: build-stats
path: packages/desktop-client/build-stats

server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Server
run: cd packages/sync-server && yarn build
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: sync-server
path: packages/sync-server/build
88 changes: 88 additions & 0 deletions .github/workflows/docker-edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build Edge Docker Image

# Edge Docker images are built for every commit, and daily
on:
push:
branches:
- master
paths:
- 'packages/sync-server/**'
pull_request:
branches:
- master
paths:
- 'packages/sync-server/**'
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

permissions:
contents: read
packages: write

env:
IMAGES: |
actualbudget/actual-server
ghcr.io/actualbudget/actual-server
# Creates the following tags:
# - actual-server:edge
TAGS: |
type=edge,value=edge
type=sha
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu, alpine]
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# Push to both Docker Hub and Github Container Registry
images: ${{ env.IMAGES }}
flavor: ${{ matrix.os != 'ubuntu' && format('suffix=-{0}', matrix.os) || '' }}
tags: ${{ env.TAGS }}

- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Download artifacts
run: ./packages/sync-server/docker/download-artifacts.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
file: packages/sync-server/docker/edge-${{ matrix.os }}.Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7${{ matrix.os == 'alpine' && ',linux/arm/v6' || '' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
88 changes: 88 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build Stable Docker Image

# Stable Docker images are built for every new tag
on:
push:
tags:
- 'v*.*.*'
paths-ignore:
- README.md
- LICENSE.txt

env:
IMAGES: |
actualbudget/actual-server
ghcr.io/actualbudget/actual-server
# Creates the following tags:
# - actual-server:latest (see docker/metadata-action flavor inputs, below)
# - actual-server:1.3
# - actual-server:1.3.7
# - actual-server:sha-90dd603
TAGS: |
type=semver,pattern={{version}}
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# Push to both Docker Hub and Github Container Registry
images: ${{ env.IMAGES }}
# Automatically update :latest
flavor: latest=true
tags: ${{ env.TAGS }}

- name: Docker meta for Alpine image
id: alpine-meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGES }}
# Automatically update :latest
flavor: |
latest=true
suffix=-alpine,onlatest=true
tags: ${{ env.TAGS }}

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push ubuntu image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: packages/sync-server/docker/stable-ubuntu.Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}

- name: Build and push alpine image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: packages/sync-server/docker/stable-alpine.Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: ${{ steps.alpine-meta.outputs.tags }}
3 changes: 2 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: E2E Tests

on: [pull_request]
on:
pull_request:

env:
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/size-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ name: Compare Sizes

on:
pull_request_target:
paths:
- 'packages/**'
- '!packages/sync-server/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
5 changes: 4 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ export default [
},
{
files: ['packages/loot-core/src/**/*'],

rules: {
'no-restricted-imports': [
'warn',
Expand All @@ -691,6 +690,10 @@ export default [
message:
'Please use relative imports in loot-core instead of importing from `loot-core/*`',
},
{
group: ['@actual-app/web/*'],
message: 'Please do not import `@actual-app/web` in `loot-core`',
},
],
},
],
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"scripts": {
"start": "yarn start:browser",
"start:server": "yarn workspace actual-sync start",
"start:desktop": "yarn rebuild-electron && npm-run-all --parallel 'start:desktop-*'",
"start:desktop-node": "yarn workspace loot-core watch:node",
"start:desktop-client": "yarn workspace @actual-app/web watch",
Expand All @@ -40,6 +41,7 @@
"rebuild-node": "yarn workspace loot-core rebuild",
"lint": "eslint . --max-warnings 0",
"lint:verbose": "DEBUG=eslint:cli-engine eslint . --max-warnings 0",
"install:server": "yarn workspaces focus actual-sync --production",
"typecheck": "yarn tsc && tsc-strict",
"jq": "./node_modules/node-jq/bin/jq",
"prepare": "husky"
Expand Down
6 changes: 1 addition & 5 deletions packages/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type {
RequestInfo as FetchInfo,
RequestInit as FetchInit,
// @ts-ignore: false-positive commonjs module error on build until typescript 5.3
} from 'node-fetch'; // with { 'resolution-mode': 'import' };
} from 'node-fetch';

// loot-core types
import type { InitConfig } from 'loot-core/server/main';
Expand All @@ -16,9 +15,6 @@ import { validateNodeVersion } from './validateNodeVersion';
let actualApp: null | typeof bundle.lib;
export const internal = bundle.lib;

// DEPRECATED: remove the next line in @actual-app/api v7
export * as methods from './methods';

export * from './methods';
export * as utils from './utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/api/methods.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-strict-ignore
import type { Handlers } from 'loot-core/src/types/handlers';
import type { Handlers } from 'loot-core/types/handlers';

import * as injected from './injected';

Expand Down
1 change: 0 additions & 1 deletion packages/api/tsconfig.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"outDir": "dist",
"declarationDir": "@types",
"paths": {
"loot-core/src/*": ["./loot-core/*"],
"loot-core/*": ["./@types/loot-core/*"]
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/budget.mobile.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Page } from '@playwright/test';

import * as monthUtils from 'loot-core/shared/months';
import { amountToCurrency, currencyToAmount } from 'loot-core/shared/util';
import * as monthUtils from 'loot-core/src/shared/months';

import { expect, test } from './fixtures';
import { ConfigurationPage } from './page-models/configuration-page';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/browser-preload.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { initBackend as initSQLBackend } from 'absurd-sql/dist/indexeddb-main-th
// eslint-disable-next-line import/no-unresolved
import { registerSW } from 'virtual:pwa-register';

import * as Platform from 'loot-core/src/client/platform';
import * as Platform from 'loot-core/client/platform';

import packageJson from '../package.json';

Expand Down
7 changes: 2 additions & 5 deletions packages/desktop-client/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ import {
signOut,
} from 'loot-core/client/actions';
import { setAppState, sync } from 'loot-core/client/app/appSlice';
import * as Platform from 'loot-core/client/platform';
import { SpreadsheetProvider } from 'loot-core/client/SpreadsheetProvider';
import * as Platform from 'loot-core/src/client/platform';
import {
init as initConnection,
send,
} from 'loot-core/src/platform/client/fetch';
import { init as initConnection, send } from 'loot-core/platform/client/fetch';

import { handleGlobalEvents } from '../global-events';
import { useMetadataPref } from '../hooks/useMetadataPref';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/FatalError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation, Trans } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { View } from '@actual-app/components/view';

import { LazyLoadFailedError } from 'loot-core/src/shared/errors';
import { LazyLoadFailedError } from 'loot-core/shared/errors';

import { Block } from './common/Block';
import { Link } from './common/Link';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

import { addNotification } from 'loot-core/client/actions';
import { sync } from 'loot-core/client/app/appSlice';
import * as undo from 'loot-core/src/platform/client/undo';
import * as undo from 'loot-core/platform/client/undo';

import { ProtectedRoute } from '../auth/ProtectedRoute';
import { Permissions } from '../auth/types';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/GlobalKeys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from 'react';

import * as Platform from 'loot-core/src/client/platform';
import * as Platform from 'loot-core/client/platform';

import { useNavigate } from '../hooks/useNavigate';

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/LoggedInUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';

import { closeBudget, getUserData, signOut } from 'loot-core/client/actions';
import { listen } from 'loot-core/src/platform/client/fetch';
import { listen } from 'loot-core/platform/client/fetch';
import { type RemoteFile, type SyncedLocalFile } from 'loot-core/types/file';
import { type TransObjectLiteral } from 'loot-core/types/util';

Expand Down
17 changes: 7 additions & 10 deletions packages/desktop-client/src/components/ManageRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@ import React, {
} from 'react';
import { useTranslation } from 'react-i18next';

import { pushModal } from 'loot-core/client/actions/modals';
import { useSchedules } from 'loot-core/client/data-hooks/schedules';
import { initiallyLoadPayees } from 'loot-core/client/queries/queriesSlice';
import { send } from 'loot-core/platform/client/fetch';
import * as undo from 'loot-core/platform/client/undo';
import { getNormalisedString } from 'loot-core/shared/normalisation';
import { q } from 'loot-core/shared/query';
import { pushModal } from 'loot-core/src/client/actions/modals';
import { send } from 'loot-core/src/platform/client/fetch';
import * as undo from 'loot-core/src/platform/client/undo';
import { getNormalisedString } from 'loot-core/src/shared/normalisation';
import { mapField, friendlyOp } from 'loot-core/src/shared/rules';
import { describeSchedule } from 'loot-core/src/shared/schedules';
import {
type RuleEntity,
type NewRuleEntity,
} from 'loot-core/src/types/models';
import { mapField, friendlyOp } from 'loot-core/shared/rules';
import { describeSchedule } from 'loot-core/shared/schedules';
import { type RuleEntity, type NewRuleEntity } from 'loot-core/types/models';

import { useAccounts } from '../hooks/useAccounts';
import { useCategories } from '../hooks/useCategories';
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';

import { closeModal } from 'loot-core/client/actions';
import { send } from 'loot-core/src/platform/client/fetch';
import * as monthUtils from 'loot-core/src/shared/months';
import { send } from 'loot-core/platform/client/fetch';
import * as monthUtils from 'loot-core/shared/months';

import { useMetadataPref } from '../hooks/useMetadataPref';
import { useModalState } from '../hooks/useModalState';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/NotesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
} from 'react';
import { useTranslation } from 'react-i18next';

import { send } from 'loot-core/src/platform/client/fetch';
import { send } from 'loot-core/platform/client/fetch';

import { useNotes } from '../hooks/useNotes';
import { SvgCustomNotesPaper } from '../icons/v2';
Expand Down
Loading

0 comments on commit 4f8c669

Please sign in to comment.