Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
sudo apt-get update
sudo apt-get install --yes libx11-dev libxkbfile-dev

- uses: voidzero-dev/setup-vp@v1
- uses: voidzero-dev/setup-vp@v1.20.0
with:
node-version: 24
cache: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install --yes libx11-dev libxkbfile-dev
- uses: voidzero-dev/setup-vp@v1
- uses: voidzero-dev/setup-vp@v1.20.0
with:
node-version: ${{ matrix.node-version }}
cache: true
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.15.0
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# vite-plus preview build registry bridge (auto-added by vp)
registry=https://registry-bridge.viteplus.dev/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ vp build
Run `vpr test:integration` to build and test the public sharing service in the local
Cloudflare Workers runtime. The `test` workspace uses Vitest 4.1 for compatibility
with `@cloudflare/vitest-plugin`; the main test suite uses Vitest 5.
Keep the Workers suite's `vitest` imports and version pin when running `vp migrate`;
it must not use the main suite's `vite-plus/test` runner or a workspace-wide Vitest override.

The toolchain uses the Vite+ 1.0 preview from [PR #2551](https://github.com/voidzero-dev/vite-plus/pull/2551).
The catalog pins the preview, and `.npmrc` enables its registry. Use the Node.js version in
`.node-version` for development and tests.

## Contributing

Expand Down
50 changes: 50 additions & 0 deletions electron/__tests__/pull-request-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,56 @@ test('reports a missing GitHub CLI when the resolved executable cannot be spawne
).rejects.toThrow('GitHub support requires gh');
});

test('reports the GitHub CLI error when it exits before reading the request body', async () => {
await using directory = await createTemporaryDirectory('codiff-gh-early-exit-');
const repo = join(directory.path, 'repo');
const fakeGh = join(directory.path, 'gh');

await mkdir(repo);
await execFileAsync('git', ['-C', repo, 'init']);
await execFileAsync('git', [
'-C',
repo,
'remote',
'add',
'origin',
'git@github.com:nkzw-tech/codiff.git',
]);
await writeFile(
fakeGh,
`#!/bin/sh
for arg in "$@"; do
if [ "$arg" = 'repos/nkzw-tech/codiff/pulls/12' ]; then
printf '%s' '{"head":{"sha":"0123456789abcdef0123456789abcdef01234567"}}'
exit 0
fi
done
printf '%s' 'gh: authentication required' >&2
exit 4
`,
);
await chmod(fakeGh, 0o755);

await using _environment = createTemporaryEnvironment({
CODIFF_GH_PATH: fakeGh,
SHELL: undefined,
});

await expect(
submitPullRequestReview(repo, {
// Exceed the pipe buffer so the child exits while input is still pending.
body: 'General feedback.'.repeat(128 * 1024),
comments: [],
event: 'COMMENT',
source: {
provider: 'github',
type: 'pull-request',
url: 'https://github.com/nkzw-tech/codiff/pull/12',
},
}),
).rejects.toThrow('gh: authentication required');
});

test('reaches the GitHub CLI when it is not on PATH', async () => {
await using directory = await createTemporaryDirectory('codiff-gh-off-path-');
const repo = join(directory.path, 'repo');
Expand Down
6 changes: 6 additions & 0 deletions electron/git-state/pull-request.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ const runGhApi = async (repoRoot, args, input) => {

child.stdout.on('data', (chunk) => stdout.push(chunk));
child.stderr.on('data', (chunk) => stderr.push(chunk));
child.stdin.on('error', (error) => {
// gh can exit before reading input; report its exit status and stderr.
if (/** @type {NodeJS.ErrnoException} */ (error).code !== 'EPIPE') {
reject(error);
}
});
child.on('error', (error) => reject(error.code === 'ENOENT' ? createGhNotFoundError() : error));
child.on('close', (code) =>
resolve({
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
"react-dom": "^19.3.0",
"typescript": "^7.0.2",
"vite": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
},
"engines": {
"node": ">=23.0.0",
Expand Down
3,388 changes: 1,700 additions & 1,688 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ allowBuilds:
blockExoticSubdeps: false
minimumReleaseAgeExclude:
- '@nkzw/*'
- '@voidzero-dev/vite-plus-core@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-darwin-arm64@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-darwin-x64@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-linux-arm64-gnu@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-linux-arm64-musl@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-linux-x64-gnu@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-linux-x64-musl@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-win32-arm64-msvc@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- '@voidzero-dev/vite-plus-win32-x64-msvc@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a'
- vite-plus@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a
catalog:
vite: npm:@voidzero-dev/vite-plus-core@^0.3.1
vite-plus: ^0.3.2
vitest: 5.0.0
vite: npm:@voidzero-dev/vite-plus-core@0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a
vite-plus: 0.0.0-commit.2d331e6bae169462409c1a9d311801d29de7a25a
vitest: 5.0.1
nodeLinker: hoisted
onlyBuiltDependencies:
- '@nkzw/mdx-editor'
Expand All @@ -33,9 +43,9 @@ onlyBuiltDependencies:
- unrs-resolver
overrides:
extract-zip>yauzl: ^3.4.0
vite: 'catalog:'
# Keep Vite+ on the main suite's Vitest version without overriding the Workers suite.
vite-plus>vitest: 'catalog:'
vite@*: 'catalog:'
patchedDependencies:
native-keymap@3.3.9: patches/native-keymap@3.3.9.patch
peerDependencyRules:
Expand Down
5 changes: 1 addition & 4 deletions service/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { defineConfig } from 'vite-plus';

export default defineConfig({
pack: {
copy: [],
dts: false,
},
pack: { copy: [], deps: { resolveDepSubpath: true }, dts: false },
});
1 change: 1 addition & 0 deletions test/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default defineConfig({
})),
],
test: {
clearMocks: true,
include: ['**/*.integration.ts'],
setupFiles: ['./setup.cloudflare.ts'],
},
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default defineConfig({
{ from: 'fonts', to: 'dist' },
{ from: 'App.css.d.ts', rename: 'styles.css.d.ts', to: 'dist' },
],
deps: { resolveDepSubpath: true },
dts: false,
loader: {
'.svg': 'dataurl',
Expand Down
2 changes: 1 addition & 1 deletion web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import babel from '@rolldown/plugin-babel';
import { reactCompilerPreset } from '@vitejs/plugin-react';
import { voidReact } from '@void/react/plugin';
import { fate } from 'react-fate/vite';
import type { Plugin } from 'vite';
import type { Plugin } from 'vite-plus';
import { defineConfig, lazyPlugins } from 'vite-plus';
import { voidPlugin } from 'void';

Expand Down
Loading