File
storagePath
(Optional)
|
Type
|
string
|
import { normalizePath } from '@nx/devkit';
import path from 'node:path';
const THEME_STORE_FOLDER = 'assets';
export interface ThemeFile {
filePath: string;
stylesIncludePath: string;
storagePath?: string;
}
export function processAquilaThemePath(
aquilaThemePath: string | undefined,
destinationFolder: string
): ThemeFile | null {
if (!aquilaThemePath) return null;
let storagePath: string | undefined;
let stylesIncludePath = aquilaThemePath;
const isLocalFileAndNotModuleFile = !aquilaThemePath.startsWith('~');
if (isLocalFileAndNotModuleFile) {
const fileName = path.basename(aquilaThemePath);
// prefix with './' to make it relative. join will normalize the path so we can't join the dot
stylesIncludePath = './' + path.join(THEME_STORE_FOLDER, fileName);
storagePath = path.join(destinationFolder, 'src', THEME_STORE_FOLDER, fileName);
}
return {
filePath: normalizePath(aquilaThemePath),
storagePath: storagePath ? normalizePath(storagePath) : undefined,
stylesIncludePath: normalizePath(stylesIncludePath)
};
}