David Höck 6c4a8c6376 fix(dashboard): Update GraphQL types for metrics to ensure consistency 5 месяцев назад
..
public f24f14e7aa feat(dashboard): Set up login/authenticated routes 11 месяцев назад
scripts 4db4a8702a chore(dashboard): Fix check-lib-imports.js on Windows 5 месяцев назад
src 6c4a8c6376 fix(dashboard): Update GraphQL types for metrics to ensure consistency 5 месяцев назад
vite 199cbd12ba feat(dashboard): Update theme to use OKLCH color space and new shadcn theme (#3688) 5 месяцев назад
.gitignore aa12ac7801 fix(dashboard): Fix plugin detection from barrel files 6 месяцев назад
README.md 491006b30c docs: Document the @/vdb alias for dashboard imports 6 месяцев назад
components.json 28b3405837 chore(dashboard): Add missing shadcn components (#3685) 5 месяцев назад
eslint.config.js 93aea1635c chore(dashboard): Create dashboard package wih basic setup 11 месяцев назад
index.html 612d527e14 feat(dashboard-plugin): Introduce Dashboard Plugin with metrics API and static file serving 5 месяцев назад
lingui.config.js d60d3fd0e7 refactor(dashboard): Split into lib and app 9 месяцев назад
package.json 612d527e14 feat(dashboard-plugin): Introduce Dashboard Plugin with metrics API and static file serving 5 месяцев назад
sample-vendure-config.ts 134fa381a0 fix(dashboard): Fix various build issues 9 месяцев назад
tsconfig.json a3d7f05ba8 fix(dashboard): Use dedicated @/vdb alias for imports (#3631) 6 месяцев назад
tsconfig.lib.json 7cc6ff2dd9 fix(dashboard): Fix TS errors and packaging issues 9 месяцев назад
tsconfig.plugin.json e445bdb85d feat(dashboard): Support compilation of external plugins (#3663) 6 месяцев назад
vercel.json 28dc856076 feat(dashboard): Add Vercel configuration for rewrites and enhance local development logging 9 месяцев назад
vite.config.lib.mts 694d0dd2aa fix(dashboard): Enable tailwind processing of dashboard extension files 6 месяцев назад
vite.config.mts 16c2e5ea59 fix(dashboard): Improved facet value editing 5 месяцев назад

README.md

Vendure Dashboard

This is a React-based admin dashboard for Vendure. It is a standalone application that can be extended to suit the needs of any Vendure project.

Development

Run npx vite to start Vite in dev mode.

Note on internal @/vdb imports

You will notice that the dashboard uses internal Vendure Dashboard imports prefixed with @/vdb. This is adapted from the convention of Shadcn which uses a @/* path alias for internal imports.

Why not just use relative imports?

The problem with using relative imports is that they are handled differently by Vite when compiling the dashboard. This manifests as things like React Context not working correctly. The underlying reason is that Vite will selectively pre-compile source code and mixing the imports between alias and relative can result in 2 "versions" of the same code being loaded, which causes issues with React Context and other things that rely on a single instance of a module.

For this reason, try to use the @/vdb alias for all internal Vendure Dashboard imports to the "src/lib" directory.

This is especially import for hooks (since many of them use React Context) and there is even a pre-commit hook that will run a script to ensure that you are not using relative imports for internal Vendure Dashboard code.

Type Safety for Consumers

Because we ship source code in the npm package, consumers need to tell TypeScript how to resolve these internal imports by adding the path alias to their tsconfig.json file.

{
    "compilerOptions": {
        "paths": {
            "@/vdb/*": [
                "./node_modules/@vendure/dashboard/src/lib/*"
            ]
        }
    }
}

Note: even without that path alias, the vite compilation will still work, but TypeScript types will not resolve correctly when developing dashboard extensions.

Testing

Run npm run test to run tests once, or npx vitest to run tests in watch mode