Skip to content

Commit

Permalink
feat: Use npmcli config in asyncapi generator (npn path, node version)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierrick BOULÉ committed Apr 16, 2024
1 parent d0f0b41 commit 336a01e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-testing-with-test-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '12', '14', '16', '18' ]
node: [ '14', '16', '18', '20' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ You can use the generator library to generate whatever you want in your event-dr

## Prerequisites
Before you install and use the AsyncAPI CLI and the generator library, ensure you meet the prerequisites below, then [install the CLI](#installation).
1. Node.js v12.16 and higher
2. Npm v6.13.7 and higher
1. Node.js v16.20.2 and higher
2. Npm v8.19.4 and higher

To verify the versions of Node and Npm you have, run the following command on your terminal:
```
Expand Down
4 changes: 2 additions & 2 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const git = require('simple-git');
const log = require('loglevel');
const Arborist = require('@npmcli/arborist');
const Config = require('@npmcli/config');
const requireg = require('requireg');
const npmPath = requireg.resolve('npm').replace('index.js','');

const { isAsyncAPIDocument } = require('@asyncapi/parser/cjs/document');

Expand Down Expand Up @@ -583,8 +585,6 @@ class Generator {

if (isFileSystemPath(this.templateName)) log.debug(logMessage.NPM_INSTALL_TRIGGER);

const npmPath = process.execPath.replace('/bin/node','/lib/node_modules/npm/');

const config = new Config({
definitions,
flatten,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"ag": "./cli.js"
},
"engines": {
"node": ">12.16",
"npm": ">6.13.7"
"node": ">16.20.2",
"npm": ">8.19.4"
},
"scripts": {
"test": "npm run test:unit && npm run test:integration && npm run test:cli",
Expand Down Expand Up @@ -66,6 +66,7 @@
"minimatch": "^3.0.4",
"node-fetch": "^2.6.0",
"nunjucks": "^3.2.0",
"requireg": "^0.2.2",
"resolve-from": "^5.0.0",
"resolve-pkg": "^2.0.0",
"semver": "^7.3.2",
Expand Down

0 comments on commit 336a01e

Please sign in to comment.