HomePhabricator

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

Description

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

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

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D16063

Details

Provenance
tobias_ruckAuthored on Apr 28 2024, 00:42
tobias_ruckPushed on Apr 29 2024, 22:56
Reviewer
Restricted Project
Differential Revision
D16063: [ecash-lib] Fix: Built JS files are in `dist/src`, not `dist`
Parents
rABC894c058950f4: refactor: make active_chain_tip a reference
Branches
Unknown
Tags
Unknown