GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add global binary `vp` and delegate to `vite-plus` by webpro · Pull Request #4 · voidzero-dev/vite-plus

Conversation

@webpro

@webpro webpro commented Jun 6, 2025

Copy link
Copy Markdown
Contributor
  • Add global package with vp binary (just a temporary name)
  • Please see README.md for more details

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@webpro
webpro requested review from Boshen and wan9chi and removed request for Boshen and wan9chi June 6, 2025 07:54
@wan9chi
wan9chi requested review from Boshen and wan9chi and removed request for Boshen and wan9chi June 6, 2025 07:57
webpro
webpro commented Jun 6, 2025
View reviewed changes
Comment thread packages/cli/src/index.ts
import { hideBin } from "yargs/helpers";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { parseArgs } from "node:util";

@webpro webpro Jun 6, 2025

Copy link
Copy Markdown
Contributor Author

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.

Using built-in arg parser is "good enough" imho, and would also work with e.g. Bun.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@wan9chi wan9chi Jun 8, 2025

Copy link
Copy Markdown
Member

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.

Let's revisit this when we want to proxy help messages from the tools.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
webpro
webpro commented Jun 6, 2025
View reviewed changes
Comment thread packages/global/src/index.ts
@@ -0,0 +1,21 @@
import { execFileSync } from "node:child_process";
import { parseArgs } from "node:util";

@webpro webpro Jun 6, 2025

Copy link
Copy Markdown
Contributor Author

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.

