-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA] Victory chart renderer: Bun CLI scaffold #91667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
daea02e
Add victory-chart-renderer Bun CLI scaffold
roryabraham 745c7ab
Configure ESLint and TypeScript for server CLI
roryabraham 10396ca
Fix typecheck for victory-chart-renderer Bun CLI
roryabraham bcf7c27
Move server Bun tsconfig to server/tsconfig.json
roryabraham 64b5bf0
Merge branch 'main' into rory/victory-chart-renderer-scaffold
roryabraham e271db5
Merge remote-tracking branch 'origin/main' into rory/victory-chart-re…
roryabraham f11c7d9
Add target for linux-arm
roryabraham 3f732ee
Remove unnecessary lint config changes
roryabraham 7cf4998
Update server/victory-chart-renderer/README.md
roryabraham 51e9b39
Rename victory-chart-renderer tests directory to tests
roryabraham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1.3.14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import {expect, test} from 'bun:test'; | ||
| 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}); | ||
| } | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.tsinstead ofserver/victory-chart-renderer/__tests__/cli.test.tsin the path to this file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated!