Make npm link the default install method, add --native flag#458
Merged
Make npm link the default install method, add --native flag#458
Conversation
Scoped npm packages (e.g. @crowdin/cli) caused install failures because the title defaulted to the full package name including the @scope/ prefix. The bundlers used that title as a file/directory name, so the slash was interpreted as a path separator and the launcher write failed with FileNotFoundException at e.g. linux-x64/@crowdin/cli. Default the title to the unscoped name segment when no explicit title or displayName is provided, fixing local install (jdeploy install) and published install for scoped packages.
`jdeploy install` was switched to the new headless installer flow in 533764a (the local-install command). That broke npm-distributed CLIs like crowdin-cli that relied on the prior behavior of `jdeploy install` == `npm link`, since the headless flow uses the title as a file name and breaks on scoped packages, and more fundamentally was never the right default for those projects. - `jdeploy install` now defaults to npm link again. - `jdeploy install --native` opts into the headless installer (the flow used for local GUI testing). - `--npm` is kept as a no-op alias for back-compat. - `jdeploy run --install` and `jdeploy debug --install` always use the native install flow, since LocalRunService requires its on-disk layout. - Updates internal scripts (install-and-launch.sh, dev-install-and-launch.sh, e2e-local-test.sh, e2e-local-test.ps1) to pass --native explicitly. - Adds e2e-npm-link-test.sh + workflow exercising the default flow: generate picocli project, build, `jdeploy install`, verify the bin command is on $PATH and runnable.
…-link e2e The first CI run failed at the '--help' step with no diagnostic output — the output was redirected to the log file only, and any non-zero exit was treated as failure. picocli templates can legitimately return non-zero for --help (e.g. exit 2). Only fail on 126/127 (couldn't exec) and always echo what the bin actually printed so we can see what happened on future failures.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR inverts the default installation behavior:
jdeploy installnow usesnpm linkby default (the fastest way to test CLI commands locally), while full native installation (with native launchers, GUI integration, services, etc.) is now opt-in via the--nativeflag. This aligns with the typical npm package workflow where developers test locally before publishing.Key Changes
Inverted install defaults:
jdeploy installnow defaults to npm link; use--nativefor full native installationUpdated CLI flags:
--npmflag for backward compatibility (now documents the default behavior)--nativeflag to explicitly request full native installationUpdated install scripts: Modified
install-and-launch.shanddev-install-and-launch.shto use--nativeflag since they require the native launcher layout forjdeploy runUpdated E2E tests: Modified existing local tests to use
--nativeflag to exercise the full headless install flowAdded npm link E2E tests: New comprehensive end-to-end test suite (
e2e-npm-link-test.sh) that validates the default npm link installation flow on Linux and macOS via GitHub ActionsAdded NpmPackageUtils helper: New utility class to handle npm scoped package names (e.g.,
@scope/name) by stripping the scope prefix for use in file/directory namesImproved title resolution: Updated title derivation logic across multiple services to use priority:
jdeploy.title>displayName>name(with npm scope stripped), ensuring scoped packages generate valid titlesImplementation Details
runanddebugcommands continue to use native installation internally (viainstall(context, false, aiTools)) since they depend on the native launcher layout provided byLocalRunServicehttps://claude.ai/code/session_01UTq5nFdqXBStHfYDBhYdgg