feat(dashboard): align contracts and production build
This commit is contained in:
1 parent
69d560d5c5
commit
d6d29badcd
9 files changed
+189
-48
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
export interface DashboardAssets {
|
||||
directory: string;
|
||||
indexFile: string;
|
||||
isLegacy: boolean;
|
||||
}
|
||||
|
||||
export type FileExists = (filePath: string) => boolean;
|
||||
|
||||
export function resolveDashboardAssets(
|
||||
workspaceDirectory: string,
|
||||
fileExists: FileExists = fs.existsSync,
|
||||
): DashboardAssets {
|
||||
const reactDirectory = path.join(workspaceDirectory, 'apps', 'dashboard', 'dist');
|
||||
const reactIndexFile = path.join(reactDirectory, 'index.html');
|
||||
|
||||
if (fileExists(reactIndexFile)) {
|
||||
return {
|
||||
directory: reactDirectory,
|
||||
indexFile: reactIndexFile,
|
||||
isLegacy: false,
|
||||
};
|
||||
}
|
||||
|
||||
const legacyDirectory = path.join(workspaceDirectory, 'public');
|
||||
|
||||
return {
|
||||
directory: legacyDirectory,
|
||||
indexFile: path.join(legacyDirectory, 'index.html'),
|
||||
isLegacy: true,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user