Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/backend/utils/router/router.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import path from 'path'
import * as url from 'url'
import { createRequire } from 'node:module'

import AppController from '../../controllers/app-controller.js'
import ApiController from '../../controllers/api-controller.js'
import { COMPONENTS_OUTPUT_PATH, NODE_ENV } from '../../bundler/utils/constants.js'

const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const ASSETS_ROOT = `${__dirname}/../lib/../../../frontend/assets/`
const ASSETS_ROOT = path.join(
process.cwd(),
'node_modules',
'adminjs',
'lib',
'frontend',
'assets',
)

/**
* A function which resolves the path to AdminJS design system bundle.
*
* @returns {string} resolved path to AdminJS design system bundle
*/
const resolveDesignSystemBundle = (): string => {
const require = createRequire(import.meta.url)

const resolveDesignSystemBundle = () => {
return path.join(
path.parse(require.resolve('@adminjs/design-system')).dir,
`../bundle.${NODE_ENV}.js`,
process.cwd(),
'node_modules',
'@adminjs',
'design-system',
`bundle.${NODE_ENV}.js`,
)
}

Expand Down