Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bump-homebrew-formula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Get version from package.json
id: extractver
run: |
VERSION=$(npm run get-version --silent)
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: mislav/bump-homebrew-formula-action@9d4d820e1d00b99927bd36e67d41fff1cfc8bd07 # v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
$version = "${{ github.event.inputs.version }}"
}
else {
$version = $(npm pkg get version)
$version = node -p "require('./package.json').version"
}

$version = $version.Replace("`"", "")
Expand Down
40 changes: 16 additions & 24 deletions .github/workflows/release-with-changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,24 @@ jobs:
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash
- if: steps.packagejson.outputs.exists == 'true'
name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.5
- if: steps.packagejson.outputs.exists == 'true'
name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "${{ steps.lockversion.outputs.version }}"
node-version-file: '.nvmrc'
registry-url: "https://registry.npmjs.org"
- if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest'
name: Install npm cli 8
shell: bash
# npm cli 10 is buggy because of some cache issues
run: npm install -g [email protected]
cache: "pnpm"
- if: steps.packagejson.outputs.exists == 'true'
name: Install dependencies
shell: bash
run: npm ci
run: pnpm install --frozen-lockfile
- if: steps.packagejson.outputs.exists == 'true'
name: Run test
run: npm test --if-present
run: pnpm test
- 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@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 # v3.15.1
Expand Down Expand Up @@ -93,25 +90,20 @@ jobs:
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash
- if: steps.packagejson.outputs.exists == 'true'
name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
name: Install pnpm
uses: pnpm/action-setup@v4
with:
node-version: ${{ vars.NODE_VERSION }}
version: 9.15.5
- if: steps.packagejson.outputs.exists == 'true'
name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "${{ steps.lockversion.outputs.version }}"
node-version-file: '.nvmrc'
cache: "pnpm"
- if: steps.packagejson.outputs.exists == 'true'
name: Install dependencies
shell: bash
run: npm ci
- if: steps.packagejson.outputs.exists == 'true'
name: Install changelog
shell: bash
# This step can be removed once the issue is fixed in the changeset package.
run: npm install @changesets/[email protected]
run: pnpm install --frozen-lockfile

- if: steps.packagejson.outputs.exists == 'true'
name: Publish to any of NPM, Github, and Docker Hub
Expand All @@ -120,11 +112,11 @@ jobs:
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
id: release
with:
version: npm run bump:version
version: pnpm run bump:version
commit: "chore(release): release and bump versions of packages"
title: "chore(release): release and bump versions of packages"
# Working around changesets action not supporting OIDC yet. Need to pass successful release output for triggering github release
publish: npm run publish:trusted
publish: pnpm run publish:trusted
setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
39 changes: 18 additions & 21 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
npm_script: pack:tarballs:alpine
dist_folder: tar
extension: alpine.tar.gz
container: 'node:20-alpine'
container: 'node:24-alpine'
alpine: true
- os: ubuntu-latest
npm_script: pack:windows
Expand All @@ -51,7 +51,7 @@ jobs:

steps:
- name: Install base tools for alpine container
if: matrix.container == 'node:20-alpine'
if: matrix.container == 'node:24-alpine'
run: |
apk add --no-cache bash git python3 make g++ perl-utils xz

Expand All @@ -60,23 +60,22 @@ jobs:

# Needed to avoid "fatal: detected dubious ownership in repository" error when using alpine container
- name: Mark GitHub workspace as safe
if: matrix.container == 'node:20-alpine'
if: matrix.container == 'node:24-alpine'
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"


- name: Check package-lock version
- name: Install pnpm
if: matrix.container == ''
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
id: lockversion
uses: pnpm/action-setup@v4
with:
node-version: ${{ vars.NODE_VERSION }}
version: 9.15.5

- name: Setup Node.js
if: matrix.container == ''
uses: actions/setup-node@v6
with:
node-version: "${{ steps.lockversion.outputs.version }}"
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Get version from package.json
uses: actions/github-script@v6
Expand All @@ -91,24 +90,22 @@ jobs:
name: Install p7zip-full nsis
run: sudo apt-get install -y p7zip-full nsis

- if: matrix.npm_script == 'pack:windows'
#npm cli 10 is buggy because of some cache issue
name: Install npm cli 10
shell: bash
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
shell: bash
run: |
corepack enable && corepack prepare [email protected] --activate
pnpm install --frozen-lockfile
- name: Build project
shell: bash
run: npm run prepublishOnly
run: pnpm run prepublishOnly
- name: Assets generation
shell: bash
run: |
npm run ${{ matrix.npm_script }}
pnpm run ${{ matrix.npm_script }}
if [[ "${{ matrix.alpine }}" == "true" ]]; then
npm run pack:rename alpine
pnpm run pack:rename alpine
else
npm run pack:rename
pnpm run pack:rename
fi

- name: Update release
Expand All @@ -125,4 +122,4 @@ jobs:
fields: repo,action,workflow
text: 'AsyncAPI CLI release build artifacts failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
23 changes: 12 additions & 11 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ cd cli

After cloning the repository, you should setup the fork properly and configure the `remote` repository as described [here](https://github.com/asyncapi/community/blob/master/git-workflow.md)

2. Install dependencies:
2. Install dependencies (Node 24+; enable Corepack so the repo’s pinned pnpm is used):

```bash
npm install
corepack enable
pnpm install
```

## Running tests
Expand All @@ -27,10 +28,10 @@ npm install

To run all tests locally:

- CLI tests: `npm run cli:test`
- Unit tests: `npm run unit:test`
- Github action tests: `npm run action:test`
- Single test file: `npm run test:one -- <path-to-test-file>`
- CLI tests: `pnpm run cli:test`
- Unit tests: `pnpm run unit:test`
- Github action tests: `pnpm run action:test`
- Single test file: `pnpm run test:one -- <path-to-test-file>`

### Adding tests

Expand Down Expand Up @@ -89,7 +90,7 @@ feat: add new feature

1. Create a new release markdown file using changeset CLI. Below command will trigger an interactive prompt that you can use to specify release type and affected packages.
```cli
npx -p @changesets/[email protected] changeset
pnpm exec changeset
```

2. Include the file in your pull request.
Expand Down Expand Up @@ -133,18 +134,18 @@ feat: add new feature

## Additional commands

- Lint the code: `npm run lint`
- Build Docker image: `npm run docker:build`
- Lint the code: `pnpm run lint`
- Build Docker image: `pnpm run docker:build`

## Troubleshooting

If you encounter any issues during development or testing, please check the following:

1. Ensure you're using the correct Node.js version (24.0.0 or higher) and npm version (8.19.0 or higher).
1. Ensure you're using Node.js 24.0.0 or higher and the pnpm version from `package.json` (`packageManager`); use `corepack enable` to activate it.
2. Clear the `node_modules` directory and reinstall dependencies if you encounter unexpected behavior.
3. For Docker-related issues, make sure Docker is running and you have sufficient permissions.
4. For permission errors, try: `sudo chown -R $(whoami) ./lib ./node_modules`
5. For path alias issues, rebuild the project: `npm run build`
5. For path alias issues, rebuild the project: `pnpm run build`

> 📘 **For comprehensive debugging help**, see the [Debugging & Testing Guide](/docs/debugging-testing.md).

Expand Down
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
FROM node:24-alpine AS build

RUN corepack enable && corepack prepare [email protected] --activate

# Copy the source code
COPY ./ /tmp/source_code

WORKDIR /tmp/source_code

# Install dependencies
RUN cd /tmp/source_code && npm install --ignore-scripts
RUN pnpm install --frozen-lockfile --ignore-scripts

# Build the source code
RUN cd /tmp/source_code && npm run build
RUN pnpm run build

# create libraries directory
RUN mkdir -p /libraries
Expand All @@ -16,7 +20,7 @@ RUN mkdir -p /libraries
RUN cp -r /tmp/source_code/lib /libraries
RUN cp -r /tmp/source_code/assets /libraries
RUN cp /tmp/source_code/package.json /libraries
RUN cp /tmp/source_code/package-lock.json /libraries
RUN cp /tmp/source_code/pnpm-lock.yaml /libraries
RUN cp /tmp/source_code/oclif.manifest.json /libraries

# Copy the bin directory to the /libraries directory
Expand All @@ -27,6 +31,8 @@ RUN rm -rf /tmp/*

FROM node:24-alpine

RUN corepack enable && corepack prepare [email protected] --activate

# Set ARG to explicit value to build chosen version. Default is "latest"
ARG ASYNCAPI_CLI_VERSION=

Expand All @@ -50,7 +56,7 @@ RUN apk --update add git chromium && \
COPY --from=build /libraries /libraries

# Install the dependencies
RUN cd /libraries && npm install --omit=dev --ignore-scripts
RUN cd /libraries && pnpm install --frozen-lockfile --prod --ignore-scripts

# Create a script that runs the desired command
RUN ln -s /libraries/bin/run_bin /usr/local/bin/asyncapi
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Read [DEVELOPMENT.md](/DEVELOPMENT.md) file for development setup.

Additional steps:

- Run `npm run test` to make sure everything is properly set up
- Run `npm run build` and then `bin/run` to try new CLI locally
- Run `pnpm test` to make sure everything is properly set up
- Run `pnpm run build` and then `bin/run` to try new CLI locally

The UX developed for the CLI should comply with the [Command Line Interface Guideline](https://clig.dev/)

Expand Down
Loading
Loading