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 — fix: resolve compiled output from dist in bin and postinstall by edusperoni · Pull Request #6095 · NativeScript/nativescript-cli

Conversation

@edusperoni

@edusperoni edusperoni commented Jul 29, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Collaborator

PR Checklist

  • The PR title follows our guidelines.
  • There is an issue for the bug/feature this PR is for. (no tracking issue — happy to open one)
  • You have signed the CLA.
  • All existing tests are passing (1514 passing, unchanged).
  • Tests for the changes are included. (the failure is not reachable from the unit suite — verification below)

A regression from #6092. The release-script half of this went straight to main as cb3fb8db5, since it was blocking publishing; this is the remainder.

What is the current behavior?

bin/tns and postinstall.js resolve into lib/ relative to their own location:

pathToLib = path.join(__dirname, "..", "lib");          // bin/tns
require(path.join(__dirname, "lib", "constants"));      // postinstall.js

Since the build moved output to dist/, lib/ holds only TypeScript, so from a checkout:

$ ./bin/tns --version
Error: Cannot find module '.../lib/common/verify-node-version'

The published package is unaffected — dist/ is its root there, so lib/ already sits next to bin/. Only the source tree broke, which is exactly why the packaging verification on #6092 did not catch it.

npm install in a checkout runs postinstall and hits the same failure. That is masked today only because npm run setup passes --ignore-scripts.

What is the new behavior?

Both prefer dist/lib when it exists and fall back otherwise, so neither needs to know which layout it is in. The remaining bin/ entries (nativescript, ns, nsc, …) all require("./tns"), so they are fixed with it.

Verification

Not reachable from the unit suite, so both layouts were exercised directly:

  • Checkout: ./bin/tns --version reports, ./bin/tns renders 56 help rows, the nativescript/ns/nsc aliases work, node postinstall.js resolves
  • Installed package: packed, installed into a clean consumer, confirmed the fallback is the branch taken (no dist/lib present) — --version reports, help renders 56 rows, postinstall.js resolves
  • 1514 passing, unchanged

Worth noting for follow-up: nothing in the suite executes bin/tns in either layout, which is why this class of bug is invisible to CI. A smoke test covering both would close that.

Summary by CodeRabbit

  • Bug Fixes
    • Improved CLI startup across both published package installations and source checkouts.
    • Improved post-install setup by correctly locating required files in different package layouts.
    • Prevented installation and command-loading issues caused by incorrect library paths.

Sorry, something went wrong.

Uh oh!

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

All reactions
@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The CLI bootstrap and postinstall script now detect dist/lib and fall back to lib, allowing module resolution in both published packages and source checkouts.

Changes

Runtime library resolution

Layer / File(s) Summary
Published and source library resolution
bin/tns, postinstall.js
Both entry points select dist/lib when it exists and otherwise resolve required modules from lib.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A bunny checked the paths with care,
Found dist/lib waiting there.
If that burrow wasn’t found,
lib kept modules safe and sound.
Hops now work from every ground.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: preferring compiled output from dist in bin and postinstall.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

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

@edusperoni edusperoni closed this Jul 29, 2026
@edusperoni
edusperoni force-pushed the fix/dist-entrypoints branch from d26d893 to cb3fb8d Compare July 29, 2026 16:08
@edusperoni
fix: resolve compiled output from dist in bin and postinstall
9ba5092
Both resolve into lib/ relative to their own location, which stopped working
when the build moved output to dist/: lib/ now holds only TypeScript, so
running ./bin/tns or postinstall.js from a checkout fails with
MODULE_NOT_FOUND. The published package is unaffected, since dist/ is its
root and lib/ already sits next to bin/ there.

Both now prefer dist/lib when it exists and fall back otherwise, which covers
the checkout and the package without either needing to know which it is. The
other bin entries delegate to ./tns, so they are fixed with it.

npm install in a checkout runs postinstall and would hit the same failure -
masked only because npm run setup passes --ignore-scripts.
@edusperoni edusperoni reopened this Jul 29, 2026
@edusperoni edusperoni changed the title fix: repair the entry points and release script broken by the dist build fix: resolve compiled output from dist in bin and postinstall Jul 29, 2026
NathanWalker
NathanWalker approved these changes Jul 29, 2026
View reviewed changes
@NathanWalker
NathanWalker merged commit 77fed31 into main Jul 29, 2026
7 checks passed

Uh oh!

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

@NathanWalker
NathanWalker deleted the fix/dist-entrypoints branch July 29, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@NathanWalker NathanWalker NathanWalker approved these changes

Uh oh!

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

Assignees

No one assigned

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.

2 participants

@edusperoni @NathanWalker
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 01402503 — 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.