Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change?
Previously (in #223 and v0.32.0 of this library) we read the version number from
package.json
by reading from a specific file path. To do this we had to setresolveJsonModule
totrue
.This resulted in
lib
(the output directory for TypeScript and entry point of the library) going from:to:
Note the extra
src
subdirectory. This impacts import statements. From:to:
😷
Using read-pkg-up means we do not need to set
resolveJsonModule
and can keep the oldlib
structure and sane import paths.The tests on read-pkg-up look sane, and setting
cwd
to__dirname
should be safe. As in it should always resolve to this library'spackage.json
when installed in other projects.During this investigation, I noticed the contents of the tarball we publish is essentially the entire contents of the repository minus
node_modules
. That is it includes config files for TS, Jest, ESLint etc.Set
paths
inpackage.json
to only includelib
in the tarball. Furthermore, remove__mock__
directories, as we do__snapshots__
.This results in the tarball including only 90 files vs the current 307. This can be demonstrated by running
npm pack
.npm pack before (on main)
npm pack after (on this branch)
Does this change require changes to existing projects or CDK CLI?
No. Nothing is using v0.32.0. I tried to update deploy-tools-platform and then noticed the import paths changing, hence this PR.
How to test
Run
npm pack
?How can we measure success?
We publish only the necessary files and get back to a sane path in import statements.
Have we considered potential risks?
n/a