Skip to content

Commit

Permalink
fix:nklf
Browse files Browse the repository at this point in the history
  • Loading branch information
AceTheCreator committed Aug 12, 2024
2 parents 6e6e79c + d2ebc57 commit 14620a8
Show file tree
Hide file tree
Showing 87 changed files with 2,210 additions and 2,316 deletions.
64 changes: 64 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"env": {
"browser": true,
"es6": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:react/recommended",
"next/core-web-vitals",
"plugin:sonarjs/recommended",
"plugin:jest/recommended",
"prettier"
],
"plugins": [
"eslint-plugin-import",
"eslint-plugin-react",
"@typescript-eslint",
"@typescript-eslint/tslint",
"sonarjs",
"jest",
"prettier"
],
"settings": {
"next": {
"rootDir": "playground/"
}
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"./library/tsconfig.json",
"./library/e2e/tsconfig.json",
"./playground/tsconfig.json",
"./web-component/tsconfig.json"
]
},
"root": true,
"rules": {
"prettier/prettier": "error",
"jest/expect-expect": [
"error",
{
"assertFunctionNames": ["expect", "cy"]
}
]
},
"ignorePatterns": [
"library/browser",
"library/lib",
"library/e2e/plugins/index.js",
"library/loaders/remove-hashbag-loader.js",
"library/jest.config.js",
"library/postcss.config.js",
"library/webpack.config.js",
"library/tailwind.config.js",
"playground/out",
"playground/postcss.config.js",
"web-component/lib",
"web-component/webpack.config.js"
]
}
50 changes: 43 additions & 7 deletions .github/workflows/bounty-program-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ on:
types:
- created

env:
BOUNTY_PROGRAM_LABELS_JSON: |
[
{"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"}
]
jobs:
guard-against-unauthorized-use:
if: >
github.actor != ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
startsWith(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest
Expand All @@ -46,15 +52,10 @@ jobs:
if: >
github.actor == ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
startsWith(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest
env:
BOUNTY_PROGRAM_LABELS_JSON: |
[
{"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"}
]

steps:
- name: Add label `bounty`
Expand Down Expand Up @@ -88,3 +89,38 @@ jobs:
repo: context.repo.repo,
labels: [BOUNTY_PROGRAM_LABELS[0].name]
})
remove-label-bounty:
if: >
github.actor == ('aeworxet' || 'thulieblack') &&
(
startsWith(github.event.comment.body, '/unbounty' )
)
runs-on: ubuntu-latest

steps:
- name: Remove label `bounty`
uses: actions/github-script@v6

