Skip to content

Commit

Permalink
Merge branch 'master' into feat/supportV3Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Sep 6, 2023
2 parents 9978b2c + d143cf6 commit c6e5aea
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/bump-homebrew-formula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-docs-in-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/update-docs-on-docs-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ asyncapi.json
asyncapi.yml
test/minimaltemplate/__transpiled
.vscode


oclif.manifest.json
spec-examples.zip
3 changes: 3 additions & 0 deletions assets/create-glee-app/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
20 changes: 10 additions & 10 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`

Expand All @@ -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`

Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand All @@ -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`

Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand All @@ -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`

Expand Down Expand Up @@ -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)_
<!-- commandsstop -->
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 .",
Expand All @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions src/models/Context.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -329,9 +329,8 @@ async function getContextFilePath(): Promise<string | null> {
// 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 &&
Expand Down

0 comments on commit c6e5aea

Please sign in to comment.