-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undeclared dependencies error under Yarn PnP #733
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
@magicmatatjahu @smoya can you have a look? it makes sense to me. we should not do things like actually I'm surprised how this got pass through linter 🤔 for me |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
I don't have any additional details, but this is definitely still an issue. |
ping @magicmatatjahu @smoya - can you have a look? |
I couldn't reproduce the issue. I used the following code: import { Parser, Diagnostic, fromFile, DiagnosticSeverity } from '@asyncapi/parser';
const parser = new Parser();
function prettyPrint(diagnostics: Diagnostic[]) {
for (const diagnostic of diagnostics) {
if (diagnostic.severity === DiagnosticSeverity.Error) {
console.log(diagnostic.severity, 'ERR', diagnostic.message);
} else {
console.log(diagnostic.severity, diagnostic.message);
}
}
}
const parse = async () => {
const { document, diagnostics } = await fromFile(parser, './asyncapi.yaml').parse();
prettyPrint(diagnostics);
console.log("Done");
};
parse();
Anyway, @gabormagyar Is there anything I need to do to reproduce the issue? Maybe you can share a snippet of code reproducing the issue? 🙏 |
You can try something like this: mkdir asynctest
cd asynctest
yarn init -2
echo "nodeLinker: pnp" >> .yarnrc.yml
yarn add @asyncapi/generator @asyncapi/html-template Then add this to {
"scripts": {
"asyncapi": "ag asyncapi.yml @asyncapi/html-template"
}
} And finally, run: yarn asyncapi That returns:
After adding the |
Hello, @woylie! 👋🏼 I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand! At the moment the following comments are supported in issues:
|
@woylie thanks for sharing! I could finally reproduce it. The important piece was to set the linker to pnp (as in your example) 👍 . @woylie @gabormagyar any of you happy to create a PR with the fix? |
🎉 This issue has been resolved in version 2.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 3.0.0-next-major-spec.16 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the bug
Yarn PnP needs all dependencies to be declared. This causes an error at runtime when the parser tries to access the following dependencies that are not declared in the manifest.
Example:
The workaround is to add the undeclared dependencies to the user package's
.yarnrc.yml
file like so:The solution is to add these as dependencies or peerDependencies (optional or otherwise).
How to Reproduce
Install and run the parser under Yarn PnP package manager
Full errors with call stack:
@stoplight/types
Offending line seems to be this one: https://github.com/asyncapi/parser-js/blob/next-major/src/index.ts#L1
@stoplight/json
Offending line seems to be this one: https://github.com/asyncapi/parser-js/blob/next-major/src/ruleset/utils/mergeTraits.ts#L1
@stoplight/spectral-ref-resolver
Offending line seems to be this one: https://github.com/asyncapi/parser-js/blob/next-major/src/resolver.ts#L1
@stoplight/json-ref-readers
Offending line seems to be this one: https://github.com/asyncapi/parser-js/blob/next-major/src/resolver.ts#L2
The text was updated successfully, but these errors were encountered: