Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bun-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.14
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ tests/e2e/results/
# Typescript
tsconfig.tsbuildinfo
tsconfig.tsgo.tsbuildinfo
**/tsconfig.tsgo.tsbuildinfo

# Mock-github
/repo/
Expand Down Expand Up @@ -172,3 +173,6 @@ agent-device-output/

# cspell cache
.cspellcache

# Server CLI build artifacts
server/*/dist/
14 changes: 12 additions & 2 deletions config/eslint/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -631,15 +631,15 @@ const config = defineConfig([
},

{
files: ['.github/**/*', 'scripts/**/*'],
files: ['.github/**/*', 'scripts/**/*', 'server/**/*'],
rules: {
// For all these Node.js scripts, we do not want to disable `console` statements
'no-console': 'off',
},
},

{
files: ['.github/**/*', 'scripts/**/*', 'tests/**/*'],
files: ['.github/**/*', 'scripts/**/*', 'server/**/*', 'tests/**/*'],
rules: {
'no-await-in-loop': 'off',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
Expand Down Expand Up @@ -735,6 +735,15 @@ const config = defineConfig([
},
},

{
files: ['server/**/*.ts'],
languageOptions: {
parserOptions: {
project: path.resolve(projectRoot, 'server/tsconfig.json'),
},
},
},

globalIgnores([
'!**/.storybook',
'!**/.github',
Expand All @@ -743,6 +752,7 @@ const config = defineConfig([
'**/*.config.mjs',
'**/node_modules/**/*',
'**/dist/**/*',
'server/**/dist/**',
'.eslint-reports/**/*',
'android/**/build/**/*',
'docs/vendor/**/*',
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"test:verbose": "TZ=utc NODE_OPTIONS=\"--experimental-vm-modules --max_old_space_size=4096\" JEST_VERBOSE=true jest",
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
"typecheck-tsgo": "tsgo --noEmit --incremental --tsBuildInfoFile tsconfig.tsgo.tsbuildinfo",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc && tsc -p server/tsconfig.json",
"typecheck-tsgo": "tsgo --noEmit --incremental --tsBuildInfoFile tsconfig.tsgo.tsbuildinfo && tsgo --noEmit -p server/tsconfig.json --incremental --tsBuildInfoFile server/tsconfig.tsgo.tsbuildinfo",
"lint": "./scripts/lint.sh",
"lint-changed": "./scripts/lintChanged.sh",
"lint-watch": "onchange '**/*.{js,jsx,ts,tsx,mjs,cjs}' -- ./scripts/lint.sh {{changed}}",
Expand All @@ -71,7 +71,12 @@
"generate-autocomplete-parser": "peggy --format es -o src/libs/SearchParser/autocompleteParser.js src/libs/SearchParser/autocompleteParser.peggy src/libs/SearchParser/baseRules.peggy && ./scripts/parser-workletization.sh src/libs/SearchParser/autocompleteParser.js",
"web:dist": "concurrently \"npm:web-proxy\" \"http-server ./dist --cors --port 8080 -P http://localhost:9000\"",
"octokit": "cd scripts && npx ts-node -i -e \"$(cat ./octokit.ts)\"",
"compress-svg": "npx ts-node scripts/compressSvg.ts --dir assets/images && npx ts-node scripts/compressSvg.ts --dir docs/assets/images"
"compress-svg": "npx ts-node scripts/compressSvg.ts --dir assets/images && npx ts-node scripts/compressSvg.ts --dir docs/assets/images",
"server:vcr:dev": "bun run server/victory-chart-renderer/src/cli.ts",
"server:vcr:test": "bun test server/victory-chart-renderer/tests",
"server:vcr:build:linux": "bun build --compile --target=bun-linux-x64 server/victory-chart-renderer/src/cli.ts --outfile server/victory-chart-renderer/dist/victory-chart-renderer-linux-x64",
"server:vcr:build:linux-arm": "bun build --compile --target=bun-linux-arm64 server/victory-chart-renderer/src/cli.ts --outfile server/victory-chart-renderer/dist/victory-chart-renderer-linux-arm64",
"server:vcr:build:macos": "bun build --compile --target=bun-darwin-arm64 server/victory-chart-renderer/src/cli.ts --outfile server/victory-chart-renderer/dist/victory-chart-renderer-darwin-arm64"
},
"dependencies": {
"@babel/runtime": "^7.25.0",
Expand Down Expand Up @@ -257,6 +262,7 @@
"@testing-library/react-native": "13.2.0",
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
"@types/base-64": "^1.0.2",
"@types/bun": "^1.3.14",
"@types/canvas-size": "^1.2.2",
"@types/concurrently": "^7.0.3",
"@types/d3-scale": "^4.0.9",
Expand Down Expand Up @@ -386,6 +392,7 @@
"react": "19.2.0",
"react-dom": "19.2.0",
"eslint-config-airbnb-typescript": {
"@types/bun": "^1.3.14",
"@typescript-eslint/eslint-plugin": "^8.45.0",
"@typescript-eslint/parser": "^8.45.0",
"eslint": "^9.36.0",
Expand Down Expand Up @@ -429,6 +436,7 @@
}
},
"engines": {
"bun": "1.3.14",
"node": "20.20.0",
"npm": "10.8.2"
}
Expand Down
7 changes: 7 additions & 0 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["@types/bun"]
},
"include": ["victory-chart-renderer/src", "victory-chart-renderer/tests"]
}
40 changes: 40 additions & 0 deletions server/victory-chart-renderer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Victory Chart Renderer

Standalone Bun CLI that will render Expensify chart XML to PNG using the same chart code as the App.

## Project layout

- `src/` — CLI source
- `tests/` — Bun integration tests (`bun:test`)
- `dist/` — compiled binaries (gitignored)

## Development

From the App repository root:

```bash
npm run server:vcr:dev /tmp/out.txt
```

## Tests

From the App repository root:

```bash
npm run server:vcr:test
```

Or from this directory:

```bash
bun test
```

## Compiled binaries

```bash
npm run server:vcr:build:linux
npm run server:vcr:build:macos
```

Binaries are written to `server/victory-chart-renderer/dist/` (gitignored).
12 changes: 12 additions & 0 deletions server/victory-chart-renderer/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import CLI from '@scripts/utils/CLI';

const cli = new CLI({
positionalArgs: [
{
name: 'outPath',
description: 'Output file path for the scaffold message',
},
],
});

await Bun.write(cli.positionalArgs.outPath, 'victory-chart-renderer scaffolded\n');
25 changes: 25 additions & 0 deletions server/victory-chart-renderer/tests/cli.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {expect, test} from 'bun:test';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB but can we just use server/victory-chart-renderer/tests/cli.test.ts instead of server/victory-chart-renderer/__tests__/cli.test.ts in the path to this file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!

import {spawnSync} from 'node:child_process';
import {mkdtempSync, readFileSync, rmSync} from 'node:fs';
import {tmpdir} from 'node:os';
import {join} from 'node:path';

const projectRoot = join(import.meta.dir, '../../..');
const cliPath = join(projectRoot, 'server/victory-chart-renderer/src/cli.ts');

test('CLI writes the scaffold message to outPath', () => {
const tempDir = mkdtempSync(join(tmpdir(), 'vcr-cli-test-'));
const outPath = join(tempDir, 'out.txt');

try {
const result = spawnSync('bun', ['run', cliPath, outPath], {
cwd: projectRoot,
encoding: 'utf8',
});

expect(result.status).toBe(0);
expect(readFileSync(outPath, 'utf8')).toBe('victory-chart-renderer scaffolded\n');
} finally {
rmSync(tempDir, {recursive: true, force: true});
}
});
Loading