From 2570d65aa532f51f0250a7aa14dcd8b44ecb67cb Mon Sep 17 00:00:00 2001 From: catosaurusrex2003 Date: Tue, 24 Sep 2024 19:36:13 +0530 Subject: [PATCH] small requested changes --- .sonarcloud.properties | 2 +- apps/studio/.eslintignore | 2 ++ apps/studio/CHANGELOG.md | 48 +++++++++++++++++++++++++++++++----- apps/studio/Dockerfile | 52 +++++++++++++++++++++++++++++++++++++++ apps/studio/package.json | 2 +- 5 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 apps/studio/.eslintignore create mode 100644 apps/studio/Dockerfile diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 120c46abb..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/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/src/components/Navigationv3.tsx,apps/studio/src/components/Navigation.tsx,apps/studio/cypress/**,apps/studio/src/helpers/driver.ts +sonar.cpd.exclusions=apps/studio/** diff --git a/apps/studio/.eslintignore b/apps/studio/.eslintignore new file mode 100644 index 000000000..9ef362c79 --- /dev/null +++ b/apps/studio/.eslintignore @@ -0,0 +1,2 @@ +build +.turbo \ No newline at end of file diff --git a/apps/studio/CHANGELOG.md b/apps/studio/CHANGELOG.md index ccc6f1c1e..c285625db 100644 --- a/apps/studio/CHANGELOG.md +++ b/apps/studio/CHANGELOG.md @@ -1,25 +1,61 @@ -# studio +# @asyncapi/studio -## 0.1.4 +## 0.21.4 ### Patch Changes - 877810d: fix: temporarily hard-lock `@asyncapi/converter` on `v1.5.0` as a hotfix (#1138) -## 0.1.3 +## 0.21.3 ### Patch Changes - 943fec1: fix: report correct `range` values in error diagnostics for YAML files -## 0.1.2 +## 0.21.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 +## 0.21.1 ### Patch Changes -- a4b7fd1: Use Next.js framework +- 481b28c: fix: Incorrect rendering of security schemas: by reference and inline, #1066 + +## 0.21.0 + +### Minor Changes + +- 26dc05f: Fix side bar color and update @asyncapi/html-template. + +## 0.20.2 + +### Patch Changes + +- 5c7b4c1: scrollTo navigation to right code block in yaml. + +## 0.20.1 + +### Patch Changes + +- 6995cdf: bump dependencies + +## 0.20.0 + +### Minor Changes + +- 5129432: start publishing studio. + +## 0.19.1 + +### Patch Changes + +- 9187c17: fix studio breaking when trying to generate code/document + +## 0.19.0 + +### Minor Changes + +- 94215e6: Support spec V3.0.0 in studio diff --git a/apps/studio/Dockerfile b/apps/studio/Dockerfile new file mode 100644 index 000000000..47d00ae09 --- /dev/null +++ b/apps/studio/Dockerfile @@ -0,0 +1,52 @@ +# Use a UUID as placeholder value to have a unique string to replace. +ARG BASE_URL_PLACEHOLDER=189b303e-37a0-4f6f-8c0a-50333bc3c36e + + +FROM node:18-alpine AS base + +FROM base AS builder +RUN apk add --no-cache libc6-compat +RUN apk update +# Set working directory +WORKDIR /app +RUN npm install --global turbo +COPY . . +RUN turbo prune --scope=@asyncapi/studio --docker + +# Add lockfile and package.json's of isolated subworkspace +FROM base AS installer + +ARG BASE_URL_PLACEHOLDER + +RUN apk add --no-cache libc6-compat +RUN apk update +WORKDIR /app + +# First install the dependencies (as they change less often) + +COPY .gitignore .gitignore +COPY --from=builder /app/out/json/ . +COPY --from=builder /app/out/package-lock.json ./package-lock.json +RUN PUPPETEER_SKIP_DOWNLOAD=true npm ci + +# Build the project +COPY --from=builder /app/out/full/ . +RUN PUBLIC_URL=${BASE_URL_PLACEHOLDER} npm run build:studio + + +FROM docker.io/library/nginx:1.25.5-alpine as runtime + +ARG BASE_URL_PLACEHOLDER +# The base Nginx image automatically executes all shell scripts +# within the /docker-entrypoint.d/ directory ("entrypoint scripts") +# when the container is started. See the relevant logic at +# https://github.com/nginxinc/docker-nginx/blob/master/entrypoint/docker-entrypoint.sh#L16. +ARG ENTRYPOINT_SCRIPT=/docker-entrypoint.d/set-public-url.sh + +COPY --from=installer /app/apps/studio/build /usr/share/nginx/html/ +# Add an entrypoint script that replaces all occurrences of the +# placeholder value by the configured base URL. If no base URL +# is configured we assume the application is running at '/'. +RUN echo "find /usr/share/nginx/html/ -type f -print0 | xargs -0 sed -i \"s|${BASE_URL_PLACEHOLDER}|\${BASE_URL}|g\"" > $ENTRYPOINT_SCRIPT && chmod +x $ENTRYPOINT_SCRIPT + +FROM runtime \ No newline at end of file diff --git a/apps/studio/package.json b/apps/studio/package.json index 82ddad713..7b70d7b46 100644 --- a/apps/studio/package.json +++ b/apps/studio/package.json @@ -1,6 +1,6 @@ { "name": "@asyncapi/studio", - "version": "0.1.4", + "version": "0.21.4", "description": "One place that allows you to develop an AsyncAPI document, validate it, convert it to the latest version, preview the documentation and visualize the events flow.", "license": "Apache-2.0", "bugs": {