Skip to content

Commit

Permalink
chore(web,dashboard): remove legacy bundle from dashboard (#7474)
Browse files Browse the repository at this point in the history
  • Loading branch information
LetItRock authored Jan 10, 2025
1 parent 5a27f31 commit 185ac5f
Show file tree
Hide file tree
Showing 13 changed files with 532 additions and 625 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/reusable-dashboard-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ jobs:
# Disable LaunchDarkly client-side SDK in the test environment to reduce E2E flakiness
REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID: ''
NOVU_ENTERPRISE: ${{ steps.determine_run_type.outputs.enterprise_run }}
run: pnpm start:static:build
run: pnpm start:static:build &

- name: Wait on Services
run: wait-on --timeout=180000 http://127.0.0.1:1340/v1/health-check http://127.0.0.1:8080/
run: wait-on --timeout=180000 http://127.0.0.1:1340/v1/health-check http://127.0.0.1:4201/

- name: Install Playwright
working-directory: apps/dashboard
Expand Down
2 changes: 0 additions & 2 deletions apps/dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
legacy/*
!legacy/.gitkeep
tsconfig.app.tsbuildinfo
tsconfig.node.tsbuildinfo
/test-results/
Expand Down
24 changes: 0 additions & 24 deletions apps/dashboard/legacy-handler.js

This file was deleted.

9 changes: 4 additions & 5 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"type": "module",
"scripts": {
"start": "vite",
"start:static:build": "pm2 start proxy-server.js",
"stop:static:build": "pm2 stop proxy-server.js",
"start:static:build": "http-server dist -p 4201 --proxy http://127.0.0.1:4201?",
"dev": "pnpm start",
"build": "pnpm build:legacy && tsc -b && vite build",
"build:legacy": "rimraf legacy/* && pnpm nx build:web:for-dashboard @novu/web",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"test:e2e": "playwright test",
Expand Down Expand Up @@ -104,7 +102,7 @@
"@clerk/types": "^4.30.0",
"@eslint/js": "^9.9.0",
"@hookform/devtools": "^4.3.0",
"@playwright/test": "^1.44.0",
"@playwright/test": "^1.46.1",
"@sentry/vite-plugin": "^2.22.6",
"@tiptap/core": "^2.10.3",
"@types/lodash.debounce": "^4.0.9",
Expand All @@ -122,6 +120,7 @@
"express": "^4.21.0",
"globals": "^15.9.0",
"http-proxy-middleware": "^3.0.2",
"http-server": "^0.13.0",
"pm2": "^5.4.2",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
Expand Down
41 changes: 0 additions & 41 deletions apps/dashboard/proxy-server.js

This file was deleted.

7 changes: 4 additions & 3 deletions apps/dashboard/src/components/workflow-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useDeleteWorkflow } from '@/hooks/use-delete-workflow';
import { usePatchWorkflow } from '@/hooks/use-patch-workflow';
import { useSyncWorkflow } from '@/hooks/use-sync-workflow';
import { WorkflowOriginEnum, WorkflowStatusEnum } from '@/utils/enums';
import { buildRoute, LEGACY_ROUTES, ROUTES } from '@/utils/routes';
import { buildRoute, ROUTES } from '@/utils/routes';
import { cn } from '@/utils/ui';
import { IEnvironment, WorkflowListResponseDto } from '@novu/shared';
import { ComponentProps, useState } from 'react';
Expand All @@ -42,6 +42,7 @@ import { CopyButton } from './primitives/copy-button';
import { ToastIcon } from './primitives/sonner';
import { showToast } from './primitives/sonner-helpers';
import { TimeDisplayHoverCard } from './time-display-hover-card';
import { LEGACY_DASHBOARD_URL } from '@/config';

type WorkflowRowProps = {
workflow: WorkflowListResponseDto;
Expand All @@ -64,7 +65,7 @@ const WorkflowLinkTableCell = (props: WorkflowLinkTableCellProps) => {
const isV1Workflow = workflow.origin === WorkflowOriginEnum.NOVU_CLOUD_V1;

const workflowLink = isV1Workflow
? buildRoute(LEGACY_ROUTES.EDIT_WORKFLOW, {
? buildRoute(`${LEGACY_DASHBOARD_URL}/workflows/edit/:workflowId`, {
workflowId: workflow._id,
})
: buildRoute(ROUTES.EDIT_WORKFLOW, {
Expand All @@ -90,7 +91,7 @@ export const WorkflowRow = ({ workflow }: WorkflowRowProps) => {

const isV1Workflow = workflow.origin === WorkflowOriginEnum.NOVU_CLOUD_V1;
const triggerWorkflowLink = isV1Workflow
? buildRoute(LEGACY_ROUTES.TEST_WORKFLOW, { workflowId: workflow._id })
? buildRoute(`${LEGACY_DASHBOARD_URL}/workflows/edit/:workflowId/test-workflow`, { workflowId: workflow._id })
: buildRoute(ROUTES.TEST_WORKFLOW, {
environmentSlug: currentEnvironment?.slug ?? '',
workflowSlug: workflow.slug,
Expand Down
12 changes: 8 additions & 4 deletions apps/dashboard/src/pages/redirect-to-legacy-studio-auth.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { useEffect } from 'react';
import { LEGACY_ROUTES } from '@/utils/routes';
import { LEGACY_DASHBOARD_URL } from '@/config';

export const RedirectToLegacyStudioAuth = () => {
useEffect(() => {
const currentSearch = window.location.search;
const redirectUrl = `${LEGACY_ROUTES.LOCAL_STUDIO_AUTH}${currentSearch}&studio_path_hint=/legacy/studio`;
window.location.href = redirectUrl;
const url = new URL(`${LEGACY_DASHBOARD_URL}/local-studio/auth`);
const searchParams = new URLSearchParams(window.location.search);

searchParams.append('studio_path_hint', '/studio');
url.search = searchParams.toString();

window.location.href = url.toString();
}, []);

return null;
Expand Down
12 changes: 0 additions & 12 deletions apps/dashboard/src/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,3 @@ export const buildRoute = (route: string, params: Record<string, string>) => {
return acc.replace(`:${key}`, value);
}, route);
};

export const LEGACY_ROUTES = {
ACTIVITY_FEED: '/legacy/activities',
INTEGRATIONS: '/legacy/integrations',
API_KEYS: '/legacy/api-keys',
BILLING: '/legacy/manage-account/billing',
INVITE_TEAM_MEMBERS: '/legacy/manage-account/team-members',
SETTINGS: '/legacy/manage-account/user-profile',
EDIT_WORKFLOW: '/legacy/workflows/edit/:workflowId',
TEST_WORKFLOW: '/legacy/workflows/edit/:workflowId/test-workflow',
LOCAL_STUDIO_AUTH: '/legacy/local-studio/auth',
};
11 changes: 0 additions & 11 deletions apps/dashboard/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { viteStaticCopy } from 'vite-plugin-static-copy';
import tailwindcss from 'tailwindcss';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { legacyHandler } from './legacy-handler';

export default defineConfig({
plugins: [
Expand All @@ -24,14 +21,6 @@ export default defineConfig({
},
],
}),
{
name: 'legacy-redirect',
configureServer(server) {
server.middlewares.use((req, res, next) => {
legacyHandler(__dirname, req, res, next);
});
},
},
// Put the Sentry vite plugin after all other plugins
sentryVitePlugin({
org: process.env.SENTRY_ORG,
Expand Down
24 changes: 0 additions & 24 deletions apps/web/.env.dashboard

This file was deleted.

4 changes: 1 addition & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
"start": "pnpm panda --watch & cross-env NODE_OPTIONS=--max_old_space_size=8192 DISABLE_ESLINT_PLUGIN=true PORT=4200 react-app-rewired start",
"prebuild": "rimraf build",
"build": "pnpm panda && cross-env NODE_OPTIONS=--max_old_space_size=4096 GENERATE_SOURCEMAP=false DISABLE_ESLINT_PLUGIN=true react-app-rewired --max_old_space_size=4096 build",
"build:web:for-dashboard": "pnpm panda && cross-env BUILD_PATH=../../apps/dashboard/legacy NODE_OPTIONS=--max_old_space_size=4096 GENERATE_SOURCEMAP=false DISABLE_ESLINT_PLUGIN=true PUBLIC_URL=/legacy/ react-app-rewired --max_old_space_size=4096 build && pnpm envsetup:dashboard",
"build:test": "pnpm panda && cross-env REACT_APP_HUBSPOT_EMBED=44416662 REACT_APP_API_URL=http://127.0.0.1:1336 NODE_OPTIONS=--max_old_space_size=4096 GENERATE_SOURCEMAP=false DISABLE_ESLINT_PLUGIN=true react-app-rewired --max_old_space_size=4096 build",
"precommit": "lint-staged",
"docker:build": "docker buildx build --load -f ./Dockerfile -t novu-web ./../.. $DOCKER_BUILD_ARGUMENTS",
"docker:build:depot": "depot build -f ./Dockerfile -t novu-web ./../.. --load",
"envsetup:dashboard": "chmod +x ./env.sh && ./env.sh .env.dashboard && mv ./env-config.js ../../apps/dashboard/legacy/env-config.js && rm .env",
"envsetup:docker": "chmod +x ./env.sh && ./env.sh && mv ./env-config.js ./build/env-config.js",
"envsetup": "chmod +x ./env.sh && ./env.sh && mv env-config.js ./public/env-config.js",
"start:static:build": "http-server build -p 4200 --proxy http://127.0.0.1:4200?",
Expand Down Expand Up @@ -156,7 +154,7 @@
"@novu/testing": "workspace:*",
"@pandacss/dev": "^0.42.0",
"@pandacss/studio": "^0.42.0",
"@playwright/test": "^1.44.0",
"@playwright/test": "^1.46.1",
"@storybook/addon-actions": "^7.4.2",
"@storybook/addon-essentials": "^7.4.2",
"@storybook/addon-links": "^7.4.2",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"build:inbound-mail": "nx build @novu/inbound-mail",
"build:packages": "nx run-many --target=build --all --projects=tag:type:package",
"build:storybook": "nx run @novu/design-system:build-storybook",
"build:web:for-dashboard": "nx build:web:for-dashboard @novu/web",
"build:web": "nx build @novu/web",
"build:webhook": "nx build @novu/webhook",
"build:widget": "nx build @novu/widget",
Expand Down
Loading

0 comments on commit 185ac5f

Please sign in to comment.