Description
Expected Behaviour
The exports
should be valid for the Node.js runtime and point to files that exist and are the correct file type.
Current Behaviour
Some packages have slightly incorrect exports
.
For example, packages/idempotency/package.json
currently has an import
and require
pointing to a .d.ts
file. This should be a .js
file.
There are also issues in packages/parameters/package.json
(same as above) and packages/jmespath/package.json
(missing files)
Code snippet
These should be .js
files.
powertools-lambda-typescript/packages/idempotency/package.json
Lines 61 to 64 in 2383c14
powertools-lambda-typescript/packages/parameters/package.json
Lines 53 to 56 in 2383c14
The files referenced here do not exist.
powertools-lambda-typescript/packages/jmespath/package.json
Lines 40 to 43 in 2383c14
Steps to Reproduce
I recently released https://www.npmjs.com/package/validate-package-exports to help validate packages I publish to make sure I don't miss anything. Since I use Powertools, I thought I'd use it as a demo package while developing the tool.
To validate all packages, run this in the root of the repo.
find ./packages/ -maxdepth 2 -name package.json -exec npx validate-package-exports -p {} -vs \;
If you want to validate one at a time, use this:
npx validate-package-exports --check --verify --package [PATH-TO-PACKAGE.JSON]
Possible Solution
Update */types
exports to look like this.
"./types": {
"require": {
"types": "./lib/cjs/types/index.d.ts",
"default": "./lib/cjs/types/index.js"
},
"import": {
"types": "./lib/esm/types/index.d.ts",
"default": "./lib/esm/types/index.js"
}
}
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status