diff --git a/.github/workflows/bump-homebrew-formula.yml b/.github/workflows/bump-homebrew-formula.yml index 06fba3f0d61..d419fc283e4 100644 --- a/.github/workflows/bump-homebrew-formula.yml +++ b/.github/workflows/bump-homebrew-formula.yml @@ -23,13 +23,15 @@ jobs: with: # A PR will be sent to github.com/Homebrew/homebrew-core to update AsyncAPI CLI formula: formula-name: asyncapi + # https://github.com/mislav/bump-homebrew-formula-action/issues/58 + formula-path: Formula/a/asyncapi.rb tag-name: ${{ steps.extractver.outputs.version }} download-url: https://registry.npmjs.org/@asyncapi/cli/-/cli-${{ steps.extractver.outputs.version }}.tgz #we need to point to npm not github as there is a dist that is not on github env: COMMITTER_TOKEN: ${{ secrets.GH_TOKEN_BOT_EVE }} - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel name: Report workflow run status to Slack - uses: 8398a7/action-slack@v3 + uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1 with: status: ${{ job.status }} fields: repo,action,workflow diff --git a/.github/workflows/update-docs-in-website.yml b/.github/workflows/update-docs-in-website.yml index 4235d0b0dff..7572ccf86d7 100644 --- a/.github/workflows/update-docs-in-website.yml +++ b/.github/workflows/update-docs-in-website.yml @@ -15,11 +15,11 @@ jobs: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} steps: - name: Checkout Current repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: cli - name: Checkout Another repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: asyncapi/website path: website diff --git a/.github/workflows/update-docs-on-docs-commits.yml b/.github/workflows/update-docs-on-docs-commits.yml index 9d4405e3234..a07cc79571f 100644 --- a/.github/workflows/update-docs-on-docs-commits.yml +++ b/.github/workflows/update-docs-on-docs-commits.yml @@ -15,17 +15,19 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v3 + - name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version: "${{ steps.lockversion.outputs.version }}" - name: Install dependencies run: npm ci - name: Regenerate docs run: npm run generate:assets --if-present - name: Create Pull Request with updated docs if: startsWith(github.event.commits[0].message, 'docs:') - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # use 4.2.4 https://github.com/peter-evans/create-pull-request/releases/tag/v4.2.4 with: token: ${{ secrets.GH_TOKEN }} commit-message: 'chore: update generated docs' diff --git a/.github/workflows/upload-release-assets.yml b/.github/workflows/upload-release-assets.yml index bf11cd4ab5c..3b9139b3c71 100644 --- a/.github/workflows/upload-release-assets.yml +++ b/.github/workflows/upload-release-assets.yml @@ -42,10 +42,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + id: lockversion - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version: "${{ steps.lockversion.outputs.version }}" cache: 'npm' cache-dependency-path: '**/package-lock.json' - name: Get version from package.json @@ -70,7 +73,7 @@ jobs: token: ${{ secrets.GH_TOKEN }} - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel name: Report workflow run status to Slack - uses: 8398a7/action-slack@v3 + uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #using https://github.com/8398a7/action-slack/releases/tag/v3.15.1 with: status: ${{ job.status }} fields: repo,action,workflow diff --git a/.gitignore b/.gitignore index 13feba0d0a3..f1631e26fea 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,5 @@ asyncapi.json asyncapi.yml test/minimaltemplate/__transpiled .vscode - - +oclif.manifest.json spec-examples.zip \ No newline at end of file diff --git a/assets/create-glee-app/templates/default/package.json b/assets/create-glee-app/templates/default/package.json index 085d6341f34..c225bf52276 100644 --- a/assets/create-glee-app/templates/default/package.json +++ b/assets/create-glee-app/templates/default/package.json @@ -25,5 +25,8 @@ "homepage": "https://github.com/asyncapi/glee-hello-world#readme", "dependencies": { "@asyncapi/glee": "^0.26.2" + }, + "devDependencies": { + "@types/node": "^20.5.9" } } diff --git a/docs/usage.md b/docs/usage.md index dae57e7f7ae..8d568f00532 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -29,7 +29,7 @@ $ npm install -g @asyncapi/cli $ asyncapi COMMAND running command... $ asyncapi (--version) -@asyncapi/cli/0.54.3 linux-x64 node-v18.17.1 +@asyncapi/cli/0.54.5 linux-x64 node-v18.17.1 $ asyncapi --help [COMMAND] USAGE $ asyncapi COMMAND @@ -93,7 +93,7 @@ EXAMPLES $ asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./asyncapi.yaml --reference-into-components ``` -_See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/bundle.ts)_ +_See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/bundle.ts)_ ## `asyncapi config` @@ -107,7 +107,7 @@ DESCRIPTION CLI config settings ``` -_See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/config/index.ts)_ +_See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/config/index.ts)_ ## `asyncapi config context` @@ -282,7 +282,7 @@ DESCRIPTION Convert asyncapi documents older to newer versions ``` -_See code: [src/commands/convert.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/convert.ts)_ +_See code: [src/commands/convert.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/convert.ts)_ ## `asyncapi diff OLD NEW` @@ -337,7 +337,7 @@ DESCRIPTION Find diff between two asyncapi files ``` -_See code: [src/commands/diff.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/diff.ts)_ +_See code: [src/commands/diff.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/diff.ts)_ ## `asyncapi generate` @@ -351,7 +351,7 @@ DESCRIPTION Generate typed models or other things like clients, applications or docs using AsyncAPI Generator templates. ``` -_See code: [src/commands/generate/index.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/generate/index.ts)_ +_See code: [src/commands/generate/index.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/generate/index.ts)_ ## `asyncapi generate fromTemplate ASYNCAPI TEMPLATE` @@ -513,7 +513,7 @@ EXAMPLES $ asyncapi new --file-name=my-asyncapi.yml --example=default-example.yml --no-tty - create a new file with a specific name, using one of the examples and without interactive mode ``` -_See code: [src/commands/new/index.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/new/index.ts)_ +_See code: [src/commands/new/index.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/new/index.ts)_ ## `asyncapi new file` @@ -634,7 +634,7 @@ EXAMPLES $ asyncapi optimize ./asyncapi.yaml --optimization=remove-components,reuse-components,move-to-components --output=terminal --no-tty ``` -_See code: [src/commands/optimize.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/optimize.ts)_ +_See code: [src/commands/optimize.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/optimize.ts)_ ## `asyncapi start` @@ -648,7 +648,7 @@ DESCRIPTION Start asyncapi studio ``` -_See code: [src/commands/start/index.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/start/index.ts)_ +_See code: [src/commands/start/index.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/start/index.ts)_ ## `asyncapi start studio` @@ -692,5 +692,5 @@ DESCRIPTION validate asyncapi file ``` -_See code: [src/commands/validate.ts](https://github.com/asyncapi/cli/blob/v0.54.3/src/commands/validate.ts)_ +_See code: [src/commands/validate.ts](https://github.com/asyncapi/cli/blob/v0.54.5/src/commands/validate.ts)_ diff --git a/package-lock.json b/package-lock.json index 5c0129e4eea..b257d9ebcd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asyncapi/cli", - "version": "0.54.4", + "version": "0.54.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@asyncapi/cli", - "version": "0.54.4", + "version": "0.54.6", "license": "Apache-2.0", "dependencies": { "@asyncapi/avro-schema-parser": "^3.0.2", diff --git a/package.json b/package.json index 4c6d6d43726..ae130cb8366 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@asyncapi/cli", "description": "All in one CLI for all AsyncAPI tools", - "version": "0.54.4", + "version": "0.54.6", "author": "@asyncapi", "bin": { "asyncapi": "./bin/run" @@ -128,7 +128,7 @@ }, "repository": "asyncapi/cli", "scripts": { - "build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && echo \"Build Completed\"", + "build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && oclif manifest && echo \"Build Completed\"", "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", "dev": "tsc --watch", "docker:build": "docker build -t asyncapi/cli:latest .", @@ -144,8 +144,7 @@ "pack:tarballs": "oclif pack tarballs -t linux-x64 && npm run pack:rename", "pack:windows": "oclif pack win && npm run pack:rename", "pack:rename": "node scripts/releasePackagesRename.js", - "postpack": "rimraf oclif.manifest.json", - "prepublishOnly": "npm run build && oclif manifest", + "prepublishOnly": "npm run build", "pretest:coverage": "npm run build", "release": "semantic-release", "pretest": "npm run build", diff --git a/src/models/Context.ts b/src/models/Context.ts index 57cf54a63a1..2a85009d52d 100644 --- a/src/models/Context.ts +++ b/src/models/Context.ts @@ -1,4 +1,4 @@ -import { promises as fs, existsSync, lstatSync } from 'fs'; +import { readFileSync, promises as fs, existsSync, lstatSync } from 'fs'; import * as path from 'path'; import * as os from 'os'; @@ -329,9 +329,8 @@ async function getContextFilePath(): Promise { // legitimate context file, then it is considered a legitimate context // file indeed. const fileContent = JSON.parse( - await readFile(currentPathString, { - encoding: 'utf8', - }) + //we do not use await readFile because getContextFilePath cannot be called inside async function + readFileSync(currentPathString, {encoding: 'utf8'}) ); if ( fileContent &&