with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON);
let LIST_OF_LABELS_FOR_ISSUE = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
LIST_OF_LABELS_FOR_ISSUE = LIST_OF_LABELS_FOR_ISSUE.data.map(key => key.name);
if (LIST_OF_LABELS_FOR_ISSUE.includes(BOUNTY_PROGRAM_LABELS[0].name)) {
console.log('Removing label `bounty`...');
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: [BOUNTY_PROGRAM_LABELS[0].name]
})
}
4 changes: 3 additions & 1 deletion .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- if: >
!github.event.pull_request.draft && !(
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/if-nodejs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- next-major-spec
- beta
- alpha
- next

jobs:

Expand All @@ -32,7 +33,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
Expand Down Expand Up @@ -128,4 +131,4 @@ jobs:
fields: repo,action,workflow
text: 'Release workflow failed in release job'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
6 changes: 0 additions & 6 deletions .github/workflows/issues-prs-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
name: Notify slack on every new issue
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Convert markdown to slack markdown for issue
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: issuemarkdown
Expand All @@ -40,8 +38,6 @@ jobs:
name: Notify slack on every new pull request
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Convert markdown to slack markdown for pull request
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: prmarkdown
Expand All @@ -60,8 +56,6 @@ jobs:
name: Notify slack on every new pull request
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Convert markdown to slack markdown for pull request
uses: asyncapi/.github/.github/actions/slackify-markdown@master
id: discussionmarkdown
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/release-wc-and-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ jobs:
package: ./web-component/package.json
access: public
tag: github.event.release.target_commitish
- 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
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'Release of web component for AsyncAPI React failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}

playground:
name: Release Playground
Expand All @@ -76,9 +85,6 @@ jobs:
node-version: "${{ steps.lockversion.outputs.version }}"
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Use latest version of react component in the playground
run: VERSION=${{github.event.release.tag_name}} npm run install:reactcomp
working-directory: ./playground
- name: Install dependencies
run: npm install
- name: Build
Expand All @@ -92,3 +98,12 @@ jobs:
folder: playground/out
git-config-name: asyncapi-bot
git-config-email: [email protected]
- 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
with:
status: ${{ job.status }}
fields: repo,action,workflow
text: 'Release of playground for AsyncAPI React failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ tasks:
# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
ports:
- port: 3000
onOpen: open-preview
onOpen: open-preview
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ lerna-debug.log*
/.github

playground/.next/
playground/out/
9 changes: 8 additions & 1 deletion docs/configuration/config-modification.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface ConfigInterface {
servers?: boolean;
operations?: boolean;
messages?: boolean;
messageExamples?: boolean;
schemas?: boolean;
errors?: boolean;
};
Expand All @@ -26,6 +27,7 @@ interface ConfigInterface {
sidebar?: {
showServers?: 'byDefault' | 'bySpecTags' | 'byServersTags';
showOperations?: 'byDefault' | 'bySpecTags' | 'byOperationsTags';
useChannelAddressAsIdentifier?: boolean;
},
parserOptions?: ParserOptions;
publishLabel?: string;
Expand All @@ -45,13 +47,18 @@ interface ConfigInterface {
- **show?: Partial<ShowConfig>**

This field contains configuration responsible for rendering specific parts of the AsyncAPI component.
All except the `sidebar` fields are set to `true` by default.
The `sidebar` and `messageExamples` fields are set to `false` by default. The default for all other fields is `true`.

The examples for messages shown within an operation are always displayed. To also show examples for the
standalone messages in the "Messages" section, set `messageExamples` to `true`.

- **sidebar?: Partial<SideBarConfig>**

This field contains configuration responsible for the way of working of the sidebar.
`showServers` field is set to `byDefault` by default.
`showOperations` field is set to `byDefault` by default.
`useChannelAddressAsIdentifier`: for AsyncAPI v3 documents, use the operation summary or channel address in the sidebar instead of the operationId.
By default, this behavior is applied only to AsyncAPI v2 documents.

- **expand?: Partial<ExpandConfig>**

Expand Down
1 change: 1 addition & 0 deletions library/e2e/integration/standalone.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jest/valid-title */
describe('Standalone bundle', () => {
testSuite('With parser', 'e2e/sites/standalone.html');
testSuite('With parser for v3', 'e2e/sites/standalone-v3.html');
Expand Down
2 changes: 1 addition & 1 deletion library/e2e/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ const webpackOptions = {
},
};

module.exports = on => {
module.exports = (on) => {
on('file:preprocessor', wp({ webpackOptions }));
};
2 changes: 1 addition & 1 deletion library/loaders/remove-hashbag-loader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Make sure code does not contain properties such as `#property`
*/
module.exports = function(source) {
module.exports = function (source) {
return source.replace(/^#! .*\n/, '');
};
28 changes: 14 additions & 14 deletions library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/react-component",
"version": "1.4.9",
"version": "2.2.0",
"private": false,
"description": "A React component for AsyncAPI specification.",
"repository": {
Expand Down Expand Up @@ -68,33 +68,33 @@
"get:version": "echo $npm_package_version"
},
"dependencies": {
"@asyncapi/avro-schema-parser": "^3.0.22",
"@asyncapi/openapi-schema-parser": "^3.0.22",
"@asyncapi/parser": "^3.0.14",
"@asyncapi/protobuf-schema-parser": "^3.2.12",
"@asyncapi/avro-schema-parser": "^3.0.24",
"@asyncapi/openapi-schema-parser": "^3.0.24",
"@asyncapi/parser": "^3.1.0",
"@asyncapi/protobuf-schema-parser": "^3.2.14",
"highlight.js": "^10.7.2",
"isomorphic-dompurify": "^0.13.0",
"isomorphic-dompurify": "^2.12.0",
"marked": "^4.0.14",
"openapi-sampler": "^1.2.1",
"use-resize-observer": "^8.0.0"
"use-resize-observer": "^9.1.0"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
},
"devDependencies": {
"@cypress/webpack-preprocessor": "^5.9.0",
"@tailwindcss/typography": "^0.4.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.5",
"@testing-library/react": "^15.0.4",
"@testing-library/user-event": "^12.8.3",
"@types/dompurify": "^2.0.4",
"@types/highlight.js": "^10.1.0",
"@types/jest": "^26.0.23",
"@types/marked": "^4.0.1",
"@types/node": "^12.7.2",
"@types/react": "^16.9.2",
"@types/react-dom": "^17.0.3",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"autoprefixer": "^10.2.5",
"cross-env": "^7.0.3",
"cssnano": "^4.1.11",
Expand All @@ -105,8 +105,8 @@
"postcss-cli": "^8.3.1",
"postcss-import": "^14.0.2",
"postcss-scopify": "^0.1.9",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^2.1.1",
"ts-jest": "^26.4.1",
"ts-loader": "9.4.4",
Expand Down
Loading

0 comments on commit 14620a8

Please sign in to comment.