Using the built-in arg parser is nice for zero-dependencies in global package.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Boshen
Boshen requested review from wan9chi and removed request for Boshen June 6, 2025 08:01
webpro added 2 commits June 6, 2025 11:10
@webpro
feat: add global binary vp and delegate to vite-plus
92b11fc
@webpro
fix: restore import.meta.dirname
40fd91b
@webpro
webpro force-pushed the feat/add-global-cli branch from 4d2efaf to 40fd91b Compare June 6, 2025 09:10
sxzz
sxzz reviewed Jun 7, 2025
View reviewed changes
Comment thread packages/cli/src/index.ts
);
exec(program, args);
function execPackageBin(binName: string, args: string[], cwd: string, dir?: string) {
const program = path.join(import.meta.dirname, "../node_modules/.bin", binName);

@sxzz sxzz Jun 7, 2025

Copy link
Copy Markdown
Contributor

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.

I'm not sure the compatibility of pnpm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Boshen Boshen assigned wan9chi Jun 8, 2025
wan9chi
wan9chi reviewed Jun 8, 2025
View reviewed changes
Comment thread packages/cli/package.json
"private": true,
"type": "module",
"scripts": {
"start": "node --import tsx/esm ./src/index.ts"

@wan9chi wan9chi Jun 8, 2025

Copy link
Copy Markdown
Member

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.

What is our dev experience for vite+? Should we start it directly from the source with tsx, or do we always build it with tsdown? Currently execPackageBin in cli/src/index.ts assumes that it runs from the source where ../node_modules/.bin exists.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@webpro webpro Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

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.

Great point, using verdaccio I was only doing the "real" thing.

How about having vpg and vpl for development? See d104c66. This is running the actual code without anything in between, but does require Node.js v24. From packages/cli and packages/global we can do e.g. npm link to make them globally available.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wan9chi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@webpro webpro Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

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.

  • vpg: vite-plus global
  • vpl: vite-plus local

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/cli/src/index.ts
import { hideBin } from "yargs/helpers";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { parseArgs } from "node:util";

@wan9chi wan9chi Jun 8, 2025

Copy link
Copy Markdown
Member

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.

Let's revisit this when we want to proxy help messages from the tools.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
webpro added 3 commits June 8, 2025 07:45
@webpro
add .npmrc to template
db028c9
@webpro
import local version of vite-plus
352645f
@webpro
add bins for dev
d104c66
webpro
webpro commented Jun 8, 2025
View reviewed changes
Comment thread packages/cli/src/index.ts

const tasks = rest.filter((task) => task.includes("#"));

const [subcommand, packageDir] = command === "task" && tasks.length > 0 ? tasks[0].split("#") : [command, "."];

@webpro webpro Jun 6, 2025

Copy link
Copy Markdown
Contributor Author

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.

This is just dummy "task orchestrator", can only handle one task from CLI e.g. vite-plus task dev#packages/app

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/cli/package.json
"private": true,
"type": "module",
"scripts": {
"start": "node --import tsx/esm ./src/index.ts"

@webpro webpro Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

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.

Great point, using verdaccio I was only doing the "real" thing.

How about having vpg and vpl for development? See d104c66. This is running the actual code without anything in between, but does require Node.js v24. From packages/cli and packages/global we can do e.g. npm link to make them globally available.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wan9chi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread packages/cli/package.json
"private": true,
"type": "module",
"scripts": {
"start": "node --import tsx/esm ./src/index.ts"

@webpro webpro Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

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.

  • vpg: vite-plus global
  • vpl: vite-plus local

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
wan9chi
wan9chi approved these changes Jun 8, 2025
View reviewed changes
@wan9chi
wan9chi merged commit 7f06636 into main Jun 8, 2025
@wan9chi
wan9chi deleted the feat/add-global-cli branch June 8, 2025 10:59
fengmk2 added a commit that referenced this pull request Apr 4, 2026
@fengmk2
docs(rfc): sync RFC with implementation
6f02073
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
fengmk2 added a commit that referenced this pull request Apr 5, 2026
@fengmk2
docs(rfc): sync RFC with implementation
ef1b30e
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
fengmk2 added a commit that referenced this pull request Apr 7, 2026
@fengmk2
docs(rfc): sync RFC with implementation
51d6081
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
fengmk2 added a commit that referenced this pull request Apr 8, 2026
@fengmk2
docs(rfc): sync RFC with implementation
a489345
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
fengmk2 added a commit that referenced this pull request Apr 8, 2026
@fengmk2
docs(rfc): sync RFC with implementation
6ca7609
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
fengmk2 added a commit that referenced this pull request Apr 8, 2026
@fengmk2
docs(rfc): sync RFC with implementation
197d916
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
fengmk2 added a commit that referenced this pull request Apr 8, 2026
@fengmk2
docs(rfc): sync RFC with implementation
2c43de4
- Update status from "Draft" to "Implemented"
- Fix Code Sharing table: all install functions are in vite_setup::install,
  not separate submodules
- Fix Dependency Graph: remove junction (indirect via vite_setup), add
  actual deps (vite_path, owo-colors)
- Fix Customization submenu to match code (numbered items, no install dir)
- Replace winreg code sample with raw FFI description (matches implementation)
- Replace windows_sys DLL sample with raw FFI (matches implementation)
- Remove winreg from Binary Size Budget, add raw FFI note
- Fix Alternatives #4: raw FFI, not winreg
- Fix CI snippets: rename vite-init to vp-setup, update test workflow
  to match actual test-vp-setup-exe job
- Mark Implementation Phases 1-3 as done, Phase 4 as future
Brooooooklyn added a commit that referenced this pull request Jun 16, 2026
@Brooooooklyn @claude
fix(migration): resolve 4 reviewer threads on vitest pinning & snap s…
9b59731
…tability

#3 (migrator): a monorepo root injects vite-plus before rewritePackageJson, so
existingVitePlus is truthy and a root with a vitest-adjacent dep (e.g.
vitest-browser-svelte, whose vitest peer is non-optional) never got a direct
vitest pin — unresolvable under pnpm strict / Yarn PnP. Fold isVitestAdjacent
into needDirectVitest so the pin is added independent of vite-plus presence.
Flip the stale "stays undefined" test, add a genuine-normalize-pass test, and
add a migration-monorepo-root-vitest-adjacent fixture.

#1 (snap masking): replaceUnstableOutput only masked @/slash/whitespace-prefixed
semver, so JSON "vitest": "4.1.9" (bun catalog, devDeps) churned on every daily
bump while YAML vitest: 4.1.9 was already masked. Mask vitest-family JSON pins
to <semver>, but only major >= 4 (the migrator-supported range) so unsupported
pre-4 echoes like "vitest": "3.2.4" stay visible to prove a refused migration
left package.json untouched. Exclude @vitest/coverage-* (user-owned peers
vite-plus never pins; define-config.ts guards their exact version).

#2 (upgrade-deps): the daily bump rewrote VITEST_VERSION, the catalog, and the
vp-create workflow but left README.md's hardcoded manual-migration vitest pins
stale. Add updateReadmeVitestPins (root + cli mirror), asserting exactly 2 JSON
+ 1 YAML pins per file so a reworded section fails loudly like the other updaters.

#4 (upgrade.md): document that after upgrading vite-plus users must re-pin
vitest to the bundled version (vp --version) or rerun vp migrate, and where the
pin lives per package manager (incl. the package.json pnpm.overrides case).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
fengmk2 added a commit that referenced this pull request Jun 25, 2026
@shulaoda @fengmk2
fix(install): retry truncated downloads in HttpClient::get_bytes (#1940)
1bbf3f1
#### Problem

`HttpClient::get_bytes` read the response body
(`response.bytes().await`) **outside** the retry. The retry only wrapped
request setup (`send().await?.error_for_status()`), which resolves as
soon as the response *headers* arrive — so a connection dropped mid-body
(a response truncated relative to its advertised `Content-Length`)
surfaced as a hard error that was **never retried**. `download_file`
already handles this by streaming the body inside its retry and checking
`Content-Length`.

`get_bytes` is the download path for the **platform tarball** in:

- `vp upgrade` — `crates/vite_global_cli/src/commands/upgrade`
- the standalone installer — `crates/vite_installer`

So a transient mid-body drop (flaky wifi, a proxy/CDN closing the
connection early) failed the upgrade/install outright with `… end of
file before message length reached`, even though a single retry would
usually succeed. Node-runtime and package-manager tarball downloads
(which go through `download_file`) already retried.

#### Fix

Read the body **inside** the retried closure — one send+body unit,
mirroring `download_file` — so a mid-body drop is retried. The
now-unused private `get` / `get_with_accept` helpers are removed
(`get_with_accept` was only ever called with `accept = None`).

#### Test

`test_get_bytes_retries_on_truncated_body`: a raw `tokio` TCP server
truncates the first response (advertises the full `Content-Length`,
sends half the body, drops the connection) and serves the full body on
the retry. Against the old code it fails with hyper `IncompleteBody`
after **1** attempt; with the fix it succeeds after **2**.

#### Reproduce end-to-end with `vp upgrade`

A mock registry truncates the platform tarball on **every** request. The
fixed `get_bytes` retries (4 tarball hits); the old one gives up after
1.

```bash
# build vp from this branch
cargo build -p vite_global_cli

# terminal A — truncating mock registry (script below)
node mock-registry.js

# terminal B — a real upgrade against it
# NO_PROXY is needed if you run a local/system HTTP proxy, so loopback isn't intercepted
NO_PROXY=127.0.0.1,localhost target/debug/vp upgrade --registry http://127.0.0.1:8911 --force
```

Watch terminal A's `[tarball] hit #N`:

| build | terminal A | result |
| --- | --- | --- |
| this branch (fixed) | `hit #1 #2 #3 #4` — retried | `Failed to
download platform package: … end of file before message length reached`
|
| before the fix | `hit #1` — no retry | same error |

Both end with the same error (the mock always truncates); the **hit
count** is the difference — on a real flaky network the retry usually
succeeds on attempt 2–4.

<details>
<summary><code>mock-registry.js</code></summary>

```js
// Truncates the platform tarball on every request (advertises a full
// Content-Length, sends a few bytes, drops the connection). Fixed get_bytes
// retries -> 4 tarball hits; the buggy one does not -> 1 hit.
const http = require('http');

const PORT = Number(process.env.PORT || 8911);
const VERSION = '9.9.9';
const FULL = 4096; // advertised Content-Length
const SENT = 100; // bytes actually sent before the drop

let tarballHits = 0;

function meta(tarballPath) {
  return JSON.stringify({
    version: VERSION,
    dist: {
      tarball: `http://127.0.0.1:${PORT}${tarballPath}`,
      integrity: 'sha512-AAAA', // never reached: the download always fails first
    },
  });
}

const server = http.createServer((req, res) => {
  const url = req.url;

  // Platform tarball: truncate every time.
  if (url === '/platform.tgz') {
    tarballHits += 1;
    console.log(`[tarball] hit #${tarballHits}  ->  send ${SENT}/${FULL} bytes then drop the connection`);
    const sock = res.socket;
    sock.write(
      'HTTP/1.1 200 OK\r\n' +
        'Content-Type: application/octet-stream\r\n' +
        `Content-Length: ${FULL}\r\n` +
        'Connection: close\r\n' +
        '\r\n',
    );
    sock.write(Buffer.alloc(SENT, 0x41));
    setTimeout(() => sock.destroy(), 80); // flush, then mid-body connection drop
    return;
  }

  console.log(`[meta] ${req.method} ${url}`);

  // Platform package metadata: /@voidzero-dev/vite-plus-cli-<suffix>/<version>
  if (url.includes('/vite-plus-cli-')) {
    res.writeHead(200, { 'content-type': 'application/json' });
    res.end(meta('/platform.tgz'));
    return;
  }

  // Main package metadata: /vite-plus/<tag-or-version>
  if (url.startsWith('/vite-plus/')) {
    res.writeHead(200, { 'content-type': 'application/json' });
    res.end(meta('/main.tgz'));
    return;
  }

  res.writeHead(404, { 'content-type': 'text/plain' });
  res.end('not found');
});

server.listen(PORT, '127.0.0.1', () => {
  console.log(`mock registry listening on http://127.0.0.1:${PORT}`);
});
```

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: MK (fengmk2) <[email protected]>
@fengmk2 fengmk2 mentioned this pull request Jun 30, 2026
feat(deps): upgrade upstream dependencies #1989
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@wan9chi wan9chi wan9chi approved these changes
+1 more reviewer
@sxzz sxzz sxzz left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@wan9chi wan9chi

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@webpro @wan9chi @sxzz
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.