generator icon indicating copy to clipboard operation
generator copied to clipboard

<node14 needed, if a npm-package with generator is a dependency of in a npm package

Open exDyballa opened this issue 3 years ago • 1 comments

Describe the bug

We have some applications, consisting of AWS microservices build with typescript. The connections of the applications are defined by async-api specifications. We have a npm-lib providing the applications with async-api-tools. Now we wanted to use the generator and start to produce MD-documentation by a npm script. Anything went fine until we try to use the spec-lib in the application-repos.

Part of the log (i cant attach a file) 1915 timing metavuln:load:security-advisory:ramldt2jsonschema:bdL/vdTdWEcA2Br3sVn9FlSV0mvK/PLlf6RO/QZtuHwreuf3mwwy51QfNjSGt9M/5Myoh4tEa0dypzQM8VvreQ== Completed in 0ms 1916 timing metavuln:calculate:security-advisory:ramldt2jsonschema:bdL/vdTdWEcA2Br3sVn9FlSV0mvK/PLlf6RO/QZtuHwreuf3mwwy51QfNjSGt9M/5Myoh4tEa0dypzQM8VvreQ== Completed in 293ms 1917 timing metavuln:packument:@company/specifications-events Completed in 1ms 1918 http fetch GET 200 https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.8.6.tgz 2789ms (cache miss) 1919 timing metavuln:cache:get:security-advisory:@company/specifications-events:tuc/FPz5bOKeyhKRZ7Yk1bsdqpdsiYrzrdyYypQgiUouJL0P5TQB6aaq3KCJbInZaFJvPP2fhLznXyH62s52pQ== Completed in 25ms 1920 verbose stack Error: loading from incorrect packument 1920 verbose stack at Advisory.load (/usr/local/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:91:27) 1920 verbose stack at Calculator.[calculate] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:60:14) 1920 verbose stack at async Promise.all (index 0) 1920 verbose stack at async Map.[init] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:188:9) 1920 verbose stack at async Map.run (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:109:7) 1921 verbose cwd /Users/user/projects/dd-accounts 1922 verbose Darwin 21.3.0 1923 verbose node v16.14.2 1924 verbose npm v8.19.2 1925 error loading from incorrect packument 1926 verbose exit 1

How to Reproduce

  • create a npm package A with node-version >14
  • create another package B with a dependency of generator 1.9.11
  • install B
  • You should receive the message "invalid packumage"

Expected behavior

  • usage of the latest stable node version
  • generate md-documentation

exDyballa avatar Sep 28 '22 06:09 exDyballa

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.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] avatar Sep 28 '22 06:09 github-actions[bot]

Hey @exDyballa , thanks but I need more details.

We test this package with node 16 and all is working well -> https://github.com/asyncapi/generator/blob/master/.github/workflows/pr-testing-with-test-project.yml#L15

I think I understand what you are doing. Basically to make sure other teams use generator and markdown-template in the sam way, you do not let them to use the library directly, but you abstract it with your custom library. Right?

But I do not get why you think it is node version related. The error doesn't say that

I found something like https://github.com/npm/cli/issues/4534 I don't think it is generator related

derberg avatar Oct 11 '22 12:10 derberg

hmh we solved the issue by changing the node version not the npm-cli.

I didnt explain it good enough. I think your test doesnt fulfill the scenario. We have one spec-repo filled with some domains containing some applications. Each application has an async-api-file. This is hosted by a versionized npm-lib providing generated code and npm-script-cmds.

The applications have a repo using 1 version of the spec-lib. It is providing code in the first place and a cmd to generate the docs. So the application-owners have to care for producing the docs and the spec-lib cares what is produced... f.e. the rendered async-api-file, md-docs. Also here we have a good syncronization with the versions. So regardless if this is a good flow, if we run the command it is necessary to have the generator as dependency in the package.json. then it is producing the error at installing, if node.version > 13 && generator is in the dependency.

exDyballa avatar Oct 11 '22 13:10 exDyballa

I don't think I fully understand

even if our testing scenario has different flow, it rungs generator on node 16 which means it works with node 16

did you have a look at https://github.com/verdaccio/verdaccio/issues/3065#issuecomment-1070979764? and the fix proposed?

where is your template located? are you using official markdown-template or something custom you have on your private npm registry?

derberg avatar Oct 11 '22 13:10 derberg

official md-template. Right now the(my) knowledge is not deep enough. I've seen the comment and understand it like case-sensitivity is the problem. Since I made the test with the generator changing the dependencies in the packages, I thought the generator is including some packages with upper letters.

exDyballa avatar Oct 12 '22 06:10 exDyballa

official md-template

ok, but do you take it directly from official npm, or you have some mirror of npm in your company? as this may cause an issue

maybe you can test to use template directly from https://github.com/asyncapi/markdown-template/tarball/v1.2.0 instead of @asyncapi/markdown-template. Generator fetch templates using official npm tool, so we support anything that you can already do with npm install

derberg avatar Oct 12 '22 08:10 derberg

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

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 :heart:

github-actions[bot] avatar Feb 10 '23 00:02 github-actions[bot]