Skip to content

Commit

Permalink
Update graph with @xyflow/react (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
alec-chernicki authored Feb 28, 2024
1 parent 1922706 commit 4f0f69c
Show file tree
Hide file tree
Showing 142 changed files with 5,884 additions and 6,735 deletions.
28 changes: 28 additions & 0 deletions .changeset/fuzzy-cups-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
"commonality-checks-recommended": patch
"@commonalityco/utils-conformance": patch
"@commonalityco/data-constraints": patch
"@commonalityco/ui-design-system": patch
"@commonalityco/utils-onboarding": patch
"@commonalityco/data-codeowners": patch
"@commonalityco/ui-conformance": patch
"@commonalityco/ui-constraints": patch
"@commonalityco/config-tailwind": patch
"@commonalityco/config-tsconfig": patch
"@commonalityco/data-packages": patch
"@commonalityco/utils-package": patch
"@commonalityco/data-project": patch
"eslint-config-commonality": patch
"@commonalityco/ui-package": patch
"@commonalityco/utils-core": patch
"@commonalityco/utils-file": patch
"@commonalityco/data-tags": patch
"@commonalityco/ui-graph": patch
"commonality": patch
"@commonalityco/ui-core": patch
"@commonalityco/types": patch
"workshop": patch
"@commonalityco/studio": patch
---

Update dependency graph to use @xyflow/react
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"testing.automaticallyOpenPeekView": "never"
}
38 changes: 19 additions & 19 deletions apps/commonality/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,37 @@
},
"dependencies": {
"@antfu/install-pkg": "^0.3.1",
"@commonalityco/studio": "0.2.49",
"@sentry/node": "^7.100.1",
"@commonalityco/studio": "workspace:*",
"@sentry/node": "^7.102.1",
"@sindresorhus/slugify": "^2.2.1",
"boxen": "^7.1.1",
"chalk": "^5.3.0",
"commander": "^11.0.0",
"commander": "^11.1.0",
"conf": "^12.0.0",
"configstore": "^6.0.0",
"detect-indent": "^7.0.1",
"find-up": "^6.3.0",
"fs-extra": "^11.1.1",
"fs-extra": "^11.2.0",
"get-port": "^7.0.0",
"globby": "^13.2.2",
"import-meta-resolve": "^4.0.0",
"ip": "^1.1.8",
"ip": "^1.1.9",
"jest-diff": "^29.7.0",
"jiti": "^1.21.0",
"local-pkg": "^0.5.0",
"lodash-es": "^4.17.21",
"micromatch": "^4.0.5",
"nanoid": "^5.0.5",
"nanoid": "^5.0.6",
"ora": "^7.0.1",
"pathe": "^1.1.1",
"pino": "^8.17.1",
"pino-pretty": "^10.3.0",
"pathe": "^1.1.2",
"pino": "^8.19.0",
"pino-pretty": "^10.3.1",
"prompts": "^2.4.2",
"std-env": "^3.6.0",
"std-env": "^3.7.0",
"strip-ansi": "^7.1.0",
"update-notifier": "^7.0.0",
"wait-on": "^7.2.0",
"yaml": "^2.3.2",
"yaml": "^2.3.4",
"zod": "^3.22.4"
},
"devDependencies": {
Expand All @@ -94,21 +94,21 @@
"@commonalityco/utils-core": "workspace:*",
"@commonalityco/utils-file": "workspace:*",
"@commonalityco/utils-onboarding": "workspace:*",
"@swc/core": "^1.3.101",
"@types/fs-extra": "^11.0.2",
"@swc/core": "^1.4.2",
"@types/fs-extra": "^11.0.4",
"@types/ip": "^1.1.3",
"@types/lodash-es": "^4.14.198",
"@types/lodash-es": "^4.17.12",
"@types/mock-fs": "^4.13.4",
"@types/node": "^20.10.0",
"@types/prompts": "^2.4.4",
"@types/wait-on": "^5.3.1",
"@types/node": "^20.11.20",
"@types/prompts": "^2.4.9",
"@types/wait-on": "^5.3.4",
"eslint-config-commonality": "workspace:*",
"execa": "^8.0.1",
"mock-fs": "^5.2.0",
"npm-run-all": "^4.1.5",
"rimraf": "^5.0.5",
"tsup": "^8.0.1",
"typescript": "^5.2.2",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vitest": "^0.34.6"
}
}
4 changes: 2 additions & 2 deletions apps/commonality/src/cli/commands/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export const studio = command
process.on('SIGINT', handleExit);
process.on('SIGTERM', handleExit);

const localUrl = `http://localhost:${port}`;
const networkUrl = `http://${ip.address()}:${port}`;
const localUrl = `http://localhost:${port}/graph`;
const networkUrl = `http://${ip.address()}:${port}/graph`;

await waitOn({ resources: [localUrl], timeout: 10_000 });

Expand Down
10 changes: 4 additions & 6 deletions apps/studio/e2e/smoke.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { test, expect } from '@playwright/test';

test('smoke - constraints', async ({ page }) => {
await page.goto('/');
await page.goto('/graph');

await expect(
page.getByRole('heading', { name: 'Constraints' }),
).toBeVisible();
await expect(page.getByTestId('dependency-graph')).toBeVisible();
});

test('smoke - checks', async ({ page }) => {
await page.goto('/checks');
await page.goto('/packages');

await expect(page.getByRole('heading', { name: 'Checks' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Packages' })).toBeVisible();
});
63 changes: 11 additions & 52 deletions apps/studio/next.config.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,12 @@
const { withSentryConfig } = require('@sentry/nextjs');

module.exports = withSentryConfig(
{
reactStrictMode: true,
transpilePackages: [
'@commonalityco/data-codeowners',
'@commonalityco/data-graph',
'@commonalityco/data-graph-worker',
'@commonalityco/data-packages',
'@commonalityco/data-project',
'@commonalityco/data-tags',
'@commonalityco/ui-conformance',
'@commonalityco/utils-conformance',
'@commonalityco/feature-graph',
'@commonalityco/ui-core',
'@commonalityco/ui-design-system',
'@commonalityco/ui-graph',
'@commonalityco/ui-package',
'@commonalityco/utils-core',
'@commonalityco/utils-graph',
'@commonalityco/utils-package',
],
module.exports = {
reactStrictMode: true,
async redirects() {
return [
{
source: '/((?!graph|packages).*)',
destination: '/graph',
permanent: true,
},
];
},
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,
org: 'alec-ortega',
project: 'studio',
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: '/monitoring',

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
},
);
};
76 changes: 42 additions & 34 deletions apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"node": ">=18.17.0"
},
"scripts": {
"dev": "COMMONALITY_ROOT_DIRECTORY='../../' NODE_ENV=development node server.js",
"dev": "COMMONALITY_ROOT_DIRECTORY='../../' NODE_ENV=development node server.js --turbo",
"build": "next build && pnpm run clean-cache",
"clean-cache": "rimraf .next/cache",
"analyze": "ANALYZE=true next build",
Expand All @@ -30,18 +30,26 @@
"dist/"
],
"dependencies": {
"@sentry/nextjs": "^7.100.1",
"@sentry/utils": "^7.100.1",
"chokidar": "^3.5.3",
"@sentry/nextjs": "^7.102.1",
"@sentry/utils": "^7.102.1",
"@xyflow/react": "12.0.0-next.9",
"@xyflow/system": "^0.0.17",
"chokidar": "^3.6.0",
"execa": "^8.0.1",
"framer-motion": "^11.0.5",
"jotai": "^2.6.5",
"lz-string": "^1.5.0",
"next": "14.0.4",
"socket.io": "^4.7.2",
"socket.io-client": "^4.7.2",
"nuqs": "^1.17.0",
"query-string": "^8.2.0",
"socket.io": "^4.7.4",
"socket.io-client": "^4.7.4",
"superjson": "^2.2.1",
"wait-on": "^7.2.0"
},
"devDependencies": {
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@commonalityco/config-tailwind": "workspace:*",
"@commonalityco/data-codeowners": "workspace:*",
"@commonalityco/data-constraints": "workspace:*",
Expand All @@ -60,32 +68,32 @@
"@commonalityco/utils-package": "workspace:*",
"@hookform/resolvers": "^3.3.4",
"@next/bundle-analyzer": "^13.5.6",
"@playwright/test": "^1.40.1",
"@playwright/test": "^1.41.2",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^5.14.6",
"@tanstack/react-table": "^8.10.1",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@tanstack/react-query-devtools": "^5.24.0",
"@tanstack/react-table": "^8.12.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@total-typescript/ts-reset": "^0.5.1",
"@types/fs-extra": "^11.0.2",
"@types/lodash-es": "^4.14.198",
"@types/node": "^20.10.0",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.18",
"@types/fs-extra": "^11.0.4",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.11.20",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"@types/resolve": "^1.20.6",
"@vitejs/plugin-react-swc": "^3.3.2",
"@vitejs/plugin-react-swc": "^3.6.0",
"@xstate/react": "^3.2.2",
"autoprefixer": "^10.4.16",
"autoprefixer": "^10.4.17",
"bufferutil": "^4.0.8",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cookies-next": "^4.1.0",
"cypress": "^13.6.4",
"cytoscape": "^3.26.0",
"cookies-next": "^4.1.1",
"cypress": "^13.6.5",
"cytoscape": "^3.28.1",
"date-fns": "^2.30.0",
"eslint-config-next": "^14.0.1",
"fs-extra": "^11.1.1",
"eslint-config-next": "^14.1.0",
"fs-extra": "^11.2.0",
"get-port": "^7.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -94,10 +102,10 @@
"next-themes": "^0.2.1",
"open-editor": "^4.1.1",
"path-browserify": "^1.0.1",
"pino": "^8.17.1",
"pino-pretty": "^10.3.0",
"postcss": "^8.4.33",
"prettier": "^3.1.1",
"pino": "^8.19.0",
"pino-pretty": "^10.3.1",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -106,13 +114,13 @@
"server-only": "^0.0.1",
"start-server-and-test": "^2.0.3",
"strip-ansi": "^7.1.0",
"tailwindcss": "^3.3.3",
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"utf-8-validate": "^6.0.3",
"vite-tsconfig-paths": "^4.2.2",
"vite-tsconfig-paths": "^4.3.1",
"which-collection": "^1.0.1",
"xstate": "^4.38.2",
"xstate": "^4.38.3",
"zod": "^3.22.4"
},
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions apps/studio/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

enabled: false,
});
2 changes: 2 additions & 0 deletions apps/studio/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

