diff --git a/designer-demo/package.json b/designer-demo/package.json index f1fcb867e..7e5168335 100644 --- a/designer-demo/package.json +++ b/designer-demo/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "cross-env vite", + "dev:withAuth": "cross-env VITE_AUTH=true vite", "build:alpha": "cross-env NODE_OPTIONS=--max-old-space-size=10240 vite build --mode alpha", "build": "cross-env NODE_OPTIONS=--max-old-space-size=10240 vite build", "test": "vitest run", diff --git a/package.json b/package.json index 5e101abe2..edd21d6ca 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "preinstall": "npx only-allow pnpm", "dev": "pnpm run setup && concurrently 'pnpm:serve:backend' 'pnpm:serve:frontend'", + "dev:withAuth": "pnpm run setup && pnpm --filter designer-demo dev:withAuth", "serve:frontend": "pnpm --filter designer-demo dev", "serve:backend": "pnpm --filter @opentiny/tiny-engine-mock dev", "build:plugin": "pnpm --filter @opentiny/tiny-engine-* --filter @opentiny/tiny-engine build", diff --git a/packages/design-core/registry.js b/packages/design-core/registry.js index 49cad6a26..9108e2530 100644 --- a/packages/design-core/registry.js +++ b/packages/design-core/registry.js @@ -58,6 +58,8 @@ import { } from './re-export' const isDevelopEnv = import.meta.env.MODE?.includes('dev') +const useAuth = import.meta.env.VITE_AUTH === 'true' + window.__TINY_ENGINE_REMOVED_REGISTRY = {} export default { @@ -136,7 +138,7 @@ export default { } ], enableTailwindCSS: true, - enableLogin: isDevelopEnv ? false : true + enableLogin: useAuth || !isDevelopEnv }, layout: __TINY_ENGINE_REMOVED_REGISTRY['engine.layout'] === false ? null : Layout, toolbars: [