Files
actual/packages/sync-server/bin/actual-server.js
Matt FiddamanGitHubautofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
fbdad57ff0 ⬆️ mid month dependency updates (#8235)
* @monorepo-utils/workspaces-to-typescript-project-references (^2.10.3 → ^2.11.0)

* @types/node (^22.19.17 → ^22.19.21)

* eslint (^10.2.0 → ^10.5.0)

* eslint-plugin-perfectionist (^5.8.0 → ^5.9.0)

* lage (^2.15.5 → ^2.15.13)

* typescript (^6.0.2 → ^6.0.3)

* vitest (^4.1.2 → ^4.1.8)

* better-sqlite3 (^12.8.0 → ^12.10.0)

* vite (^8.0.5 → ^8.0.16)

* cosmiconfig (^9.0.1 → ^9.0.2)

* react-aria-components (^1.16.0 → ^1.18.0)

* @chromatic-com/storybook (^5.1.1 → ^5.2.1)

* @storybook/addon-a11y (^10.3.4 → ^10.4.4)

* @storybook/addon-docs (^10.3.4 → ^10.4.4)

* @storybook/react-vite (^10.3.4 → ^10.4.4)

* @types/react (^19.2.14 → ^19.2.17)

* @vitejs/plugin-react (^6.0.1 → ^6.0.2)

* eslint-plugin-storybook (^10.3.4 → ^10.4.4)

* storybook (^10.3.4 → ^10.4.4)

* @bufbuild/protobuf (^2.11.0 → ^2.12.0)

* @bufbuild/protoc-gen-es (^2.11.0 → ^2.12.0)

* @babel/core (^7.29.0 → ^7.29.7)

* @codemirror/autocomplete (^6.20.1 → ^6.20.3)

* @react-aria/interactions (^3.27.1 → ^3.28.1)

* @reduxjs/toolkit (^2.11.2 → ^2.12.0)

* @tanstack/react-query (^5.96.2 → ^5.101.0)

* @uiw/react-codemirror (^4.25.9 → ^4.25.10)

* date-fns (^4.1.0 → ^4.4.0)

* hyperformula (^3.2.0 → ^3.3.0)

* lru-cache (^11.2.7 → ^11.5.1)

* react-aria (^3.47.0 → ^3.49.0)

* react-error-boundary (^6.1.1 → ^6.1.2)

* react-hotkeys-hook (^5.2.4 → ^5.3.2)

* react-redux (^9.2.0 → ^9.3.0)

* react-spring (^10.0.3 → ^10.0.4)

* rolldown (^1.0.0-rc.13 → ^1.1.1)

* sass (^1.99.0 → ^1.101.0)

* vite-plugin-pwa (^1.2.0 → ^1.3.0)

* @docusaurus/core (^3.10.0 → ^3.10.1)

* @docusaurus/plugin-content-docs (^3.10.0 → ^3.10.1)

* @docusaurus/plugin-ideal-image (^3.10.0 → ^3.10.1)

* @docusaurus/preset-classic (^3.10.0 → ^3.10.1)

* @docusaurus/theme-common (^3.10.0 → ^3.10.1)

* @docusaurus/theme-mermaid (^3.10.0 → ^3.10.1)

* @easyops-cn/docusaurus-search-local (^0.55.1 → ^0.55.2)

* @docusaurus/module-type-aliases (^3.10.0 → ^3.10.1)

* @oxlint/plugins (^1.60.0 → ^1.69.0)

* ua-parser-js (^2.0.9 → ^2.0.10)

* fast-check (^4.6.0 → ^4.8.0)

* jest-diff (^30.3.0 → ^30.4.1)

* workbox-precaching (^7.4.0 → ^7.4.1)

* ipaddr.js (^2.3.0 → ^2.4.0)

* jws (^3.2.2 → ^3.2.3)

* http-proxy-middleware (^3.0.5 → ^3.0.6)

* oxlint (^1.59.0 → ^1.69.0)

* @codemirror/view (^6.41.0 → ^6.43.1)

* yarn dedupe

* nano-staged (^0.8.0 → ^1.0.2)

* commander (^14.0.3 → ^15.0.0)

* react (>=19.2 → 19.2.7)

* react-dom (>=19.2 → 19.2.7)

* @rolldown/plugin-babel (~0.1.8 → ~0.2.3)

* downshift (9.3.2 → 9.3.6)

* i18next (^25.10.10 → ^26.3.1)

* react-i18next (^16.6.6 → ^17.0.8)

* react-router (7.15.0 → 7.17.0)

* vite-plugin-node-polyfills (^0.27.0 → ^0.28.0)

* jws (^3.2.3 → ^4.0.1)

* oxlint-tsgolint (^0.20.0 → ^0.23.0)

* jsdom (^27.4.0 → ^29.1.1)

* note

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* crdt regenerate and version bump

* fix test

* yarn dedupe

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-06-16 09:21:37 +00:00

122 lines
3.0 KiB
JavaScript
Executable File

#!/usr/bin/env node
import { existsSync, readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { parseArgs } from 'node:util';
const args = process.argv;
const options = {
help: {
type: 'boolean',
short: 'h',
},
version: {
type: 'boolean',
short: 'v',
},
'reset-password': {
type: 'boolean',
},
config: {
type: 'string',
},
};
const { values } = parseArgs({
args,
options,
allowPositionals: true,
});
if (values.help) {
console.log(
[
'usage: actual-server [options]',
'',
'options:',
' --config Path to config file',
'',
' -h --help Print this list and exit.',
' -v --version Print the version and exit.',
'',
'Examples:',
'',
'Runs actual-server with default configuration',
' actual-server',
'',
'Runs actual-server with custom configuration',
' actual-server --config ./config.json',
].join('\n'),
);
process.exit();
}
if (values.version) {
console.log('v' + __APP_VERSION__);
process.exit();
}
const setupDataDir = dataDir => {
if (process.env.ACTUAL_DATA_DIR) {
return; // Env variables must not be overwritten
}
if (dataDir) {
process.env.ACTUAL_DATA_DIR = dataDir; // Use the dir specified
} else {
// Setup defaults
if (existsSync('./data')) {
// The default data directory exists - use it
console.info('Found existing data directory');
process.env.ACTUAL_DATA_DIR = resolve('./data');
} else {
console.info(
'Using default data directory. You can specify a custom config with --config',
);
process.env.ACTUAL_DATA_DIR = resolve('./');
}
console.info(`Data directory: ${process.env.ACTUAL_DATA_DIR}`);
}
};
if (values.config) {
const configExists = existsSync(values.config);
if (!configExists) {
console.log(
`Please specify a valid config path. The path ${String(values.config)} does not exist.`,
);
process.exit();
} else {
console.log(`Loading config from ${String(values.config)}`);
const configJson = JSON.parse(readFileSync(values.config, 'utf-8'));
process.env.ACTUAL_CONFIG_PATH = values.config;
setupDataDir(configJson.dataDir);
}
} else {
// If no config is specified, check for a default config in the current directory
const defaultConfigJsonFile = './config.json';
const configExists = existsSync(defaultConfigJsonFile);
if (configExists) {
console.info('Found config.json in the current directory');
const configJson = JSON.parse(readFileSync(defaultConfigJsonFile, 'utf-8'));
process.env.ACTUAL_CONFIG_PATH = defaultConfigJsonFile;
setupDataDir(configJson.dataDir);
} else {
setupDataDir(); // No default config exists - setup data dir with defaults
}
}
if (values['reset-password']) {
console.info('Running reset password script...');
await import('../src/scripts/reset-password.js');
process.exit();
}
// start the sync server
void import('../app.js');