enabled: false,
});
2 changes: 2 additions & 0 deletions apps/studio/sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

enabled: false,
});
10 changes: 6 additions & 4 deletions apps/studio/src/actions/editor.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
'use server';
import 'server-only';
import openEditor from 'open-editor';
import path from 'node:path';
import { getProjectData } from '@/data/project';
import fs from 'fs-extra';

export async function openEditorAction(filePath: string) {
const fullPath = path.join(process.env.COMMONALITY_ROOT_DIRECTORY, filePath);
const fullPath = path.join(
process.env.COMMONALITY_ROOT_DIRECTORY ?? './',
filePath,
);

await openEditor([{ file: fullPath }]);
}

export async function openPackageJson(packageDirectory: string) {
const fullPath = path.join(
process.env.COMMONALITY_ROOT_DIRECTORY,
process.env.COMMONALITY_ROOT_DIRECTORY ?? './',
packageDirectory,
'package.json',
);
Expand All @@ -23,7 +25,7 @@ export async function openPackageJson(packageDirectory: string) {

export async function openPackageConfig(packageDirectory: string) {
const fullPath = path.join(
process.env.COMMONALITY_ROOT_DIRECTORY,
process.env.COMMONALITY_ROOT_DIRECTORY ?? './',
packageDirectory,
'commonality.json',
);
Expand Down
Loading

0 comments on commit 4f0f69c

Please sign in to comment.