Skip to content

[APAM-733] Fix wrong package.json import path in built output#44

Merged
weiping-awx merged 1 commit into
mainfrom
fix/APAM-733-version
May 13, 2026
Merged

[APAM-733] Fix wrong package.json import path in built output#44
weiping-awx merged 1 commit into
mainfrom
fix/APAM-733-version

Conversation

@weiping-awx
Copy link
Copy Markdown
Contributor

@weiping-awx weiping-awx commented May 13, 2026

Summary

  • Fixes Wrong import path for package.json in functions.js #43import { version } from '../package.json' in src/functions.ts resolved correctly from source (src/) but became a broken path in the compiled lib/module/ and lib/commonjs/ output
  • Introduces scripts/generate-version.js which generates src/version.ts from package.json at build time
  • src/functions.ts now imports version from ./version, a path that is stable in both source and built output
  • package.json remains the single source of truth — update-versions.sh also regenerates src/version.ts whenever the version is bumped in CI

Test plan

  • Verify yarn prepare runs without errors and src/version.ts is regenerated with the correct version
  • Verify the built lib/module/functions.js and lib/commonjs/functions.js reference ./version (not ../package.json)
  • Install the package in a React Native app and confirm the Unable to resolve "../package.json" error is gone
  • Simulate a version bump by setting VERSION=x.y.z and running .github/scripts/update-versions.sh — confirm both package.json and src/version.ts are updated

🤖 Generated with Claude Code

Fixes #43. `import { version } from '../package.json'` resolved
correctly from `src/` but became a broken path in the compiled
`lib/module/` and `lib/commonjs/` output.

Introduces `scripts/generate-version.js` which derives `src/version.ts`
from `package.json` at build time. `src/functions.ts` now imports from
`./version`, a path that is stable in both source and built output.
`package.json` remains the single source of truth — `update-versions.sh`
regenerates `src/version.ts` whenever the version is bumped in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@weiping-awx weiping-awx requested a review from aw-hector May 13, 2026 05:46
@weiping-awx weiping-awx merged commit 976c624 into main May 13, 2026
5 checks passed
@weiping-awx weiping-awx deleted the fix/APAM-733-version branch May 13, 2026 06:25
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.

Wrong import path for package.json in functions.js

2 participants