Skip to content

Fix package.json files field (was shipping an empty package)#15

Merged
markwpearce merged 2 commits into
mainfrom
fix/npm-files-field
Jul 16, 2026
Merged

Fix package.json files field (was shipping an empty package)#15
markwpearce merged 2 commits into
mainfrom
fix/npm-files-field

Conversation

@markwpearce

@markwpearce markwpearce commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Found while preparing the first-ever npm/ROPM publish.

Fixed here:

  1. "files": ["dist/**/*"] pointed at a directory that has never existed (bsc's outDir is build/, not dist/). npm pack --dry-run confirmed the tarball would contain only LICENSE/README.md/package.json - zero BrighterScript source. Fixed to src/**/*, excluding src/source/roku_modules/** (our own locally-installed copy of rodash, which consumers regenerate for themselves).
  2. ropm.rootDir only controls where our own project installs its ropm dependencies (rodash) - it has no effect on how ropm resolves file locations for consumers installing us. That's ropm.packageRootDir, which was missing entirely. Without it, a consumer's ropm install would try to copy from the package root instead of src/.

Verified both fixes with a real end-to-end test: npm pack → install the tarball as a dependency in a scratch project → ropm installbsc --validate. Files now land correctly under roku_modules, prefixed as expected.

Not fixed here - found via that same test, needs its own investigation before an actual publish:
That end-to-end test surfaced ~1640 real compile errors for the consumer, from issues in the engine source itself, not this config:

  • ~676 errors: bare BGE.something self-references inside our own source (called from within the BGE namespace itself) don't get rewritten by ropm's prefixer when it renames the namespace for a consumer
  • ~90 errors: ropm's rewriter incorrectly prefixes native Roku SDK types (roTimespan, roBitmap, roAssociativeArray, etc.) in as X type-annotation position, as if they were our own custom types
  • 20 errors: our dev environment installs rodash under the friendly alias rodash, but a downstream consumer's transitive install resolves it as tkss_rodash_v0 (derived from the real npm name @tkss/rodash), so our bundled code's bare rodash.xxx() calls don't resolve for anyone but us

None of the existing examples would ever catch this, since they consume the engine via a direct file-copy trick in bsconfig.json, never through real ropm install. Publishing is on hold until that's addressed.

Test plan

  • npm run validate / npm run lint pass
  • npm pack --dry-run includes all engine source, excludes roku_modules
  • Real ropm-consumer test confirms files now install to the right location, correctly prefixed
  • This PR's own validate check passes

markwpearce and others added 2 commits July 16, 2026 14:51
"files": ["dist/**/*"] pointed at a directory that has never existed
in this repo (bsc's outDir is build/, not dist/) - `npm pack --dry-run`
confirmed the published tarball would contain only LICENSE, README,
and package.json, with zero BrighterScript source. Since this
package has never been published, this bug was never caught.

Changed to src/**/* (matching ropm.rootDir), excluding
src/source/roku_modules/** - that's the locally ropm-installed copy
of rodash, which consumers regenerate for themselves via their own
`ropm install`, not something we should ship inside our own package.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ropm.rootDir only controls where OUR OWN project installs its ropm
dependencies (rodash) - it has no effect on how ropm resolves file
locations for consumers installing this package. That's controlled
by ropm.packageRootDir, which was missing entirely, so a consumer
would have had ropm try to copy from the package root instead of
src/, finding nothing usable.

Verified with a real end-to-end test (npm pack -> install as a
dependency in a scratch project -> ropm install -> bsc --validate):
files now land correctly under roku_modules and are prefixed as
expected. However, that same test surfaced ~1640 real compile errors
for the consumer, caused by issues in the engine source itself (bare
BGE self-references not getting rewritten by ropm's prefixer, native
Roku SDK types like roTimespan/roBitmap getting incorrectly prefixed
in type-annotation position, and a rodash alias-name mismatch between
our own dev install and a downstream transitive install). Those are
out of scope for this PR and need their own investigation before an
actual publish.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@markwpearce
markwpearce merged commit 2f88e3f into main Jul 16, 2026
1 check passed
@markwpearce
markwpearce deleted the fix/npm-files-field branch July 16, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant