This means that TS users who import from this module will get lots of errors relating to the source code.
It would be better if the types field instead just referred to some declaration files (.d.ts). These could be generated using the declaration compiler option. This way, users will only import the types—they won't be forced to type check the actual source code itself.
Solution
Using declarations: true in the root tsconfig.json seems to ensure the declaration files are built, but references in the monorepo seem to keep up-to-date with what is in the src folder for each workspace, thanks to the "module": "./" in each package.json and the root index.ts file referencing the src directory.
This presented a small problem in that we want to make sure that file isn't included in the build. I've also added files: ['dist', 'index.js'] to each (appropriate) package.json.
It looks like publishing works as expected
Fixes #105
Closes #117, #118
TODO
[x] 🤓 Add & update tests (always try to increase test coverage)
[x] 🔬 Ensure CI is passing (yarn lint:ci, yarn test, yarn tsc:ci)
Problem
(From #105, per @OliverJAsh ) The
types
field in thepackage.json
of@build-tracker/plugin-with-postgres
currently refers to the TS source code:https://github.com/paularmstrong/build-tracker/blob/f66274bba0003e58cd2922b759cc883222e21ac9/plugins/with-postgres/package.json#L10
This means that TS users who import from this module will get lots of errors relating to the source code.
It would be better if the
types
field instead just referred to some declaration files (.d.ts
). These could be generated using thedeclaration
compiler option. This way, users will only import the types—they won't be forced to type check the actual source code itself.Solution
Using
declarations: true
in the roottsconfig.json
seems to ensure the declaration files are built, but references in the monorepo seem to keep up-to-date with what is in thesrc
folder for each workspace, thanks to the"module": "./"
in eachpackage.json
and the rootindex.ts
file referencing thesrc
directory.This presented a small problem in that we want to make sure that file isn't included in the build. I've also added
files: ['dist', 'index.js']
to each (appropriate)package.json
.It looks like publishing works as expected
Fixes #105 Closes #117, #118
TODO
yarn lint:ci
,yarn test
,yarn tsc:ci
)