Page MenuHomePhabricator

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

Authored by tobias_ruck on Sun, Apr 28, 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable