Page MenuHomePhabricator

[ecash-lib] Fix: Built JS files are in `dist/src`, not `dist`
ClosedPublic

Authored by tobias_ruck on Apr 28 2024, 00:43.

Details

Summary

The 0.2.0-rc version is currently broken, as the source files are emitted to dist/src, not dist:
https://www.npmjs.com/package/ecash-lib/v/0.2.0-rc?activeTab=code

The cause of this is that we included a tests folder for functional tests, and TS seems to take interpret this such that both src and tests should be emitted in their respective folders (dist/src and dist/tests). When publishing, tests is excluded by the .npmignore, so only src remains

To fix this, we introduce a tsconfig.build.json, which extends from tsconfig.json, and both have different purposes:

  • tsconfig.json is only for typechecking (hence noEmit), and includes tests. It's picked up by VSCode etc.
  • tsconfig.build.json is only for building, and excludes tests. This makes the test part in the npmignore obsolete, but we can keep it for good measure.

We also update npm run build such that it typechecks first, and then builds the package.

Test Plan

npm run build, make sure dist has no src or tests folder, but has the files directly

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ecash-lib-fix-dist
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28779
Build 57096: Build Diffecash-lib-integration-tests · ecash-lib-tests
Build 57095: arc lint + arc unit