Git Product home page Git Product logo

template-for-generator-templates's Issues

Peer dependency issues

Describe the bug

After cloning the project, npm install has a bunch of complaints about peer dependencies

How to Reproduce

❯ node -v                                                                                                                                 ─╯
v16.19.0
❯ npm install

This will print:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^7.7.0" from the root project
npm ERR!   peer eslint@"*" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/experimental-utils
npm ERR!     @typescript-eslint/experimental-utils@"^2.5.0" from [email protected]
npm ERR!     node_modules/eslint-plugin-jest
npm ERR!       dev eslint-plugin-jest@"^23.20.0" from the root project
npm ERR!   2 more (eslint-plugin-jest, eslint-plugin-react)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-sonarjs
npm ERR!   dev eslint-plugin-sonarjs@"^0.5.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" from [email protected]
npm ERR!   node_modules/eslint-plugin-sonarjs
npm ERR!     dev eslint-plugin-sonarjs@"^0.5.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

Expected behavior

For the dependency resolution to be fixed, without the need of --legacy-peer-deps

template for generator templates proxy support

Describe the bug

So I cloned the https://github.com/asyncapi/template-for-generator-templates via the Use button into my own repo. Before I made any particular change I figured I would test things by running npm run test

How to Reproduce

Steps to reproduce the issue. Attach all resources that can help us understand the issue:

npm run test from a location where public URLs accessible only via a proxy I get

FAIL test/template/templateGenerationResult.test.js (108.184 s)
 templateGenerationResult() › generated correct index.html with diagram source

    thrown: "Exceeded timeout of 100000 ms for a hook.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      17 |     await generator.generateFromURL(dummySpecUrl);
      18 |   });
    > 19 |
         | ^
      20 |   it('generated correct index.html with diagram source', async () => {
      21 |     const index = await readFile(path.join(outputDir, 'index.html'), 'utf8');
      22 |     expect(index).toMatchSnapshot();

      at test/template/templateGenerationResult.test.js:19:3
      at Object.<anonymous> (test/template/templateGenerationResult.test.js:17:1)

I had a hunch this would be proxy related so I defined a quick test -

import fetch from 'node-fetch';
import HttpProxyAgent from 'https-proxy-agent'

(async () => {
    const proxyAgent = new HttpProxyAgent.HttpsProxyAgent('<INSERT PROXY DETAILS>');

    try{

        const response = await fetch('https://rawcdn.githack.com/asyncapi/generator/v1.0.1/test/docs/dummy.yml', { agent: proxyAgent});
        const body = await response.text();
        console.log(body);

    } catch (error){
        console.log('error', error)
    }
    
})();

This pulled the file fine.
Seems that somehow we would need asyncapi/generator/utils.fetchSpec to optionally be passed further config e.g.


utils.fetchSpec = (link) => {
  return new Promise((resolve, reject) => {
    fetch(link, { agent: proxyAgent})
      .then(res => resolve(res.text()))
      .catch(reject);
  });
};
  • Screenshots
  • Link to GitHub repository with project that has issues
  • Files that can help reproduce the issue, like your AsyncAPI file, either paste inside the issue in a code block or in a sharable gist

Expected behavior

Tests pass when fetching remote URLs via a proxy

I had tried to hack my utils.js direct in node_modules in my repo but then I got another weird error -

    Cannot find module './mkdir' from 'node_modules/@asyncapi/generator/node_modules/fs.extra/node_modules/fs-extra/lib/json.js'

    Require stack:
      node_modules/@asyncapi/generator/node_modules/fs.extra/node_modules/fs-extra/lib/json.js
      node_modules/@asyncapi/generator/node_modules/fs.extra/node_modules/fs-extra/lib/index.js
      node_modules/@asyncapi/generator/node_modules/fs.extra/fs.extra.js
      node_modules/@asyncapi/generator/lib/generator.js
      test/template/templateGenerationResult.test.js

But any workaround would be useful since all I was after was defining a new template :-)

Update README with new logo banner

Reason/Context

This is to replace the old AsyncAPI logo in this repo's README with the banner attached below that represents the new branding.

Here are a few guidelines for this change as well:

  1. Make sure you are using Markdown syntax only
  2. Be sure to remove the old logo as well as the old title of the repo as this image will replace both elements
  3. Make sure you link this image to the website: https://www.asyncapi.com
  4. If there is any description text below the repo title, let's make it left-aligned if it isn't already, so as to match the left-alignment of the content in the new banner image

Download the image file:
github-repobanner-generic.png.zip


Banner preview

Please note that this is only a preview of the image, the contributor should download and use the above zip file

github-repobanner-generic

Need for urgent changes in GitHub Actions automation

This issue defines a list of tasks that need to be performed in this repo to make sure it's ci/cd automation works long term without any issues.

It is up to maintainers to decide if it must be addressed in one or multiple PRs.

Below are 3 different sections describing 3 different important ci/cd changes.

IMPORTANT-START
For GitHub workflows that contain This workflow is centrally managed in https://github.com/asyncapi/.github/ you do not have to perform any work. These workflows were already updated through the update in .github. The only exception is the workflows related to nodejs release. More details in Upgrade Release pipeline - in case of nodejs projects section
IMPORTANT-END

Deprecation of way data is shared between steps

Every single GitHub Action workflow that has echo "::set-output name={name}::{value}" need to be updated to follow echo "{name}={value}" >> $GITHUB_OUTPUT

We do not yet know when set-output will stop working. Previous disable date was 31.05 but now then say community needs more time.

For more details read official article from GitHub

Deprecation of node12

2nd bullet point is still relevant for you even if your projects in not nodejs project

  • Every single workflow that uses setup-node action needs an update to follow v3 version of this action, and make sure minimum node 14 is used
  • Now this part is more complex. Problem with node12 is that node-based GitHub Actions were using it in majority as a runtime environment. Look for example at this action.yaml file for setup-node action v2. So the job that you have to do is go through all the workflows, and verify every single action that you use, make sure you are using the latest version that is not based on node12. I already did review a lot of actions as part of this PR so maybe you will find some actions there and can copy from me. For example action/checkout needs to be updated to v3.

Node12 end of support in action is probably September 27th.

For more details read official article from GitHub

Upgrade Release pipeline - in case of nodejs projects

ignore this section if your project is not nodejs project

You have 2 options. You can:

A. choose to switch to new release pipeline using instruction from asyncapi/.github#205

B. stay with old release pipeline, and manually update GitHub workflows and actions used in it, you can inspire a lot from this PR asyncapi/.github#226

I definitely recommend going with A

Workflows related to release:

  • .github/workflows/if-nodejs-release.yml
  • .github/workflows/if-nodejs-version-bump.yml
  • .github/workflows/bump.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.