mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 11:06:42 +02:00
refactor: restructure
monorepo with apps/ and services/ directories
This commit is contained in:
parent
25824ed0ac
commit
ff80aeec1f
4062 changed files with 2592 additions and 1278 deletions
|
|
@ -1,53 +0,0 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
/**
|
||||
* Get the root directory of the memoro-ui package
|
||||
*/
|
||||
export function getPackageRoot(): string {
|
||||
// CLI is in packages/memoro-ui/cli/
|
||||
// Package root is packages/memoro-ui/
|
||||
return path.resolve(__dirname, '../../../');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the registry.json file
|
||||
*/
|
||||
export function getRegistryPath(): string {
|
||||
return path.join(getPackageRoot(), 'registry.json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the components directory
|
||||
*/
|
||||
export function getComponentsPath(): string {
|
||||
return path.join(getPackageRoot(), 'components');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the destination path for components in the target app
|
||||
*/
|
||||
export function getDestinationPath(cwd: string = process.cwd()): string {
|
||||
// Check if we're in an app directory with a components folder
|
||||
const possiblePaths = [
|
||||
path.join(cwd, 'components'),
|
||||
path.join(cwd, 'app', 'components'),
|
||||
path.join(cwd, 'src', 'components'),
|
||||
];
|
||||
|
||||
for (const p of possiblePaths) {
|
||||
if (fs.existsSync(p)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
// Default to components/ in current directory
|
||||
return path.join(cwd, 'components');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure a directory exists, create if not
|
||||
*/
|
||||
export async function ensureDir(dirPath: string): Promise<void> {
|
||||
await fs.ensureDir(dirPath);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue