chore(api): update dependencies and build configuration

- Replace tsc-alias with rollup-plugin-visualizer in package.json.
- Update build script to use vite for building the API package.
- Add vite configuration file for improved build process and visualization.
- Adjust tsconfig.dist.json to exclude additional configuration files from the build.
This commit is contained in:
Matiss Janis Aboltins
2026-01-28 23:01:46 +00:00
parent 68c0b35d05
commit 549f269511
4 changed files with 67 additions and 64 deletions

View File

@@ -7,12 +7,11 @@
"@types",
"dist"
],
"main": "dist/api/index.js",
"main": "dist/index.js",
"types": "@types/api/index.d.ts",
"scripts": {
"build:crdt": "yarn workspace @actual-app/crdt build",
"build:node": "tsc --p tsconfig.dist.json && tsc-alias -p tsconfig.dist.json",
"build": "yarn run clean && yarn run build:node",
"build": "yarn run clean && vite build && tsc -p tsconfig.dist.json --emitDeclarationOnly",
"test": "yarn run clean && yarn run build:crdt && vitest --run",
"clean": "rm -rf dist @types"
},
@@ -22,11 +21,12 @@
"compare-versions": "^6.1.1",
"loot-core": "workspace:^",
"node-fetch": "^3.3.2",
"rollup-plugin-visualizer": "^6.0.5",
"uuid": "^13.0.0"
},
"devDependencies": {
"tsc-alias": "^1.8.16",
"typescript": "^5.9.3",
"vite": "^7.3.1",
"vite-plugin-peggy-loader": "^2.0.1",
"vitest": "^4.0.16"
},

View File

@@ -12,5 +12,13 @@
"declarationDir": "@types"
},
"include": ["."],
"exclude": ["**/node_modules/*", "dist", "@types", "*.test.ts"]
"exclude": [
"**/node_modules/*",
"dist",
"@types",
"*.test.ts",
"vite.config.ts",
"vitest.config.ts",
"vitest.setup.ts"
]
}

View File

@@ -0,0 +1,50 @@
import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
import peggyLoader from 'vite-plugin-peggy-loader';
const crdtDir = path.resolve(__dirname, '../crdt');
export default defineConfig({
ssr: { noExternal: true, external: ['better-sqlite3'] },
build: {
ssr: true,
target: 'es2021',
outDir: path.resolve(__dirname, 'dist'),
emptyOutDir: true,
lib: {
entry: path.resolve(__dirname, 'index.ts'),
formats: ['cjs'],
fileName: () => 'index.js',
},
},
plugins: [
peggyLoader(),
visualizer({ template: 'raw-data', filename: 'dist/stats.json' }),
],
resolve: {
extensions: [
'.api.js',
'.api.ts',
'.api.tsx',
'.electron.js',
'.electron.ts',
'.electron.tsx',
'.js',
'.ts',
'.tsx',
'.json',
],
alias: [
// {
// find: 'handlebars',
// replacement: require.resolve('handlebars/dist/handlebars.js'),
// },
{
find: /^@actual-app\/crdt(\/.*)?$/,
replacement: path.resolve(crdtDir, 'src') + '$1',
},
],
},
});

View File

@@ -28,9 +28,10 @@ __metadata:
compare-versions: "npm:^6.1.1"
loot-core: "workspace:^"
node-fetch: "npm:^3.3.2"
tsc-alias: "npm:^1.8.16"
rollup-plugin-visualizer: "npm:^6.0.5"
typescript: "npm:^5.9.3"
uuid: "npm:^13.0.0"
vite: "npm:^7.3.1"
vite-plugin-peggy-loader: "npm:^2.0.1"
vitest: "npm:^4.0.16"
languageName: unknown
@@ -12478,7 +12479,7 @@ __metadata:
languageName: node
linkType: hard
"commander@npm:^9.0.0, commander@npm:^9.4.1":
"commander@npm:^9.4.1":
version: 9.5.0
resolution: "commander@npm:9.5.0"
checksum: 10/41c49b3d0f94a1fbeb0463c85b13f15aa15a9e0b4d5e10a49c0a1d58d4489b549d62262b052ae0aa6cfda53299bee487bfe337825df15e342114dde543f82906
@@ -16348,15 +16349,6 @@ __metadata:
languageName: node
linkType: hard
"get-tsconfig@npm:^4.10.0":
version: 4.11.0
resolution: "get-tsconfig@npm:4.11.0"
dependencies:
resolve-pkg-maps: "npm:^1.0.0"
checksum: 10/f569a533ba6f68701e99a9af65c4b72186fc3446be7af9478906f047443d715a728959adae8661299ce49b5bb8edc06d942c81bce57632166104bce633600db8
languageName: node
linkType: hard
"github-from-package@npm:0.0.0":
version: 0.0.0
resolution: "github-from-package@npm:0.0.0"
@@ -16586,7 +16578,7 @@ __metadata:
languageName: node
linkType: hard
"globby@npm:^11.0.4, globby@npm:^11.1.0":
"globby@npm:^11.1.0":
version: 11.1.0
resolution: "globby@npm:11.1.0"
dependencies:
@@ -20790,13 +20782,6 @@ __metadata:
languageName: node
linkType: hard
"mylas@npm:^2.1.9":
version: 2.1.13
resolution: "mylas@npm:2.1.13"
checksum: 10/37f335424463c422f48d50317aa0a34fe410fabb146cbf27b453a0aa743732b5626f56deaa190bca2ce29836f809d88759007976dc78d5d22b75918a00586577
languageName: node
linkType: hard
"nano-spawn@npm:^2.0.0":
version: 2.0.0
resolution: "nano-spawn@npm:2.0.0"
@@ -22102,15 +22087,6 @@ __metadata:
languageName: node
linkType: hard
"plimit-lit@npm:^1.2.6":
version: 1.6.1
resolution: "plimit-lit@npm:1.6.1"
dependencies:
queue-lit: "npm:^1.5.1"
checksum: 10/e4eaf018dc311fd4d452954c10992cd8a9eb72d168ec2274bb831d86558422703e1405a8978ffdd5c418654e6a25e10a0765a39bf3ce3a84dc799fe6268e0ea4
languageName: node
linkType: hard
"plist@npm:3.1.0, plist@npm:^3.0.4, plist@npm:^3.0.5, plist@npm:^3.1.0":
version: 3.1.0
resolution: "plist@npm:3.1.0"
@@ -23307,13 +23283,6 @@ __metadata:
languageName: node
linkType: hard
"queue-lit@npm:^1.5.1":
version: 1.5.2
resolution: "queue-lit@npm:1.5.2"
checksum: 10/8dd45c79bd25b33b0c7d587391eb0b4acc4deb797bf92fef62b2d8e7c03b64083f5304f09d52a18267d34d020cc67ccde97a88185b67590eeccb194938ff1f98
languageName: node
linkType: hard
"queue-microtask@npm:^1.2.2":
version: 1.2.3
resolution: "queue-microtask@npm:1.2.3"
@@ -24594,13 +24563,6 @@ __metadata:
languageName: node
linkType: hard
"resolve-pkg-maps@npm:^1.0.0":
version: 1.0.0
resolution: "resolve-pkg-maps@npm:1.0.0"
checksum: 10/0763150adf303040c304009231314d1e84c6e5ebfa2d82b7d94e96a6e82bacd1dcc0b58ae257315f3c8adb89a91d8d0f12928241cba2df1680fbe6f60bf99b0e
languageName: node
linkType: hard
"resolve@npm:^1.10.0, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.22.1, resolve@npm:^1.22.10":
version: 1.22.10
resolution: "resolve@npm:1.22.10"
@@ -26974,23 +26936,6 @@ __metadata:
languageName: node
linkType: hard
"tsc-alias@npm:^1.8.16":
version: 1.8.16
resolution: "tsc-alias@npm:1.8.16"
dependencies:
chokidar: "npm:^3.5.3"
commander: "npm:^9.0.0"
get-tsconfig: "npm:^4.10.0"
globby: "npm:^11.0.4"
mylas: "npm:^2.1.9"
normalize-path: "npm:^3.0.0"
plimit-lit: "npm:^1.2.6"
bin:
tsc-alias: dist/bin/index.js
checksum: 10/a4c1988e645c0bbb993629f1cde79189549db35c2aeff7aa23bbf0864437f6dd15f91de3b51fe05cbd53e56ed32529710cc22855a8925c637357ab4c5e4f862a
languageName: node
linkType: hard
"tsconfck@npm:^3.0.3":
version: 3.1.6
resolution: "tsconfck@npm:3.1.6"