galaxy-design 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +320 -0
- package/dist/bin.js +11 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/add.js +252 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/init-old.js +159 -0
- package/dist/commands/init-old.js.map +1 -0
- package/dist/commands/init.js +266 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cli.js +5 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/registries/blocks-angular.json +89 -0
- package/dist/registries/blocks-flutter.json +60 -0
- package/dist/registries/blocks-react-native.json +60 -0
- package/dist/registries/blocks-react.json +89 -0
- package/dist/registries/blocks-vue.json +89 -0
- package/dist/registries/registry-angular.json +557 -0
- package/dist/registries/registry-flutter.json +491 -0
- package/dist/registries/registry-flutter.json.old +258 -0
- package/dist/registries/registry-react-native.json +491 -0
- package/dist/registries/registry-react-native.json.old +379 -0
- package/dist/registries/registry-react.json +526 -0
- package/dist/registries/registry-vue.json +586 -0
- package/dist/registry.json +460 -0
- package/dist/schemas/components-schema.json +91 -0
- package/dist/templates/tailwind.config.template +45 -0
- package/dist/templates/utils.ts.template +11 -0
- package/dist/utils/component-copier.js +207 -0
- package/dist/utils/component-copier.js.map +1 -0
- package/dist/utils/components-config.js +58 -0
- package/dist/utils/components-config.js.map +1 -0
- package/dist/utils/config-schema.js +221 -0
- package/dist/utils/config-schema.js.map +1 -0
- package/dist/utils/config.js +88 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/detect.js +86 -0
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/files.js +52 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/framework-registry.js +133 -0
- package/dist/utils/framework-registry.js.map +1 -0
- package/dist/utils/github-fetcher.js +120 -0
- package/dist/utils/github-fetcher.js.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/package-manager.js +173 -0
- package/dist/utils/package-manager.js.map +1 -0
- package/dist/utils/platform-detector.js +176 -0
- package/dist/utils/platform-detector.js.map +1 -0
- package/dist/utils/registry-loader.js +143 -0
- package/dist/utils/registry-loader.js.map +1 -0
- package/dist/utils/registry.js +92 -0
- package/dist/utils/registry.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* Detect the framework being used in the project
|
|
6
|
+
*/ export function detectFramework(cwd) {
|
|
7
|
+
// Check for Flutter first (uses pubspec.yaml instead of package.json)
|
|
8
|
+
const pubspecPath = resolve(cwd, 'pubspec.yaml');
|
|
9
|
+
if (existsSync(pubspecPath)) {
|
|
10
|
+
return 'flutter';
|
|
11
|
+
}
|
|
12
|
+
const packageJsonPath = resolve(cwd, 'package.json');
|
|
13
|
+
if (!existsSync(packageJsonPath)) {
|
|
14
|
+
return 'unknown';
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
18
|
+
const deps = _extends({}, packageJson.dependencies, packageJson.devDependencies);
|
|
19
|
+
// Check for React Native (must be before React check)
|
|
20
|
+
if (deps['react-native']) {
|
|
21
|
+
return 'react-native';
|
|
22
|
+
}
|
|
23
|
+
if (deps['@angular/core']) {
|
|
24
|
+
return 'angular';
|
|
25
|
+
}
|
|
26
|
+
if (deps['react']) {
|
|
27
|
+
return 'react';
|
|
28
|
+
}
|
|
29
|
+
if (deps['vue']) {
|
|
30
|
+
return 'vue';
|
|
31
|
+
}
|
|
32
|
+
return 'unknown';
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return 'unknown';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Detect the package manager being used
|
|
39
|
+
*/ export function detectPackageManager(cwd) {
|
|
40
|
+
// Check for Flutter package manager
|
|
41
|
+
if (existsSync(resolve(cwd, 'pubspec.yaml'))) {
|
|
42
|
+
return 'pub';
|
|
43
|
+
}
|
|
44
|
+
if (existsSync(resolve(cwd, 'bun.lockb')) || existsSync(resolve(cwd, 'bun.lock'))) {
|
|
45
|
+
return 'bun';
|
|
46
|
+
}
|
|
47
|
+
if (existsSync(resolve(cwd, 'pnpm-lock.yaml'))) {
|
|
48
|
+
return 'pnpm';
|
|
49
|
+
}
|
|
50
|
+
if (existsSync(resolve(cwd, 'yarn.lock'))) {
|
|
51
|
+
return 'yarn';
|
|
52
|
+
}
|
|
53
|
+
return 'npm';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check if project is already initialized with Galaxy UI
|
|
57
|
+
*/ export function isGalaxyInitialized(cwd) {
|
|
58
|
+
const packageJsonPath = resolve(cwd, 'package.json');
|
|
59
|
+
if (!existsSync(packageJsonPath)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
64
|
+
const deps = _extends({}, packageJson.dependencies, packageJson.devDependencies);
|
|
65
|
+
return !!(deps['lucide-angular'] && deps['clsx'] && deps['tailwind-merge']);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check if Tailwind CSS is installed
|
|
72
|
+
*/ export function isTailwindInstalled(cwd) {
|
|
73
|
+
const packageJsonPath = resolve(cwd, 'package.json');
|
|
74
|
+
if (!existsSync(packageJsonPath)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
79
|
+
const deps = _extends({}, packageJson.dependencies, packageJson.devDependencies);
|
|
80
|
+
return !!deps['tailwindcss'];
|
|
81
|
+
} catch (e) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/detect.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { resolve } from 'path';\n\nexport type Framework = 'angular' | 'react' | 'vue' | 'react-native' | 'flutter' | 'unknown';\nexport type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'pub';\n\n/**\n * Detect the framework being used in the project\n */\nexport function detectFramework(cwd: string): Framework {\n // Check for Flutter first (uses pubspec.yaml instead of package.json)\n const pubspecPath = resolve(cwd, 'pubspec.yaml');\n if (existsSync(pubspecPath)) {\n return 'flutter';\n }\n\n const packageJsonPath = resolve(cwd, 'package.json');\n\n if (!existsSync(packageJsonPath)) {\n return 'unknown';\n }\n\n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n // Check for React Native (must be before React check)\n if (deps['react-native']) {\n return 'react-native';\n }\n\n if (deps['@angular/core']) {\n return 'angular';\n }\n if (deps['react']) {\n return 'react';\n }\n if (deps['vue']) {\n return 'vue';\n }\n\n return 'unknown';\n } catch {\n return 'unknown';\n }\n}\n\n/**\n * Detect the package manager being used\n */\nexport function detectPackageManager(cwd: string): PackageManager {\n // Check for Flutter package manager\n if (existsSync(resolve(cwd, 'pubspec.yaml'))) {\n return 'pub';\n }\n\n if (existsSync(resolve(cwd, 'bun.lockb')) || existsSync(resolve(cwd, 'bun.lock'))) {\n return 'bun';\n }\n if (existsSync(resolve(cwd, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n if (existsSync(resolve(cwd, 'yarn.lock'))) {\n return 'yarn';\n }\n return 'npm';\n}\n\n/**\n * Check if project is already initialized with Galaxy UI\n */\nexport function isGalaxyInitialized(cwd: string): boolean {\n const packageJsonPath = resolve(cwd, 'package.json');\n\n if (!existsSync(packageJsonPath)) {\n return false;\n }\n\n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n return !!(deps['lucide-angular'] && deps['clsx'] && deps['tailwind-merge']);\n } catch {\n return false;\n }\n}\n\n/**\n * Check if Tailwind CSS is installed\n */\nexport function isTailwindInstalled(cwd: string): boolean {\n const packageJsonPath = resolve(cwd, 'package.json');\n\n if (!existsSync(packageJsonPath)) {\n return false;\n }\n\n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n return !!deps['tailwindcss'];\n } catch {\n return false;\n }\n}\n"],"names":["existsSync","readFileSync","resolve","detectFramework","cwd","pubspecPath","packageJsonPath","packageJson","JSON","parse","deps","dependencies","devDependencies","detectPackageManager","isGalaxyInitialized","isTailwindInstalled"],"mappings":";AAAA,SAASA,UAAU,EAAEC,YAAY,QAAQ,KAAK;AAC9C,SAASC,OAAO,QAAQ,OAAO;AAK/B;;CAEC,GACD,OAAO,SAASC,gBAAgBC,GAAW;IACzC,sEAAsE;IACtE,MAAMC,cAAcH,QAAQE,KAAK;IACjC,IAAIJ,WAAWK,cAAc;QAC3B,OAAO;IACT;IAEA,MAAMC,kBAAkBJ,QAAQE,KAAK;IAErC,IAAI,CAACJ,WAAWM,kBAAkB;QAChC,OAAO;IACT;IAEA,IAAI;QACF,MAAMC,cAAcC,KAAKC,KAAK,CAACR,aAAaK,iBAAiB;QAC7D,MAAMI,OAAO,aACRH,YAAYI,YAAY,EACxBJ,YAAYK,eAAe;QAGhC,sDAAsD;QACtD,IAAIF,IAAI,CAAC,eAAe,EAAE;YACxB,OAAO;QACT;QAEA,IAAIA,IAAI,CAAC,gBAAgB,EAAE;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AAc;IAC9B,EAAE,UAAM;QACN,OAAO;IACT;AACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { dirname, resolve } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Ensure a directory exists, creating it if necessary
|
|
5
|
+
*/ export function ensureDir(dir) {
|
|
6
|
+
if (!existsSync(dir)) {
|
|
7
|
+
mkdirSync(dir, {
|
|
8
|
+
recursive: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Write a file, creating directories if needed
|
|
14
|
+
*/ export function writeFile(filePath, content) {
|
|
15
|
+
ensureDir(dirname(filePath));
|
|
16
|
+
writeFileSync(filePath, content, 'utf-8');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Read a file as string
|
|
20
|
+
*/ export function readFile(filePath) {
|
|
21
|
+
return readFileSync(filePath, 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if a file exists
|
|
25
|
+
*/ export function fileExists(filePath) {
|
|
26
|
+
return existsSync(filePath);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the component path based on the user's config or defaults
|
|
30
|
+
*/ export function getComponentPath(cwd, componentName, config) {
|
|
31
|
+
const componentsDir = (config == null ? void 0 : config.componentsPath) || 'src/components/ui';
|
|
32
|
+
return resolve(cwd, componentsDir, componentName);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get the utils path based on the user's config or defaults
|
|
36
|
+
*/ export function getUtilsPath(cwd, config) {
|
|
37
|
+
return resolve(cwd, (config == null ? void 0 : config.utilsPath) || 'src/lib/utils.ts');
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Copy component files from source to destination
|
|
41
|
+
*/ export function copyComponentFiles(sourcePath, destPath, files) {
|
|
42
|
+
for (const file of files){
|
|
43
|
+
const source = resolve(sourcePath, file);
|
|
44
|
+
const dest = resolve(destPath, file);
|
|
45
|
+
if (existsSync(source)) {
|
|
46
|
+
const content = readFile(source);
|
|
47
|
+
writeFile(dest, content);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/files.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport { dirname, resolve } from 'path';\n\n/**\n * Ensure a directory exists, creating it if necessary\n */\nexport function ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\n/**\n * Write a file, creating directories if needed\n */\nexport function writeFile(filePath: string, content: string): void {\n ensureDir(dirname(filePath));\n writeFileSync(filePath, content, 'utf-8');\n}\n\n/**\n * Read a file as string\n */\nexport function readFile(filePath: string): string {\n return readFileSync(filePath, 'utf-8');\n}\n\n/**\n * Check if a file exists\n */\nexport function fileExists(filePath: string): boolean {\n return existsSync(filePath);\n}\n\n/**\n * Get the component path based on the user's config or defaults\n */\nexport function getComponentPath(cwd: string, componentName: string, config?: { componentsPath?: string }): string {\n const componentsDir = config?.componentsPath || 'src/components/ui';\n return resolve(cwd, componentsDir, componentName);\n}\n\n/**\n * Get the utils path based on the user's config or defaults\n */\nexport function getUtilsPath(cwd: string, config?: { utilsPath?: string }): string {\n return resolve(cwd, config?.utilsPath || 'src/lib/utils.ts');\n}\n\n/**\n * Copy component files from source to destination\n */\nexport function copyComponentFiles(\n sourcePath: string,\n destPath: string,\n files: string[]\n): void {\n for (const file of files) {\n const source = resolve(sourcePath, file);\n const dest = resolve(destPath, file);\n\n if (existsSync(source)) {\n const content = readFile(source);\n writeFile(dest, content);\n }\n }\n}\n"],"names":["existsSync","mkdirSync","readFileSync","writeFileSync","dirname","resolve","ensureDir","dir","recursive","writeFile","filePath","content","readFile","fileExists","getComponentPath","cwd","componentName","config","componentsDir","componentsPath","getUtilsPath","utilsPath","copyComponentFiles","sourcePath","destPath","files","file","source","dest"],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,aAAa,QAAQ,KAAK;AACxE,SAASC,OAAO,EAAEC,OAAO,QAAQ,OAAO;AAExC;;CAEC,GACD,OAAO,SAASC,UAAUC,GAAW;IACnC,IAAI,CAACP,WAAWO,MAAM;QACpBN,UAAUM,KAAK;YAAEC,WAAW;QAAK;IACnC;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,UAAUC,QAAgB,EAAEC,OAAe;IACzDL,UAAUF,QAAQM;IAClBP,cAAcO,UAAUC,SAAS;AACnC;AAEA;;CAEC,GACD,OAAO,SAASC,SAASF,QAAgB;IACvC,OAAOR,aAAaQ,UAAU;AAChC;AAEA;;CAEC,GACD,OAAO,SAASG,WAAWH,QAAgB;IACzC,OAAOV,WAAWU;AACpB;AAEA;;CAEC,GACD,OAAO,SAASI,iBAAiBC,GAAW,EAAEC,aAAqB,EAAEC,MAAoC;IACvG,MAAMC,gBAAgBD,CAAAA,0BAAAA,OAAQE,cAAc,KAAI;IAChD,OAAOd,QAAQU,KAAKG,eAAeF;AACrC;AAEA;;CAEC,GACD,OAAO,SAASI,aAAaL,GAAW,EAAEE,MAA+B;IACvE,OAAOZ,QAAQU,KAAKE,CAAAA,0BAAAA,OAAQI,SAAS,KAAI;AAC3C;AAEA;;CAEC,GACD,OAAO,SAASC,mBACdC,UAAkB,EAClBC,QAAgB,EAChBC,KAAe;IAEf,KAAK,MAAMC,QAAQD,MAAO;QACxB,MAAME,SAAStB,QAAQkB,YAAYG;QACnC,MAAME,OAAOvB,QAAQmB,UAAUE;QAE/B,IAAI1B,WAAW2B,SAAS;YACtB,MAAMhB,UAAUC,SAASe;YACzBlB,UAAUmB,MAAMjB;QAClB;IACF;AACF"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { readFileSync, existsSync } from 'fs';
|
|
3
|
+
import { resolve, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
// Cache registries by framework
|
|
8
|
+
const registryCache = new Map();
|
|
9
|
+
/**
|
|
10
|
+
* Load framework-specific registry (includes both components and blocks)
|
|
11
|
+
*/ export function loadFrameworkRegistry(framework) {
|
|
12
|
+
// Check cache first
|
|
13
|
+
if (registryCache.has(framework)) {
|
|
14
|
+
return registryCache.get(framework);
|
|
15
|
+
}
|
|
16
|
+
const registryPath = resolve(__dirname, `../registries/registry-${framework}.json`);
|
|
17
|
+
if (!existsSync(registryPath)) {
|
|
18
|
+
throw new Error(`Registry not found for framework: ${framework}. Expected at ${registryPath}`);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const registryContent = readFileSync(registryPath, 'utf-8');
|
|
22
|
+
const registry = JSON.parse(registryContent);
|
|
23
|
+
// Try to load and merge blocks registry
|
|
24
|
+
const blocksRegistryPath = resolve(__dirname, `../registries/blocks-${framework}.json`);
|
|
25
|
+
if (existsSync(blocksRegistryPath)) {
|
|
26
|
+
try {
|
|
27
|
+
const blocksContent = readFileSync(blocksRegistryPath, 'utf-8');
|
|
28
|
+
const blocksRegistry = JSON.parse(blocksContent);
|
|
29
|
+
// Merge blocks into main registry
|
|
30
|
+
registry.components = _extends({}, registry.components, blocksRegistry.components);
|
|
31
|
+
registry.groups = _extends({}, registry.groups, blocksRegistry.groups);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
// Blocks registry is optional, so we just log and continue
|
|
34
|
+
console.warn(`Warning: Failed to load blocks registry for ${framework}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Cache the merged registry
|
|
38
|
+
registryCache.set(framework, registry);
|
|
39
|
+
return registry;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw new Error(`Failed to load registry for ${framework}: ${error}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get a component by name from framework registry
|
|
46
|
+
*/ export function getFrameworkComponent(framework, name) {
|
|
47
|
+
const registry = loadFrameworkRegistry(framework);
|
|
48
|
+
return registry.components[name];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get all components from framework registry
|
|
52
|
+
*/ export function getAllFrameworkComponents(framework) {
|
|
53
|
+
const registry = loadFrameworkRegistry(framework);
|
|
54
|
+
return registry.components;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get components by type from framework registry
|
|
58
|
+
*/ export function getFrameworkComponentsByType(framework, type) {
|
|
59
|
+
const registry = loadFrameworkRegistry(framework);
|
|
60
|
+
return Object.values(registry.components).filter((c)=>c.type === type);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get components by group name from framework registry
|
|
64
|
+
*/ export function getFrameworkComponentsByGroup(framework, groupName) {
|
|
65
|
+
const registry = loadFrameworkRegistry(framework);
|
|
66
|
+
const group = registry.groups[groupName];
|
|
67
|
+
if (!group) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
return group.components.map((name)=>registry.components[name]).filter(Boolean);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get all component groups from framework registry
|
|
74
|
+
*/ export function getAllFrameworkGroups(framework) {
|
|
75
|
+
const registry = loadFrameworkRegistry(framework);
|
|
76
|
+
return registry.groups;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if a component exists in framework registry
|
|
80
|
+
*/ export function frameworkComponentExists(framework, name) {
|
|
81
|
+
const registry = loadFrameworkRegistry(framework);
|
|
82
|
+
return !!registry.components[name];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get component dependencies (including registry dependencies)
|
|
86
|
+
*/ export function getFrameworkComponentDependencies(framework, name) {
|
|
87
|
+
const component = getFrameworkComponent(framework, name);
|
|
88
|
+
if (!component) {
|
|
89
|
+
return {
|
|
90
|
+
dependencies: [],
|
|
91
|
+
devDependencies: [],
|
|
92
|
+
registryDependencies: []
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Merge peerDependencies into dependencies for installation
|
|
96
|
+
const allDependencies = [
|
|
97
|
+
...component.dependencies || [],
|
|
98
|
+
...component.peerDependencies || []
|
|
99
|
+
];
|
|
100
|
+
return {
|
|
101
|
+
dependencies: allDependencies,
|
|
102
|
+
devDependencies: component.devDependencies || [],
|
|
103
|
+
registryDependencies: component.registryDependencies || []
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve component name with aliases (case-insensitive match)
|
|
108
|
+
*/ export function resolveFrameworkComponentName(framework, input) {
|
|
109
|
+
const registry = loadFrameworkRegistry(framework);
|
|
110
|
+
// Check exact match
|
|
111
|
+
if (registry.components[input]) {
|
|
112
|
+
return input;
|
|
113
|
+
}
|
|
114
|
+
// Check group match
|
|
115
|
+
if (registry.groups[input]) {
|
|
116
|
+
return input;
|
|
117
|
+
}
|
|
118
|
+
// Check case-insensitive match
|
|
119
|
+
const lowerInput = input.toLowerCase();
|
|
120
|
+
for (const name of Object.keys(registry.components)){
|
|
121
|
+
if (name.toLowerCase() === lowerInput) {
|
|
122
|
+
return name;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Clear registry cache (useful for testing)
|
|
129
|
+
*/ export function clearRegistryCache() {
|
|
130
|
+
registryCache.clear();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=framework-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/framework-registry.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'fs';\nimport { resolve, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport type { Framework } from './config-schema.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport interface FrameworkComponent {\n name: string;\n type: 'form' | 'layout' | 'navigation' | 'feedback' | 'data-display' | 'modal-overlay' | 'block' | 'other';\n description: string;\n files: string[];\n dependencies: string[];\n devDependencies: string[];\n peerDependencies?: string[];\n registryDependencies: string[];\n category: string;\n}\n\nexport interface FrameworkComponentGroup {\n name: string;\n components: string[];\n}\n\nexport interface FrameworkRegistry {\n name: string;\n components: Record<string, FrameworkComponent>;\n groups: Record<string, FrameworkComponentGroup>;\n}\n\n// Cache registries by framework\nconst registryCache: Map<Framework, FrameworkRegistry> = new Map();\n\n/**\n * Load framework-specific registry (includes both components and blocks)\n */\nexport function loadFrameworkRegistry(framework: Framework): FrameworkRegistry {\n // Check cache first\n if (registryCache.has(framework)) {\n return registryCache.get(framework)!;\n }\n\n const registryPath = resolve(__dirname, `../registries/registry-${framework}.json`);\n\n if (!existsSync(registryPath)) {\n throw new Error(\n `Registry not found for framework: ${framework}. Expected at ${registryPath}`\n );\n }\n\n try {\n const registryContent = readFileSync(registryPath, 'utf-8');\n const registry: FrameworkRegistry = JSON.parse(registryContent);\n\n // Try to load and merge blocks registry\n const blocksRegistryPath = resolve(__dirname, `../registries/blocks-${framework}.json`);\n if (existsSync(blocksRegistryPath)) {\n try {\n const blocksContent = readFileSync(blocksRegistryPath, 'utf-8');\n const blocksRegistry: FrameworkRegistry = JSON.parse(blocksContent);\n\n // Merge blocks into main registry\n registry.components = {\n ...registry.components,\n ...blocksRegistry.components,\n };\n\n registry.groups = {\n ...registry.groups,\n ...blocksRegistry.groups,\n };\n } catch (error) {\n // Blocks registry is optional, so we just log and continue\n console.warn(`Warning: Failed to load blocks registry for ${framework}`);\n }\n }\n\n // Cache the merged registry\n registryCache.set(framework, registry);\n\n return registry;\n } catch (error) {\n throw new Error(`Failed to load registry for ${framework}: ${error}`);\n }\n}\n\n/**\n * Get a component by name from framework registry\n */\nexport function getFrameworkComponent(\n framework: Framework,\n name: string\n): FrameworkComponent | undefined {\n const registry = loadFrameworkRegistry(framework);\n return registry.components[name];\n}\n\n/**\n * Get all components from framework registry\n */\nexport function getAllFrameworkComponents(\n framework: Framework\n): Record<string, FrameworkComponent> {\n const registry = loadFrameworkRegistry(framework);\n return registry.components;\n}\n\n/**\n * Get components by type from framework registry\n */\nexport function getFrameworkComponentsByType(\n framework: Framework,\n type: FrameworkComponent['type']\n): FrameworkComponent[] {\n const registry = loadFrameworkRegistry(framework);\n return Object.values(registry.components).filter((c) => c.type === type);\n}\n\n/**\n * Get components by group name from framework registry\n */\nexport function getFrameworkComponentsByGroup(\n framework: Framework,\n groupName: string\n): FrameworkComponent[] {\n const registry = loadFrameworkRegistry(framework);\n const group = registry.groups[groupName];\n\n if (!group) {\n return [];\n }\n\n return group.components\n .map((name) => registry.components[name])\n .filter(Boolean);\n}\n\n/**\n * Get all component groups from framework registry\n */\nexport function getAllFrameworkGroups(\n framework: Framework\n): Record<string, FrameworkComponentGroup> {\n const registry = loadFrameworkRegistry(framework);\n return registry.groups;\n}\n\n/**\n * Check if a component exists in framework registry\n */\nexport function frameworkComponentExists(\n framework: Framework,\n name: string\n): boolean {\n const registry = loadFrameworkRegistry(framework);\n return !!registry.components[name];\n}\n\n/**\n * Get component dependencies (including registry dependencies)\n */\nexport function getFrameworkComponentDependencies(\n framework: Framework,\n name: string\n): {\n dependencies: string[];\n devDependencies: string[];\n registryDependencies: string[];\n} {\n const component = getFrameworkComponent(framework, name);\n\n if (!component) {\n return {\n dependencies: [],\n devDependencies: [],\n registryDependencies: [],\n };\n }\n\n // Merge peerDependencies into dependencies for installation\n const allDependencies = [\n ...(component.dependencies || []),\n ...(component.peerDependencies || []),\n ];\n\n return {\n dependencies: allDependencies,\n devDependencies: component.devDependencies || [],\n registryDependencies: component.registryDependencies || [],\n };\n}\n\n/**\n * Resolve component name with aliases (case-insensitive match)\n */\nexport function resolveFrameworkComponentName(\n framework: Framework,\n input: string\n): string | null {\n const registry = loadFrameworkRegistry(framework);\n\n // Check exact match\n if (registry.components[input]) {\n return input;\n }\n\n // Check group match\n if (registry.groups[input]) {\n return input;\n }\n\n // Check case-insensitive match\n const lowerInput = input.toLowerCase();\n for (const name of Object.keys(registry.components)) {\n if (name.toLowerCase() === lowerInput) {\n return name;\n }\n }\n\n return null;\n}\n\n/**\n * Clear registry cache (useful for testing)\n */\nexport function clearRegistryCache(): void {\n registryCache.clear();\n}\n"],"names":["readFileSync","existsSync","resolve","dirname","fileURLToPath","__filename","url","__dirname","registryCache","Map","loadFrameworkRegistry","framework","has","get","registryPath","Error","registryContent","registry","JSON","parse","blocksRegistryPath","blocksContent","blocksRegistry","components","groups","error","console","warn","set","getFrameworkComponent","name","getAllFrameworkComponents","getFrameworkComponentsByType","type","Object","values","filter","c","getFrameworkComponentsByGroup","groupName","group","map","Boolean","getAllFrameworkGroups","frameworkComponentExists","getFrameworkComponentDependencies","component","dependencies","devDependencies","registryDependencies","allDependencies","peerDependencies","resolveFrameworkComponentName","input","lowerInput","toLowerCase","keys","clearRegistryCache","clear"],"mappings":";AAAA,SAASA,YAAY,EAAEC,UAAU,QAAQ,KAAK;AAC9C,SAASC,OAAO,EAAEC,OAAO,QAAQ,OAAO;AACxC,SAASC,aAAa,QAAQ,MAAM;AAGpC,MAAMC,aAAaD,cAAc,YAAYE,GAAG;AAChD,MAAMC,YAAYJ,QAAQE;AAyB1B,gCAAgC;AAChC,MAAMG,gBAAmD,IAAIC;AAE7D;;CAEC,GACD,OAAO,SAASC,sBAAsBC,SAAoB;IACxD,oBAAoB;IACpB,IAAIH,cAAcI,GAAG,CAACD,YAAY;QAChC,OAAOH,cAAcK,GAAG,CAACF;IAC3B;IAEA,MAAMG,eAAeZ,QAAQK,WAAW,CAAC,uBAAuB,EAAEI,UAAU,KAAK,CAAC;IAElF,IAAI,CAACV,WAAWa,eAAe;QAC7B,MAAM,IAAIC,MACR,CAAC,kCAAkC,EAAEJ,UAAU,cAAc,EAAEG,cAAc;I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MAAMC,aAAaD,MAAME,WAAW;IACpC,KAAK,MAAMzB,QAAQI,OAAOsB,IAAI,CAACvC,SAASM,UAAU,EAAG;QACnD,IAAIO,KAAKyB,WAAW,OAAOD,YAAY;YACrC,OAAOxB;QACT;IACF;IAEA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAAS2B;IACdjD,cAAckD,KAAK;AACrB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
2
|
+
import { dirname } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* GitHub repository configuration
|
|
5
|
+
*/ const GITHUB_CONFIG = {
|
|
6
|
+
owner: 'buikevin',
|
|
7
|
+
repo: 'galaxy-design',
|
|
8
|
+
branch: 'main'
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Get GitHub raw content URL
|
|
12
|
+
*/ export function getGitHubRawUrl(filePath) {
|
|
13
|
+
const { owner, repo, branch } = GITHUB_CONFIG;
|
|
14
|
+
return `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${filePath}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Fetch file content from GitHub
|
|
18
|
+
*
|
|
19
|
+
* @param filePath - Relative path in repository
|
|
20
|
+
* @returns File content as string
|
|
21
|
+
*/ export async function fetchFileFromGitHub(filePath) {
|
|
22
|
+
const url = getGitHubRawUrl(filePath);
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(url);
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
if (response.status === 404) {
|
|
27
|
+
throw new Error(`File not found: ${filePath}`);
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Failed to fetch ${filePath}: ${response.statusText}`);
|
|
30
|
+
}
|
|
31
|
+
return await response.text();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (error instanceof Error) {
|
|
34
|
+
throw new Error(`GitHub fetch error: ${error.message}`);
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Unknown error fetching ${filePath}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fetch and save file from GitHub to local path
|
|
41
|
+
*
|
|
42
|
+
* @param sourceFilePath - Path in GitHub repository
|
|
43
|
+
* @param targetFilePath - Local file path to save
|
|
44
|
+
* @returns True if successful
|
|
45
|
+
*/ export async function fetchAndSaveFile(sourceFilePath, targetFilePath) {
|
|
46
|
+
try {
|
|
47
|
+
const content = await fetchFileFromGitHub(sourceFilePath);
|
|
48
|
+
// Create directory if it doesn't exist
|
|
49
|
+
const dir = dirname(targetFilePath);
|
|
50
|
+
if (!existsSync(dir)) {
|
|
51
|
+
mkdirSync(dir, {
|
|
52
|
+
recursive: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Write file
|
|
56
|
+
writeFileSync(targetFilePath, content, 'utf-8');
|
|
57
|
+
return true;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(`Failed to fetch and save ${sourceFilePath}:`, error);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Fetch multiple files from GitHub
|
|
65
|
+
*
|
|
66
|
+
* @param files - Array of { source: githubPath, target: localPath }
|
|
67
|
+
* @returns Results for each file
|
|
68
|
+
*/ export async function fetchMultipleFiles(files) {
|
|
69
|
+
const results = await Promise.all(files.map(async ({ source, target })=>{
|
|
70
|
+
try {
|
|
71
|
+
const success = await fetchAndSaveFile(source, target);
|
|
72
|
+
return {
|
|
73
|
+
file: source,
|
|
74
|
+
success,
|
|
75
|
+
error: success ? undefined : 'Failed to fetch'
|
|
76
|
+
};
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
file: source,
|
|
80
|
+
success: false,
|
|
81
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get component source path in GitHub repository
|
|
89
|
+
*
|
|
90
|
+
* @param platform - Platform (vue, react, angular, react-native, flutter)
|
|
91
|
+
* @param componentName - Component name
|
|
92
|
+
* @param fileName - File name
|
|
93
|
+
* @returns GitHub repository path
|
|
94
|
+
*/ export function getComponentGitHubPath(platform, componentName, fileName) {
|
|
95
|
+
// Map platform to package directory
|
|
96
|
+
const platformMap = {
|
|
97
|
+
vue: 'packages/vue/src/components',
|
|
98
|
+
react: 'packages/react/src/components',
|
|
99
|
+
angular: 'packages/angular/src/components',
|
|
100
|
+
'react-native': 'packages/react-native/src/components',
|
|
101
|
+
flutter: 'packages/flutter/lib/components'
|
|
102
|
+
};
|
|
103
|
+
const basePath = platformMap[platform] || `packages/${platform}/src/components`;
|
|
104
|
+
return `${basePath}/${componentName}/${fileName}`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Check if GitHub repository is accessible
|
|
108
|
+
*/ export async function checkGitHubConnection() {
|
|
109
|
+
try {
|
|
110
|
+
const url = getGitHubRawUrl('README.md');
|
|
111
|
+
const response = await fetch(url, {
|
|
112
|
+
method: 'HEAD'
|
|
113
|
+
});
|
|
114
|
+
return response.ok;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=github-fetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/github-fetcher.ts"],"sourcesContent":["import { writeFileSync, mkdirSync, existsSync } from 'fs';\nimport { dirname } from 'path';\n\n/**\n * GitHub repository configuration\n */\nconst GITHUB_CONFIG = {\n\towner: 'buikevin',\n\trepo: 'galaxy-design',\n\tbranch: 'main',\n};\n\n/**\n * Get GitHub raw content URL\n */\nexport function getGitHubRawUrl(filePath: string): string {\n\tconst { owner, repo, branch } = GITHUB_CONFIG;\n\treturn `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${filePath}`;\n}\n\n/**\n * Fetch file content from GitHub\n *\n * @param filePath - Relative path in repository\n * @returns File content as string\n */\nexport async function fetchFileFromGitHub(filePath: string): Promise<string> {\n\tconst url = getGitHubRawUrl(filePath);\n\n\ttry {\n\t\tconst response = await fetch(url);\n\n\t\tif (!response.ok) {\n\t\t\tif (response.status === 404) {\n\t\t\t\tthrow new Error(`File not found: ${filePath}`);\n\t\t\t}\n\t\t\tthrow new Error(`Failed to fetch ${filePath}: ${response.statusText}`);\n\t\t}\n\n\t\treturn await response.text();\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tthrow new Error(`GitHub fetch error: ${error.message}`);\n\t\t}\n\t\tthrow new Error(`Unknown error fetching ${filePath}`);\n\t}\n}\n\n/**\n * Fetch and save file from GitHub to local path\n *\n * @param sourceFilePath - Path in GitHub repository\n * @param targetFilePath - Local file path to save\n * @returns True if successful\n */\nexport async function fetchAndSaveFile(\n\tsourceFilePath: string,\n\ttargetFilePath: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst content = await fetchFileFromGitHub(sourceFilePath);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = dirname(targetFilePath);\n\t\tif (!existsSync(dir)) {\n\t\t\tmkdirSync(dir, { recursive: true });\n\t\t}\n\n\t\t// Write file\n\t\twriteFileSync(targetFilePath, content, 'utf-8');\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(`Failed to fetch and save ${sourceFilePath}:`, error);\n\t\treturn false;\n\t}\n}\n\n/**\n * Fetch multiple files from GitHub\n *\n * @param files - Array of { source: githubPath, target: localPath }\n * @returns Results for each file\n */\nexport async function fetchMultipleFiles(\n\tfiles: Array<{ source: string; target: string }>,\n): Promise<Array<{ file: string; success: boolean; error?: string }>> {\n\tconst results = await Promise.all(\n\t\tfiles.map(async ({ source, target }) => {\n\t\t\ttry {\n\t\t\t\tconst success = await fetchAndSaveFile(source, target);\n\t\t\t\treturn {\n\t\t\t\t\tfile: source,\n\t\t\t\t\tsuccess,\n\t\t\t\t\terror: success ? undefined : 'Failed to fetch',\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tfile: source,\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: error instanceof Error ? error.message : 'Unknown error',\n\t\t\t\t};\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn results;\n}\n\n/**\n * Get component source path in GitHub repository\n *\n * @param platform - Platform (vue, react, angular, react-native, flutter)\n * @param componentName - Component name\n * @param fileName - File name\n * @returns GitHub repository path\n */\nexport function getComponentGitHubPath(\n\tplatform: string,\n\tcomponentName: string,\n\tfileName: string,\n): string {\n\t// Map platform to package directory\n\tconst platformMap: Record<string, string> = {\n\t\tvue: 'packages/vue/src/components',\n\t\treact: 'packages/react/src/components',\n\t\tangular: 'packages/angular/src/components',\n\t\t'react-native': 'packages/react-native/src/components',\n\t\tflutter: 'packages/flutter/lib/components',\n\t};\n\n\tconst basePath = platformMap[platform] || `packages/${platform}/src/components`;\n\treturn `${basePath}/${componentName}/${fileName}`;\n}\n\n/**\n * Check if GitHub repository is accessible\n */\nexport async function checkGitHubConnection(): Promise<boolean> {\n\ttry {\n\t\tconst url = getGitHubRawUrl('README.md');\n\t\tconst response = await fetch(url, { method: 'HEAD' });\n\t\treturn response.ok;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],"names":["writeFileSync","mkdirSync","existsSync","dirname","GITHUB_CONFIG","owner","repo","branch","getGitHubRawUrl","filePath","fetchFileFromGitHub","url","response","fetch","ok","status","Error","statusText","text","error","message","fetchAndSaveFile","sourceFilePath","targetFilePath","content","dir","recursive","console","fetchMultipleFiles","files","results","Promise","all","map","source","target","success","file","undefined","getComponentGitHubPath","platform","componentName","fileName","platformMap","vue","react","angular","flutter","basePath","checkGitHubConnection","method"],"mappings":"AAAA,SAASA,aAAa,EAAEC,SAAS,EAAEC,UAAU,QAAQ,KAAK;AAC1D,SAASC,OAAO,QAAQ,OAAO;AAE/B;;CAEC,G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AAC,CAAC,EAAEH;QAC7D,OAAO;IACR;AACD;AAEA;;;;;CAKC,GACD,OAAO,eAAeS,mBACrBC,KAAgD;IAEhD,MAAMC,UAAU,MAAMC,QAAQC,GAAG,CAChCH,MAAMI,GAAG,CAAC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAE;QAClC,IAAI;YACH,MAAMC,UAAU,MAAMf,iBAAiBa,QAAQC;YAC/C,OAAO;gBACNE,MAAMH;gBACNE;gBACAjB,OAAOiB,UAAUE,YAAY;YAC9B;QACD,EAAE,OAAOnB,OAAO;YACf,OAAO;gBACNkB,MAAMH;gBACNE,SAAS;gBACTjB,OAAOA,iBAAiBH,QAAQG,MAAMC,OAAO,GAAG;YACjD;QACD;IACD;IAGD,OAAOU;AACR;AAEA;;;;;;;CAOC,GACD,OAAO,SAASS,uBACfC,QAAgB,EAChBC,aAAqB,EACrBC,QAAgB;IAEhB,oCAAoC;IACpC,MAAMC,cAAsC;QAC3CC,KAAK;QACLC,OAAO;QACPC,SAAS;QACT,gBAAgB;QAChBC,SAAS;IACV;IAEA,MAAMC,WAAWL,WAAW,CAACH,SAAS,IAAI,CAAC,SAAS,EAAEA,SAAS,eAAe,CAAC;IAC/E,OAAO,GAAGQ,SAAS,CAAC,EAAEP,cAAc,CAAC,EAAEC,UAAU;AAClD;AAEA;;CAEC,GACD,OAAO,eAAeO;IACrB,IAAI;QACH,MAAMtC,MAAMH,gBAAgB;QAC5B,MAAMI,WAAW,MAAMC,MAAMF,KAAK;YAAEuC,QAAQ;QAAO;QACnD,OAAOtC,SAASE,EAAE;IACnB,EAAE,UAAM;QACP,OAAO;IACR;AACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Galaxy UI CLI - Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized export for all utility modules
|
|
5
|
+
*/ // Platform detection
|
|
6
|
+
export * from './platform-detector';
|
|
7
|
+
// Registry loading
|
|
8
|
+
export * from './registry-loader';
|
|
9
|
+
// Component copying
|
|
10
|
+
export * from './component-copier';
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["/**\n * Galaxy UI CLI - Utilities\n *\n * Centralized export for all utility modules\n */\n\n// Platform detection\nexport * from './platform-detector';\n\n// Registry loading\nexport * from './registry-loader';\n\n// Component copying\nexport * from './component-copier';\n"],"names":[],"mappings":"AAAA;;;;CAIC,GAED,qBAAqB;AACrB,cAAc,sBAAsB;AAEpC,mBAAmB;AACnB,cAAc,oBAAoB;AAElC,oBAAoB;AACpB,cAAc,qBAAqB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* Detect which package manager is being used in the project
|
|
6
|
+
*/ export function detectPackageManager(cwd = process.cwd()) {
|
|
7
|
+
// Check for lock files
|
|
8
|
+
if (existsSync(join(cwd, 'bun.lockb')) || existsSync(join(cwd, 'bun.lock'))) {
|
|
9
|
+
return 'bun';
|
|
10
|
+
}
|
|
11
|
+
if (existsSync(join(cwd, 'pnpm-lock.yaml'))) {
|
|
12
|
+
return 'pnpm';
|
|
13
|
+
}
|
|
14
|
+
if (existsSync(join(cwd, 'yarn.lock'))) {
|
|
15
|
+
return 'yarn';
|
|
16
|
+
}
|
|
17
|
+
if (existsSync(join(cwd, 'package-lock.json'))) {
|
|
18
|
+
return 'npm';
|
|
19
|
+
}
|
|
20
|
+
// Default to npm
|
|
21
|
+
return 'npm';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the install command for the detected package manager
|
|
25
|
+
*/ export function getInstallCommand(packageManager, packages) {
|
|
26
|
+
switch(packageManager){
|
|
27
|
+
case 'bun':
|
|
28
|
+
return [
|
|
29
|
+
'bun',
|
|
30
|
+
'add',
|
|
31
|
+
...packages
|
|
32
|
+
];
|
|
33
|
+
case 'pnpm':
|
|
34
|
+
return [
|
|
35
|
+
'pnpm',
|
|
36
|
+
'add',
|
|
37
|
+
...packages
|
|
38
|
+
];
|
|
39
|
+
case 'yarn':
|
|
40
|
+
return [
|
|
41
|
+
'yarn',
|
|
42
|
+
'add',
|
|
43
|
+
...packages
|
|
44
|
+
];
|
|
45
|
+
case 'npm':
|
|
46
|
+
default:
|
|
47
|
+
return [
|
|
48
|
+
'npm',
|
|
49
|
+
'install',
|
|
50
|
+
...packages
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Install dependencies using the detected package manager
|
|
56
|
+
*/ export async function installDependencies(packages, options = {}) {
|
|
57
|
+
const { cwd = process.cwd(), dev = false, silent = false } = options;
|
|
58
|
+
if (packages.length === 0) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const packageManager = detectPackageManager(cwd);
|
|
62
|
+
let command;
|
|
63
|
+
let args;
|
|
64
|
+
switch(packageManager){
|
|
65
|
+
case 'bun':
|
|
66
|
+
command = [
|
|
67
|
+
'bun'
|
|
68
|
+
];
|
|
69
|
+
args = [
|
|
70
|
+
'add',
|
|
71
|
+
...dev ? [
|
|
72
|
+
'-D'
|
|
73
|
+
] : [],
|
|
74
|
+
...packages
|
|
75
|
+
];
|
|
76
|
+
break;
|
|
77
|
+
case 'pnpm':
|
|
78
|
+
command = [
|
|
79
|
+
'pnpm'
|
|
80
|
+
];
|
|
81
|
+
args = [
|
|
82
|
+
'add',
|
|
83
|
+
...dev ? [
|
|
84
|
+
'-D'
|
|
85
|
+
] : [],
|
|
86
|
+
...packages
|
|
87
|
+
];
|
|
88
|
+
break;
|
|
89
|
+
case 'yarn':
|
|
90
|
+
command = [
|
|
91
|
+
'yarn'
|
|
92
|
+
];
|
|
93
|
+
args = [
|
|
94
|
+
'add',
|
|
95
|
+
...dev ? [
|
|
96
|
+
'-D'
|
|
97
|
+
] : [],
|
|
98
|
+
...packages
|
|
99
|
+
];
|
|
100
|
+
break;
|
|
101
|
+
case 'npm':
|
|
102
|
+
default:
|
|
103
|
+
command = [
|
|
104
|
+
'npm'
|
|
105
|
+
];
|
|
106
|
+
args = [
|
|
107
|
+
'install',
|
|
108
|
+
...dev ? [
|
|
109
|
+
'--save-dev'
|
|
110
|
+
] : [],
|
|
111
|
+
...packages
|
|
112
|
+
];
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (!silent) {
|
|
116
|
+
console.log(`Installing dependencies with ${packageManager}...`);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
// For bun, try to use full path if available
|
|
120
|
+
let executable = command[0];
|
|
121
|
+
if (packageManager === 'bun') {
|
|
122
|
+
const bunPaths = [
|
|
123
|
+
process.env.BUN_INSTALL ? `${process.env.BUN_INSTALL}/.bun/bin/bun` : null,
|
|
124
|
+
process.env.HOME ? `${process.env.HOME}/.bun/bin/bun` : null,
|
|
125
|
+
'/Users/buitronghieu/.bun/bin/bun'
|
|
126
|
+
].filter(Boolean);
|
|
127
|
+
for (const bunPath of bunPaths){
|
|
128
|
+
try {
|
|
129
|
+
await execa(bunPath, [
|
|
130
|
+
'--version'
|
|
131
|
+
], {
|
|
132
|
+
stdio: 'ignore'
|
|
133
|
+
});
|
|
134
|
+
executable = bunPath;
|
|
135
|
+
break;
|
|
136
|
+
} catch (e) {
|
|
137
|
+
// Try next path
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
await execa(executable, args, {
|
|
142
|
+
cwd,
|
|
143
|
+
stdio: silent ? 'ignore' : 'inherit'
|
|
144
|
+
});
|
|
145
|
+
if (!silent) {
|
|
146
|
+
console.log('✓ Dependencies installed successfully');
|
|
147
|
+
}
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error('Failed to install dependencies:', error);
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get the package manager executable name
|
|
155
|
+
*/ export function getPackageManagerExecutable(packageManager) {
|
|
156
|
+
return packageManager;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if a package manager is available
|
|
160
|
+
*/ export async function isPackageManagerAvailable(packageManager) {
|
|
161
|
+
try {
|
|
162
|
+
await execa(packageManager, [
|
|
163
|
+
'--version'
|
|
164
|
+
], {
|
|
165
|
+
stdio: 'ignore'
|
|
166
|
+
});
|
|
167
|
+
return true;
|
|
168
|
+
} catch (e) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
//# sourceMappingURL=package-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/package-manager.ts"],"sourcesContent":["import { execa } from 'execa';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\n\nexport type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';\n\n/**\n * Detect which package manager is being used in the project\n */\nexport function detectPackageManager(cwd: string = process.cwd()): PackageManager {\n // Check for lock files\n if (existsSync(join(cwd, 'bun.lockb')) || existsSync(join(cwd, 'bun.lock'))) {\n return 'bun';\n }\n if (existsSync(join(cwd, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n if (existsSync(join(cwd, 'yarn.lock'))) {\n return 'yarn';\n }\n if (existsSync(join(cwd, 'package-lock.json'))) {\n return 'npm';\n }\n\n // Default to npm\n return 'npm';\n}\n\n/**\n * Get the install command for the detected package manager\n */\nexport function getInstallCommand(packageManager: PackageManager, packages: string[]): string[] {\n switch (packageManager) {\n case 'bun':\n return ['bun', 'add', ...packages];\n case 'pnpm':\n return ['pnpm', 'add', ...packages];\n case 'yarn':\n return ['yarn', 'add', ...packages];\n case 'npm':\n default:\n return ['npm', 'install', ...packages];\n }\n}\n\n/**\n * Install dependencies using the detected package manager\n */\nexport async function installDependencies(\n packages: string[],\n options: {\n cwd?: string;\n dev?: boolean;\n silent?: boolean;\n } = {}\n): Promise<void> {\n const { cwd = process.cwd(), dev = false, silent = false } = options;\n\n if (packages.length === 0) {\n return;\n }\n\n const packageManager = detectPackageManager(cwd);\n let command: string[];\n let args: string[];\n\n switch (packageManager) {\n case 'bun':\n command = ['bun'];\n args = ['add', ...(dev ? ['-D'] : []), ...packages];\n break;\n case 'pnpm':\n command = ['pnpm'];\n args = ['add', ...(dev ? ['-D'] : []), ...packages];\n break;\n case 'yarn':\n command = ['yarn'];\n args = ['add', ...(dev ? ['-D'] : []), ...packages];\n break;\n case 'npm':\n default:\n command = ['npm'];\n args = ['install', ...(dev ? ['--save-dev'] : []), ...packages];\n break;\n }\n\n if (!silent) {\n console.log(`Installing dependencies with ${packageManager}...`);\n }\n\n try {\n // For bun, try to use full path if available\n let executable = command[0];\n if (packageManager === 'bun') {\n const bunPaths = [\n process.env.BUN_INSTALL ? `${process.env.BUN_INSTALL}/.bun/bin/bun` : null,\n process.env.HOME ? `${process.env.HOME}/.bun/bin/bun` : null,\n '/Users/buitronghieu/.bun/bin/bun',\n ].filter(Boolean) as string[];\n\n for (const bunPath of bunPaths) {\n try {\n await execa(bunPath, ['--version'], { stdio: 'ignore' });\n executable = bunPath;\n break;\n } catch {\n // Try next path\n }\n }\n }\n\n await execa(executable, args, {\n cwd,\n stdio: silent ? 'ignore' : 'inherit',\n });\n\n if (!silent) {\n console.log('✓ Dependencies installed successfully');\n }\n } catch (error) {\n console.error('Failed to install dependencies:', error);\n throw error;\n }\n}\n\n/**\n * Get the package manager executable name\n */\nexport function getPackageManagerExecutable(packageManager: PackageManager): string {\n return packageManager;\n}\n\n/**\n * Check if a package manager is available\n */\nexport async function isPackageManagerAvailable(packageManager: PackageManager): Promise<boolean> {\n try {\n await execa(packageManager, ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["execa","existsSync","join","detectPackageManager","cwd","process","getInstallCommand","packageManager","packages","installDependencies","options","dev","silent","length","command","args","console","log","executable","bunPaths","env","BUN_INSTALL","HOME","filter","Boolean","bunPath","stdio","error","getPackageManagerExecutable","isPackageManagerAvailable"],"mappings":"AAAA,SAASA,KAAK,QAAQ,QAAQ;AAC9B,SAASC,UAAU,QAAQ,KAAK;AAChC,SAASC,IAAI,QAAQ,OAAO;AAI5B;;CAEC,GACD,OAAO,SAASC,qBAAqBC,MAAcC,QAAQD,GAAG,EAAE;IAC9D,uBAAuB;IACvB,IAAIH,WAAWC,KAAKE,KAAK,iBAAiBH,WAAWC,KAAKE,KAAK,cAAc;QAC3E,OAAO;IACT;IACA,IAAIH,WAAWC,KAAKE,KAAK,oBAAoB;QAC3C,OAAO;IACT;IACA,IAAIH,WAAWC,KAAKE,KAAK,eAAe;QACtC,OAAO;IACT;IACA,IAAIH,WAAWC,KAAKE,KAAK,uBAAuB;QAC9C,OAAO;IACT;IAEA,iBAAiB;IACjB,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASE,kBAAkBC,cAA8B,EAAEC,QAAkB;IAClF,OAAQD;QACN,KAAK;YACH,OAAO;gBAAC;gBAAO;mBAAUC;aAAS;QACpC,KAAK;YACH,OAAO;gBAAC;gBAAQ;mBAAUA;aAAS;QACrC,KAAK;YACH,OAAO;gBAAC;gBAAQ;mBAAUA;aAAS;QACrC,KAAK;QACL;YACE,OAAO;gBAAC;gBAAO;mBAAcA;aAAS;IAC1C;AACF;AAEA;;CAEC,GACD,OAAO,eAAeC,oBACpBD,QAAkB,EAClBE,UAII,CAAC,CAAC;IAEN,MAAM,EAAEN,MAAMC,QAAQD,GAAG,EAAE,EAAEO,MAAM,KAAK,EAAEC,SAAS,KAAK,EAAE,GAAGF;IAE7D,IAAIF,SAASK,MAAM,KAAK,GAAG;QACzB;IACF;IAEA,MAAMN,iBAAiBJ,qBAAqBC;IAC5C,IAAIU;IACJ,IAAIC;IAEJ,OAAQR;QACN,KAAK;YACHO,UAAU;gBAAC;aAAM;YACjBC,OAAO;gBAAC;mBAAWJ,MAAM;oBAAC;iBAAK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