Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR changes the validation of an npm package from running a compile script to directly importing its entry point with Node, adds support for main and exports.import fields, and updates tests and versioning.
- Extend
PackageJsoninterface to readmainandexports.import - Remove TS compile project generation and replace with
node -e "import …"validation - Add test for packages exporting a JSON entry point and bump versions
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/validate-npm-package/validate-npm-package.ts | Support main/exports.import, generate only package.json, and verify via direct node -e "import …" |
| src/validate-npm-package/validate-npm-package.spec.ts | Add a test case for JSON-only entry-point packages |
| package.json | Bump action version and update dependency versions |
Comments suppressed due to low confidence (3)
src/validate-npm-package/validate-npm-package.ts:89
- [nitpick] The error message could be clearer about what fields were expected. Consider:
"No import entry point found: please define either 'main' or 'exports import' in package.json."
throw new TypeError('no import entry point found, or not defined following our standards.');
src/validate-npm-package/validate-npm-package.spec.ts:39
- [nitpick] This test has no explicit assertions and passes by not throwing. Consider adding an
expect(e.g.,expect(() => verifyNpmPackage()).resolves.toBeUndefined()) to make the intent explicit.
it('config only package exporting json entry point should work too', async () => {
src/validate-npm-package/validate-npm-package.ts:65
- The JSON import assertion syntax is invalid. Replace
with { type: 'json' }withassert { type: 'json' }to match Node's supported ESM import assertions.
const importType = importEntryPoint.endsWith('.json') ? ` with { type: 'json' }` : '';
…ce without direct dependency with serve-runtime, e.g. connector
|
Coverage after merging validate-npm-package-skip-if-no-compilation-needed into main will be
Coverage Report
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #90