-
Notifications
You must be signed in to change notification settings - Fork 8.3k
fix(core): plugins are always reinstalled #9675
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
Open
neriousy
wants to merge
28
commits into
anomalyco:dev
Choose a base branch
from
neriousy:fix/slow-plugins
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+133
−39
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
beff163
fix: slow plugins
neriousy 9a84dba
Merge branch 'dev' into fix/slow-plugins
neriousy be79d7c
feat(core): add Npm module for version management and update BunProc …
neriousy 71a274c
revert(desktop): undo slow server guard
neriousy 1d954eb
refactor: streamline dependency installation logic and improve versio…
neriousy 1038fc1
feat: handle custom registries
neriousy 4d4c02c
feat(core): add semver dependency and enhance version retrieval npm m…
neriousy 11a5976
fix: semver version
neriousy 0f282dc
refactor: npm -> package-registry
neriousy d04f4d8
fix: types semver ver
neriousy 9ce1240
wip
neriousy b9a2ff4
refactor
neriousy 9d0a325
clean up
neriousy c37becb
Merge branch 'dev' into fix/slow-plugins
neriousy e6030de
mock test
neriousy caeaa38
fix: last one
neriousy 0b783cd
new lock file
neriousy 19c2aa4
remove semver dependency
neriousy 87e0c43
Merge branch 'dev' into fix/slow-plugins
neriousy 3170262
Merge branch 'dev' into fix/slow-plugins
neriousy 7bcf7ef
Merge branch 'dev' into fix/slow-plugins
neriousy 0609a92
restore lock file from dev
neriousy b57788b
remove mocks
neriousy 3169695
revert changes
neriousy 3fb7de1
fix: plugin package reinstall
neriousy ef0767e
Merge branch 'dev' into fix/slow-plugins
neriousy ac56535
remove dead codE
neriousy 83f833c
review: refactor
neriousy 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
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,48 @@ | ||
| import { readableStreamToText, semver } from "bun" | ||
| import { Log } from "../util/log" | ||
|
|
||
| export namespace PackageRegistry { | ||
| const log = Log.create({ service: "bun" }) | ||
|
|
||
| function which() { | ||
| return process.execPath | ||
| } | ||
|
|
||
| export async function info(pkg: string, field: string, cwd?: string): Promise<string | null> { | ||
| const result = Bun.spawn([which(), "info", pkg, field], { | ||
| cwd, | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| env: { | ||
|
Comment on lines
+12
to
+16
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't we use BunProc here instead? it already bakes in the which() logic
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah ig circular dep |
||
| ...process.env, | ||
| BUN_BE_BUN: "1", | ||
| }, | ||
| }) | ||
|
|
||
| const code = await result.exited | ||
| const stdout = result.stdout ? await readableStreamToText(result.stdout) : "" | ||
| const stderr = result.stderr ? await readableStreamToText(result.stderr) : "" | ||
|
|
||
| if (code !== 0) { | ||
| log.warn("bun info failed", { pkg, field, code, stderr }) | ||
| return null | ||
| } | ||
|
|
||
| const value = stdout.trim() | ||
| if (!value) return null | ||
| return value | ||
| } | ||
|
|
||
| export async function isOutdated(pkg: string, cachedVersion: string, cwd?: string): Promise<boolean> { | ||
| const latestVersion = await info(pkg, "version", cwd) | ||
| if (!latestVersion) { | ||
| log.warn("Failed to resolve latest version, using cached", { pkg, cachedVersion }) | ||
| return false | ||
| } | ||
|
|
||
| const isRange = /[\s^~*xX<>|=]/.test(cachedVersion) | ||
| if (isRange) return !semver.satisfies(latestVersion, cachedVersion) | ||
|
|
||
| return semver.order(cachedVersion, latestVersion) === -1 | ||
| } | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.