From 2e6c42c8852e3ee51f61e52928d6983f013a322b Mon Sep 17 00:00:00 2001 From: Guillermo Puente Date: Fri, 25 Oct 2024 15:08:45 -0300 Subject: [PATCH] feat(connect): added scalars as peer dep --- package-lock.json | 27 +++++++++++++++++++++------ package.json | 6 +++++- studio/server.ts | 13 +++++++++++++ studio/vite-plugin.ts | 3 ++- vite.renderer.config.mts | 6 +++++- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a12ebd5..5fc93e0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@powerhousedao/connect", - "version": "1.0.0-dev.147", + "version": "1.0.0-dev.148", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@powerhousedao/connect", - "version": "1.0.0-dev.147", + "version": "1.0.0-dev.148", "license": "AGPL-3.0-only", "dependencies": { "commander": "^12.1.0", @@ -29,6 +29,7 @@ "@electron-forge/publisher-github": "^7.2.0", "@playwright/test": "^1.41.2", "@powerhousedao/design-system": "^1.4.0", + "@powerhousedao/scalars": "latest", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", "@semantic-release/github": "^9.2.4", @@ -50,7 +51,7 @@ "did-key-creator": "^1.2.0", "document-drive": "^1.0.2", "document-model": "^2.2.0", - "document-model-libs": "^1.101.0", + "document-model-libs": "^1.102.0", "electron": "30.0.0", "electron-is-dev": "^3.0.1", "electron-playwright-helpers": "^1.7.1", @@ -98,6 +99,9 @@ "optionalDependencies": { "@esbuild/linux-x64": "^0.21.4", "@rollup/rollup-linux-x64-musl": "4.14.3" + }, + "peerDependencies": { + "@powerhousedao/scalars": "latest" } }, "../demo-editor-tab": { @@ -7262,6 +7266,16 @@ "url": "https://github.com/sponsors/dcastil" } }, + "node_modules/@powerhousedao/scalars": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@powerhousedao/scalars/-/scalars-1.4.0.tgz", + "integrity": "sha512-WrrvRDFkXIt5w19TpAkxsk+Wb0ikH7rzUxQQno/c8T9ZyJyVBdUwVS3rataNdubb9lUERIX+dWnM6mkor8Dz3g==", + "dev": true, + "peerDependencies": { + "graphql": "^16.8.1", + "zod": "^3.23.8" + } + }, "node_modules/@prisma/client": { "version": "5.20.0", "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.20.0.tgz", @@ -16446,9 +16460,9 @@ } }, "node_modules/document-model-libs": { - "version": "1.101.0", - "resolved": "https://registry.npmjs.org/document-model-libs/-/document-model-libs-1.101.0.tgz", - "integrity": "sha512-gw3xxMiyfUb0x8/HSUUg2kPlgd+W/sKVjLKdyzUwTPQoM70wxssCeaehF8wWQ2u964ca7QRFDklyn7M8PlDBAw==", + "version": "1.102.0", + "resolved": "https://registry.npmjs.org/document-model-libs/-/document-model-libs-1.102.0.tgz", + "integrity": "sha512-c/dw4fWmpatZrmWHR4SMB1HNKwkEmTDGoorDhsaYlYhljF3/X43yQ1yt/Vqm9QGIoXBIL4Y2YcnXYN92PqsxMg==", "dev": true, "dependencies": { "@acaldas/graphql-codegen-typescript-validation-schema": "^0.12.3", @@ -16465,6 +16479,7 @@ "mathjs": "^13.0.0" }, "peerDependencies": { + "@powerhousedao/scalars": "latest", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/package.json b/package.json index 35406d44..535c17a1 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,9 @@ "vite": "^5.4.8", "vite-envs": "^4.4.5" }, + "peerDependencies": { + "@powerhousedao/scalars": "latest" + }, "devDependencies": { "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", @@ -61,6 +64,7 @@ "@electron-forge/publisher-github": "^7.2.0", "@playwright/test": "^1.41.2", "@powerhousedao/design-system": "^1.4.0", + "@powerhousedao/scalars": "latest", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", "@semantic-release/github": "^9.2.4", @@ -82,7 +86,7 @@ "did-key-creator": "^1.2.0", "document-drive": "^1.0.2", "document-model": "^2.2.0", - "document-model-libs": "^1.101.0", + "document-model-libs": "^1.102.0", "electron": "30.0.0", "electron-is-dev": "^3.0.1", "electron-playwright-helpers": "^1.7.1", diff --git a/studio/server.ts b/studio/server.ts index 5803d617..c6a58cff 100644 --- a/studio/server.ts +++ b/studio/server.ts @@ -10,6 +10,8 @@ const studioDirname = fileURLToPath(new URL('.', import.meta.url)); const appPath = join(studioDirname, '..'); const viteEnvsScript = join(appPath, 'vite-envs.sh'); +const projectRoot = process.cwd(); + // silences dynamic import warnings const logger = createLogger(); // eslint-disable-next-line @typescript-eslint/unbound-method @@ -66,6 +68,17 @@ export async function startServer() { open: true, host: Boolean(process.env.HOST), }, + resolve: { + alias: { + // Resolve to the node_modules in the project root + '@powerhousedao/scalars': join( + projectRoot, + 'node_modules', + '@powerhousedao', + 'scalars', + ), + }, + }, plugins: [ viteConnectDevStudioPlugin(true), viteEnvs({ diff --git a/studio/vite-plugin.ts b/studio/vite-plugin.ts index 68468f45..9778640e 100644 --- a/studio/vite-plugin.ts +++ b/studio/vite-plugin.ts @@ -173,7 +173,8 @@ export function viteConnectDevStudioPlugin( studioConfig[LOCAL_DOCUMENT_EDITORS_IMPORT]; return [ - enabled && viteIgnoreStaticImport([externalImports]), + enabled && + viteIgnoreStaticImport([externalImports, '@powerhousedao/scalars']), { name: 'vite-plugin-connect-dev-studio', enforce: 'pre', diff --git a/vite.renderer.config.mts b/vite.renderer.config.mts index 067f7e51..0a8e056a 100644 --- a/vite.renderer.config.mts +++ b/vite.renderer.config.mts @@ -106,7 +106,11 @@ export default defineConfig(({ mode }) => { ? `${chunk.name}.js` : 'assets/[name].[hash].js', }, - external: ['node:crypto', externalIds], + external: [ + 'node:crypto', + externalIds, + '@powerhousedao/scalars', + ], }, }, resolve: {