diff --git a/.changeset/many-feet-begin.md b/.changeset/many-feet-begin.md new file mode 100644 index 000000000..35bdddaa1 --- /dev/null +++ b/.changeset/many-feet-begin.md @@ -0,0 +1,5 @@ +--- +"@asyncapi/studio": minor +--- + +Shift the production environment to Next.JS diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 353095205..8bdbce0c0 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,4 +1,4 @@ # Disable specific file since it would introduce more complexity to reduce it - mainly code complexity and complex template literals -sonar.exclusions=apps/studio/public/js/monaco/**,apps/studio/src/tailwind.css,apps/studio/src/components/SplitPane/**,apps/studio-next/cypress/**,apps/studio-next/Dockerfile +sonar.exclusions=apps/studio/public/js/monaco/**,apps/studio/src/tailwind.css,apps/studio/src/components/SplitPane/**,apps/studio/cypress/**,apps/studio/Dockerfile # Disable duplicate code in tests since it would introduce more complexity to reduce it. -sonar.cpd.exclusions=apps/studio/**,apps/studio-next/src/components/Navigationv3.tsx,apps/studio-next/src/components/Navigation.tsx,apps/studio-next/cypress/**,apps/studio-next/src/helpers/driver.ts +sonar.cpd.exclusions=apps/studio/** diff --git a/apps/design-system/package.json b/apps/design-system/package.json index 2c360e535..0c37e3988 100644 --- a/apps/design-system/package.json +++ b/apps/design-system/package.json @@ -45,14 +45,14 @@ "@babel/preset-react": "^7.22.3", "@babel/preset-typescript": "^7.24.1", "@storybook/addon-actions": "^7.6.18", - "@storybook/addon-docs": "^7.6.18", + "@storybook/addon-docs": "^7.6.20", "@storybook/addon-essentials": "^7.6.18", "@storybook/addon-interactions": "^7.6.18", "@storybook/addon-links": "^7.6.18", "@storybook/addons": "^7.6.18", "@storybook/blocks": "^7.6.18", "@storybook/preset-create-react-app": "^7.6.18", - "@storybook/react": "^7.6.18", + "@storybook/react": "^7.6.20", "@storybook/react-webpack5": "^7.6.18", "@storybook/test": "^7.6.18", "@storybook/theming": "^7.6.18", @@ -65,7 +65,7 @@ "react-docgen-typescript": "^2.2.2", "react-docgen-typescript-plugin": "^1.0.5", "remark-gfm": "^3.0.1", - "storybook": "^7.0.20", + "storybook": "^7.6.20", "tailwind-config": "workspace:*", "tailwindcss": "^3.4.3", "ts-loader": "^9.4.3", diff --git a/apps/studio-next/.eslintrc b/apps/studio-next/.eslintrc deleted file mode 100644 index c1da477ee..000000000 --- a/apps/studio-next/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "es6": true, - "browser": true, - "node": true - }, - "plugins": ["security"], - "extends":["eslint-config-custom", "eslint-config-custom/react"] -} diff --git a/apps/studio-next/.gitignore b/apps/studio-next/.gitignore deleted file mode 100644 index 4c47dd76c..000000000 --- a/apps/studio-next/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/.pnp -.pnp.js - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/apps/studio-next/CHANGELOG.md b/apps/studio-next/CHANGELOG.md deleted file mode 100644 index 7f787b852..000000000 --- a/apps/studio-next/CHANGELOG.md +++ /dev/null @@ -1,25 +0,0 @@ -# studio-next - -## 0.1.4 - -### Patch Changes - -- 877810d: fix: temporarily hard-lock `@asyncapi/converter` on `v1.5.0` as a hotfix (#1138) - -## 0.1.3 - -### Patch Changes - -- 943fec1: fix: report correct `range` values in error diagnostics for YAML files - -## 0.1.2 - -### Patch Changes - -- c3248c8: fix: fix the validation error for payload of type `date` (https://github.com/asyncapi/parser-js/issues/980) - -## 0.1.1 - -### Patch Changes - -- a4b7fd1: Use Next.js framework diff --git a/apps/studio-next/README.md b/apps/studio-next/README.md deleted file mode 100644 index f4da3c4c1..000000000 --- a/apps/studio-next/README.md +++ /dev/null @@ -1,34 +0,0 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). - -## Getting Started - -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/apps/studio-next/netlify.toml b/apps/studio-next/netlify.toml deleted file mode 100644 index 44143e1a6..000000000 --- a/apps/studio-next/netlify.toml +++ /dev/null @@ -1,6 +0,0 @@ -[devs] - functions = "apps/studio-next/src/netlify/functions" - targetPort = 3001 - -[build] - functions = "apps/studio-next/src/netlify/functions" \ No newline at end of file diff --git a/apps/studio-next/package.json b/apps/studio-next/package.json deleted file mode 100644 index 6530f14f0..000000000 --- a/apps/studio-next/package.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "name": "studio-next", - "version": "0.1.4", - "private": true, - "scripts": { - "dev": "next dev -p 3001", - "build": "next build", - "start": "next start", - "lint": "next lint", - "lint:fix": "next lint --fix", - "cy:e2e:chrome": "cypress run --e2e --browser chrome", - "cy:e2e:chromium": "cypress run --e2e --browser chromium", - "cy:e2e:edge": "cypress run --e2e --browser edge", - "cy:e2e:electron": "cypress run --e2e --browser electron", - "cy:e2e:firefox": "cypress run --e2e --browser firefox", - "cy:open": "cypress open" - }, - "dependencies": { - "@asyncapi/avro-schema-parser": "^3.0.19", - "@asyncapi/converter": "1.5.0", - "@asyncapi/openapi-schema-parser": "^3.0.18", - "@asyncapi/parser": "^3.2.2", - "@asyncapi/protobuf-schema-parser": "^3.2.8", - "@asyncapi/react-component": "^1.2.2", - "@asyncapi/specs": "^6.5.4", - "@codemirror/view": "^6.26.3", - "@ebay/nice-modal-react": "^1.2.10", - "@headlessui/react": "^1.7.4", - "@hookstate/core": "^4.0.0-rc21", - "@monaco-editor/react": "^4.4.6", - "@netlify/blobs": "^8.0.1", - "@netlify/functions": "^2.8.1", - "@stoplight/yaml": "^4.3.0", - "@tippyjs/react": "^4.2.6", - "@types/node": "20.4.6", - "@types/react": "18.2.18", - "@types/react-dom": "18.2.7", - "autoprefixer": "10.4.14", - "codemirror": "^6.0.1", - "driver.js": "^1.3.1", - "eslint-config-next": "13.4.12", - "js-base64": "^3.7.3", - "js-file-download": "^0.4.12", - "js-yaml": "^4.1.0", - "monaco-editor": "0.34.1", - "monaco-yaml": "4.0.2", - "next": "14.2.3", - "postcss": "8.4.31", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-hot-toast": "2.4.0", - "react-icons": "^4.6.0", - "reactflow": "^11.2.0", - "tailwindcss": "3.3.3", - "tippy.js": "^6.3.7", - "typescript": "5.1.6", - "zustand": "^4.5.2" - }, - "devDependencies": { - "@asyncapi/dotnet-nats-template": "^0.12.1", - "@asyncapi/go-watermill-template": "^0.2.72", - "@asyncapi/html-template": "^2.3.0", - "@asyncapi/java-spring-cloud-stream-template": "^0.13.4", - "@asyncapi/java-spring-template": "^1.5.1", - "@asyncapi/java-template": "^0.2.1", - "@asyncapi/markdown-template": "^1.5.0", - "@asyncapi/nodejs-template": "^2.0.1", - "@asyncapi/nodejs-ws-template": "^0.9.33", - "@asyncapi/python-paho-template": "^0.2.13", - "@asyncapi/ts-nats-template": "^0.10.3", - "@tailwindcss/typography": "^0.5.8", - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "^14.4.3", - "@types/jest": "^29.2.3", - "@types/js-yaml": "^4.0.5", - "@types/json-schema": "^7.0.11", - "@types/node": "^18.11.9", - "@types/react": "^18.0.25", - "@types/react-dom": "^18.0.9", - "assert": "^2.0.0", - "autoprefixer": "^10.4.13", - "browserify-zlib": "^0.2.0", - "buffer": "^6.0.3", - "cypress": "^13.10.0", - "eslint-config-next": "14.1.4", - "eslint-plugin-security": "^1.5.0", - "eslint-plugin-sonarjs": "^0.16.0", - "https-browserify": "^1.0.0", - "markdown-toc": "^1.2.0", - "path-browserify": "^1.0.1", - "postcss": "^8.4.31", - "process": "^0.11.10", - "stream-browserify": "^3.0.0", - "stream-http": "^3.2.0", - "tailwindcss": "^3.2.4", - "ts-node": "^10.9.1", - "url": "^0.11.0", - "util": "^0.12.5", - "web-vitals": "^3.1.0", - "webpack": "^5.75.0" - }, - "packageManager": "pnpm@9.0.6" -} diff --git a/apps/studio-next/public/_redirects b/apps/studio-next/public/_redirects deleted file mode 100644 index 9392728f9..000000000 --- a/apps/studio-next/public/_redirects +++ /dev/null @@ -1,19 +0,0 @@ -# Redirect editor.asyncapi.org to Studio - -http://editor.asyncapi.org/* https://studio.asyncapi.com 301! -https://editor.asyncapi.org/* https://studio.asyncapi.com 301! - -# Redirect playground.asyncapi.io to Studio - -http://playground.asyncapi.io/* https://studio.asyncapi.com/?redirectedFrom=playground 301! -https://playground.asyncapi.io/* https://studio.asyncapi.com/?redirectedFrom=playground 301! - -http://playground.asyncapi.io/* load=:load https://studio.asyncapi.com/?redirectedFrom=playground&load=:load 301! -https://playground.asyncapi.io/* load=:load https://studio.asyncapi.com/?redirectedFrom=playground&load=:load 301! -http://playground.asyncapi.io/* load=:load readOnly=:readOnly https://studio.asyncapi.com/?redirectedFrom=playground&load=:load&readOnly=true 301! -https://playground.asyncapi.io/* load=:load readOnly=:readOnly https://studio.asyncapi.com/?redirectedFrom=playground&load=:load&readOnly=true 301! - -http://playground.asyncapi.io/* url=:url https://studio.asyncapi.com/?redirectedFrom=playground&url=:url 301! -https://playground.asyncapi.io/* url=:url https://studio.asyncapi.com/?redirectedFrom=playground&url=:url 301! -http://playground.asyncapi.io/* url=:url readOnly=:readOnly https://studio.asyncapi.com/?redirectedFrom=playground&url=:url&readOnly=true 301! -https://playground.asyncapi.io/* url=:url readOnly=:readOnly https://studio.asyncapi.com/?redirectedFrom=playground&url=:url&readOnly=true 301! diff --git a/apps/studio-next/public/favicon-16x16.png b/apps/studio-next/public/favicon-16x16.png deleted file mode 100644 index f52b03ec9..000000000 Binary files a/apps/studio-next/public/favicon-16x16.png and /dev/null differ diff --git a/apps/studio-next/public/favicon-194x194.png b/apps/studio-next/public/favicon-194x194.png deleted file mode 100644 index 0d6bc7985..000000000 Binary files a/apps/studio-next/public/favicon-194x194.png and /dev/null differ diff --git a/apps/studio-next/public/favicon-32x32.png b/apps/studio-next/public/favicon-32x32.png deleted file mode 100644 index a65f8093c..000000000 Binary files a/apps/studio-next/public/favicon-32x32.png and /dev/null differ diff --git a/apps/studio-next/public/img/logo-studio.svg b/apps/studio-next/public/img/logo-studio.svg deleted file mode 100644 index e663e2b0e..000000000 --- a/apps/studio-next/public/img/logo-studio.svg +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/studio-next/public/img/meta-studio-og-image.jpeg b/apps/studio-next/public/img/meta-studio-og-image.jpeg deleted file mode 100644 index 1a6b4b2de..000000000 Binary files a/apps/studio-next/public/img/meta-studio-og-image.jpeg and /dev/null differ diff --git a/apps/studio-next/public/img/survey-illustration.svg b/apps/studio-next/public/img/survey-illustration.svg deleted file mode 100644 index cd45a399d..000000000 --- a/apps/studio-next/public/img/survey-illustration.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/studio-next/public/robots.txt b/apps/studio-next/public/robots.txt deleted file mode 100644 index e9e57dc4d..000000000 --- a/apps/studio-next/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/apps/studio-next/scripts/template-parameters.ts b/apps/studio-next/scripts/template-parameters.ts deleted file mode 100644 index 1aba2b808..000000000 --- a/apps/studio-next/scripts/template-parameters.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* eslint-disable security/detect-non-literal-fs-filename */ - -import fs from 'fs'; -import path from 'path'; -import { JSONSchema7 } from 'json-schema'; - -const DESTINATION_JSON = path.join(__dirname, '../src/components/Modals/Generator/template-parameters.json'); -const TEMPLATES: Record = { - '@asyncapi/dotnet-nats-template': '.NET NATS Project', - '@asyncapi/dotnet-rabbitmq-template': '.NET C# RabbitMQ Project', - '@asyncapi/go-watermill-template': 'GO Lang Watermill Project', - '@asyncapi/html-template': 'HTML website', - '@asyncapi/java-spring-cloud-stream-template': 'Java Spring Cloud Stream Project', - '@asyncapi/java-spring-template': 'Java Spring Project', - '@asyncapi/java-template': 'Java Project', - '@asyncapi/markdown-template': 'Markdown Documentation', - '@asyncapi/nodejs-template': 'NodeJS Project', - '@asyncapi/nodejs-ws-template': 'NodeJS WebSocket Projects', - '@asyncapi/php-template': 'PHP RabbitMQ Project', - '@asyncapi/python-paho-template': 'Python Paho Project', - '@asyncapi/ts-nats-template': 'Typescript NATS Project', -}; -const SUPPORTED_TEMPLATES = Object.keys(TEMPLATES); - -interface TemplateParameter { - description?: string; - default?: any; - required?: boolean; -} - -interface TemplateConfig { - parameters: Record; -} - -function serializeParam(configParam: TemplateParameter): JSONSchema7 { - const param: JSONSchema7 = { - description: configParam.description, - }; - - if (typeof configParam.default === 'boolean' || configParam.default === 'true' || configParam.default === 'false') { - param.type = 'boolean'; - if (typeof configParam.default === 'boolean') { - param.default = configParam.default; - } else if (configParam.default === 'true') { - param.default = true; - } else if (configParam.default === 'false') { - param.default = false; - } - } else if (typeof configParam.default === 'number') { - param.type = 'number'; - param.default = Number(configParam.default); - } else { - param.type = 'string'; - param.default = configParam.default; - } - - return param; -} - -function serializeTemplateParameters(config: TemplateConfig): JSONSchema7 | undefined { - if (!config || !config.parameters) { - return; - } - - const configParameters = config.parameters; - const parameters: Record = {}; - const required: string[] = []; - for (const parameter in configParameters) { - const configParam = configParameters[String(parameter)]; - - const param = serializeParam(configParam); - if (configParam.required) { - required.push(parameter); - } - - parameters[String(parameter)] = param; - } - - return { - $schema: 'http://json-schema.org/draft-07/schema#', - type: 'object', - properties: parameters, - required, - // don't allow non supported properties - additionalProperties: false, - } as JSONSchema7; -} - -async function main() { - const schemas: Record = {}; - for (let i = 0, l = SUPPORTED_TEMPLATES.length; i < l; i++) { - const templateName = SUPPORTED_TEMPLATES[Number(i)]; - - console.info(`[INFO]: Prepare parameters for ${templateName}.`); - - const pathToPackageJSON = path.join(__dirname, `../../../node_modules/${templateName}/package.json`); - const packageJSONContent = await fs.promises.readFile(pathToPackageJSON, 'utf-8'); - const packageJSON = JSON.parse(packageJSONContent); - const generatorConfig = packageJSON.generator; - - const schema = serializeTemplateParameters(generatorConfig); - if (schema) { - schemas[String(templateName)] = { - title: TEMPLATES[String(templateName)], - schema, - supportedProtocols: generatorConfig.supportedProtocols, - }; - } - } - - console.info(`[INFO]: Save template parameters schemas to ${DESTINATION_JSON}.`); - await fs.promises.writeFile(DESTINATION_JSON, JSON.stringify(schemas), 'utf-8'); -} -main(); diff --git a/apps/studio-next/src/app/favicon.ico b/apps/studio-next/src/app/favicon.ico deleted file mode 100644 index 2597a4cf4..000000000 Binary files a/apps/studio-next/src/app/favicon.ico and /dev/null differ diff --git a/apps/studio-next/src/components/Content.tsx b/apps/studio-next/src/components/Content.tsx deleted file mode 100644 index 8a61b3d79..000000000 --- a/apps/studio-next/src/components/Content.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import SplitPane from './SplitPane'; -import { Editor } from './Editor/Editor'; -import { Navigation } from './Navigation'; -import { Navigationv3 } from './Navigationv3'; -import { Template } from './Template'; -import { VisualiserTemplate } from './Visualiser'; - -import { debounce } from '@/helpers'; -import { usePanelsState, useDocumentsState } from '@/state'; - -import { FunctionComponent } from 'react'; - -interface ContentProps {} - -export const Content: FunctionComponent = () => { // eslint-disable-line sonarjs/cognitive-complexity - const { show, secondaryPanelType } = usePanelsState(); - const document = useDocumentsState(state => state.documents['asyncapi']?.document) || null; - const isV3 = document?.version() === '3.0.0'; - const navigationEnabled = show.primarySidebar; - const editorEnabled = show.primaryPanel; - const viewEnabled = show.secondaryPanel; - const viewType = secondaryPanelType; - - const splitPosLeft = 'splitPos:left'; - const splitPosRight = 'splitPos:right'; - - const localStorageLeftPaneSize = parseInt(localStorage.getItem(splitPosLeft) || '0', 10) || 220; - const localStorageRightPaneSize = parseInt(localStorage.getItem(splitPosRight) || '0', 10) || '55%'; - - const secondPaneSize = navigationEnabled && !editorEnabled ? localStorageLeftPaneSize : localStorageRightPaneSize; - const secondPaneMaxSize = navigationEnabled && !editorEnabled ? 360 : '100%'; - - const navigationAndEditor = ( - { - localStorage.setItem(splitPosLeft, String(size)); - }, 100)} - > - { - isV3 ? : - } - - - ); - - return ( -
-
- { - localStorage.setItem(splitPosRight, String(size)); - }, 100)} - > - {navigationAndEditor} - {viewType === 'template' &&