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,207 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { dirname, join, relative } from 'path';
|
|
3
|
+
import { getComponentSourceDir, isMobilePlatform } from './platform-detector';
|
|
4
|
+
import { getComponent, validateComponentDependencies } from './registry-loader';
|
|
5
|
+
import { fetchAndSaveFile, getComponentGitHubPath } from './github-fetcher';
|
|
6
|
+
/**
|
|
7
|
+
* Copy a component to target project
|
|
8
|
+
*
|
|
9
|
+
* @param componentName - Name of component to copy
|
|
10
|
+
* @param options - Copy options
|
|
11
|
+
* @returns Copy result
|
|
12
|
+
*/ export async function copyComponent(componentName, options) {
|
|
13
|
+
const result = {
|
|
14
|
+
componentName,
|
|
15
|
+
success: false,
|
|
16
|
+
filesCopied: [],
|
|
17
|
+
errors: [],
|
|
18
|
+
skipped: []
|
|
19
|
+
};
|
|
20
|
+
// Get component metadata
|
|
21
|
+
const component = getComponent(componentName, options.platform, options.registryDir);
|
|
22
|
+
if (!component) {
|
|
23
|
+
result.errors.push(`Component "${componentName}" not found in registry`);
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
// Validate dependencies
|
|
27
|
+
const validation = validateComponentDependencies(componentName, options.platform, options.registryDir);
|
|
28
|
+
if (!validation.valid) {
|
|
29
|
+
result.errors.push(`Missing dependencies: ${validation.missing.join(', ')}. Please add these components first.`);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
// Determine target directory based on platform
|
|
33
|
+
const componentsTargetDir = getComponentsTargetDir(options.platform, options.targetDir);
|
|
34
|
+
// Determine source mode: GitHub or local
|
|
35
|
+
const useGitHub = !options.packagesDir;
|
|
36
|
+
// Copy each file
|
|
37
|
+
for (const file of component.files){
|
|
38
|
+
const targetFile = join(componentsTargetDir, file);
|
|
39
|
+
// Check if target already exists
|
|
40
|
+
if (existsSync(targetFile) && !options.overwrite) {
|
|
41
|
+
result.skipped.push(relative(options.targetDir, targetFile));
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// Dry run - don't actually copy
|
|
45
|
+
if (options.dryRun) {
|
|
46
|
+
result.filesCopied.push(relative(options.targetDir, targetFile));
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// Create target directory if needed
|
|
50
|
+
const targetDir = dirname(targetFile);
|
|
51
|
+
if (!existsSync(targetDir)) {
|
|
52
|
+
mkdirSync(targetDir, {
|
|
53
|
+
recursive: true
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Copy file - from GitHub or local
|
|
57
|
+
try {
|
|
58
|
+
if (useGitHub) {
|
|
59
|
+
// Fetch from GitHub
|
|
60
|
+
const githubPath = getComponentGitHubPath(options.platform, componentName, file);
|
|
61
|
+
const success = await fetchAndSaveFile(githubPath, targetFile);
|
|
62
|
+
if (!success) {
|
|
63
|
+
result.errors.push(`Failed to fetch ${file} from GitHub`);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
// Copy from local packages directory (for development)
|
|
68
|
+
const packagesDir = options.packagesDir;
|
|
69
|
+
const componentSourceDir = getComponentSourceDir(options.platform);
|
|
70
|
+
const sourceDir = join(packagesDir, componentSourceDir);
|
|
71
|
+
const sourceFile = join(sourceDir, file);
|
|
72
|
+
if (!existsSync(sourceFile)) {
|
|
73
|
+
result.errors.push(`Source file not found: ${sourceFile}`);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
copyFileSync(sourceFile, targetFile);
|
|
77
|
+
}
|
|
78
|
+
result.filesCopied.push(relative(options.targetDir, targetFile));
|
|
79
|
+
} catch (error) {
|
|
80
|
+
result.errors.push(`Failed to copy ${file}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
result.success = result.errors.length === 0;
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Copy multiple components
|
|
88
|
+
*
|
|
89
|
+
* @param componentNames - Array of component names
|
|
90
|
+
* @param options - Copy options
|
|
91
|
+
* @returns Array of copy results
|
|
92
|
+
*/ export async function copyComponents(componentNames, options) {
|
|
93
|
+
const results = [];
|
|
94
|
+
for (const name of componentNames){
|
|
95
|
+
const result = await copyComponent(name, options);
|
|
96
|
+
results.push(result);
|
|
97
|
+
// If this component failed, log warning but continue
|
|
98
|
+
if (!result.success) {
|
|
99
|
+
console.warn(`⚠️ Failed to copy component "${name}"`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return results;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get components target directory based on platform
|
|
106
|
+
*
|
|
107
|
+
* @param platform - Target platform
|
|
108
|
+
* @param projectRoot - Project root directory
|
|
109
|
+
* @returns Target directory for components
|
|
110
|
+
*/ function getComponentsTargetDir(platform, projectRoot) {
|
|
111
|
+
switch(platform){
|
|
112
|
+
case 'react-native':
|
|
113
|
+
// React Native: src/components or components
|
|
114
|
+
if (existsSync(join(projectRoot, 'src'))) {
|
|
115
|
+
return join(projectRoot, 'src', 'components');
|
|
116
|
+
}
|
|
117
|
+
return join(projectRoot, 'components');
|
|
118
|
+
case 'flutter':
|
|
119
|
+
// Flutter: lib/components
|
|
120
|
+
return join(projectRoot, 'lib', 'components');
|
|
121
|
+
case 'vue':
|
|
122
|
+
// Vue: src/components
|
|
123
|
+
return join(projectRoot, 'src', 'components');
|
|
124
|
+
case 'react':
|
|
125
|
+
// React: src/components
|
|
126
|
+
return join(projectRoot, 'src', 'components');
|
|
127
|
+
case 'angular':
|
|
128
|
+
// Angular: src/components or components
|
|
129
|
+
if (existsSync(join(projectRoot, 'src', 'app'))) {
|
|
130
|
+
return join(projectRoot, 'src', 'app', 'components');
|
|
131
|
+
}
|
|
132
|
+
return join(projectRoot, 'components');
|
|
133
|
+
default:
|
|
134
|
+
// Default: components at root
|
|
135
|
+
return join(projectRoot, 'components');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Generate import statement for component
|
|
140
|
+
*
|
|
141
|
+
* @param componentName - Component name
|
|
142
|
+
* @param platform - Target platform
|
|
143
|
+
* @param options - Options
|
|
144
|
+
* @returns Import statement
|
|
145
|
+
*/ export function generateImportStatement(componentName, platform, options) {
|
|
146
|
+
const component = getComponent(componentName, platform, options == null ? void 0 : options.registryDir);
|
|
147
|
+
if (!component) {
|
|
148
|
+
return `// Component "${componentName}" not found`;
|
|
149
|
+
}
|
|
150
|
+
const exports = component.exports;
|
|
151
|
+
switch(platform){
|
|
152
|
+
case 'react-native':
|
|
153
|
+
case 'react':
|
|
154
|
+
// TypeScript/JSX import
|
|
155
|
+
return `import { ${exports.join(', ')} } from './components/${componentName}';`;
|
|
156
|
+
case 'flutter':
|
|
157
|
+
// Dart import
|
|
158
|
+
return `import 'package:your_app/components/${componentName}/${componentName.replace(/-/g, '_')}.dart';`;
|
|
159
|
+
case 'vue':
|
|
160
|
+
// Vue import
|
|
161
|
+
return `import { ${exports.join(', ')} } from '@/components/${componentName}';`;
|
|
162
|
+
case 'angular':
|
|
163
|
+
// Angular import
|
|
164
|
+
return `import { ${exports.join(', ')} } from './components/${componentName}';`;
|
|
165
|
+
default:
|
|
166
|
+
return `// Import for platform "${platform}" not supported`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Create components.json config file for project
|
|
171
|
+
*
|
|
172
|
+
* @param platform - Target platform
|
|
173
|
+
* @param projectRoot - Project root directory
|
|
174
|
+
* @param options - Additional config options
|
|
175
|
+
*/ export function createComponentsConfig(platform, projectRoot, options) {
|
|
176
|
+
const config = {
|
|
177
|
+
$schema: 'https://galaxy-design.vercel.app/schema.json',
|
|
178
|
+
platform: platform,
|
|
179
|
+
framework: (options == null ? void 0 : options.framework) || platform,
|
|
180
|
+
typescript: (options == null ? void 0 : options.typescript) !== false,
|
|
181
|
+
styling: (options == null ? void 0 : options.styling) || (isMobilePlatform(platform) ? 'styled-components' : 'tailwind'),
|
|
182
|
+
components: getComponentsTargetDir(platform, projectRoot),
|
|
183
|
+
utils: join(projectRoot, isMobilePlatform(platform) ? 'lib' : 'src', 'lib')
|
|
184
|
+
};
|
|
185
|
+
const configPath = join(projectRoot, 'components.json');
|
|
186
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Read components.json config
|
|
190
|
+
*
|
|
191
|
+
* @param projectRoot - Project root directory
|
|
192
|
+
* @returns Config object or null if not found
|
|
193
|
+
*/ export function readComponentsConfig(projectRoot) {
|
|
194
|
+
const configPath = join(projectRoot, 'components.json');
|
|
195
|
+
if (!existsSync(configPath)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
200
|
+
return JSON.parse(content);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.error('Failed to read components.json:', error);
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=component-copier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/component-copier.ts"],"sourcesContent":["import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport { dirname, join, relative } from 'path';\nimport type { Platform } from './platform-detector';\nimport { getComponentSourceDir, isMobilePlatform } from './platform-detector';\nimport { getComponent, validateComponentDependencies } from './registry-loader';\nimport {\n\tfetchAndSaveFile,\n\tgetComponentGitHubPath,\n\tcheckGitHubConnection,\n} from './github-fetcher';\n\n/**\n * Component copy options\n */\nexport interface ComponentCopyOptions {\n\t/** Target directory to copy components to */\n\ttargetDir: string;\n\t/** Platform to copy for */\n\tplatform: Platform;\n\t/** Overwrite existing files */\n\toverwrite?: boolean;\n\t/** Dry run (don't actually copy) */\n\tdryRun?: boolean;\n\t/** Registry directory (for testing) */\n\tregistryDir?: string;\n\t/** Source packages directory (for testing) */\n\tpackagesDir?: string;\n}\n\n/**\n * Copy result for a single component\n */\nexport interface ComponentCopyResult {\n\tcomponentName: string;\n\tsuccess: boolean;\n\tfilesCopied: string[];\n\terrors: string[];\n\tskipped: string[];\n}\n\n/**\n * Copy a component to target project\n *\n * @param componentName - Name of component to copy\n * @param options - Copy options\n * @returns Copy result\n */\nexport async function copyComponent(\n\tcomponentName: string,\n\toptions: ComponentCopyOptions,\n): Promise<ComponentCopyResult> {\n\tconst result: ComponentCopyResult = {\n\t\tcomponentName,\n\t\tsuccess: false,\n\t\tfilesCopied: [],\n\t\terrors: [],\n\t\tskipped: [],\n\t};\n\n\t// Get component metadata\n\tconst component = getComponent(componentName, options.platform, options.registryDir);\n\n\tif (!component) {\n\t\tresult.errors.push(`Component \"${componentName}\" not found in registry`);\n\t\treturn result;\n\t}\n\n\t// Validate dependencies\n\tconst validation = validateComponentDependencies(\n\t\tcomponentName,\n\t\toptions.platform,\n\t\toptions.registryDir,\n\t);\n\n\tif (!validation.valid) {\n\t\tresult.errors.push(\n\t\t\t`Missing dependencies: ${validation.missing.join(', ')}. Please add these components first.`,\n\t\t);\n\t\treturn result;\n\t}\n\n\t// Determine target directory based on platform\n\tconst componentsTargetDir = getComponentsTargetDir(options.platform, options.targetDir);\n\n\t// Determine source mode: GitHub or local\n\tconst useGitHub = !options.packagesDir;\n\n\t// Copy each file\n\tfor (const file of component.files) {\n\t\tconst targetFile = join(componentsTargetDir, file);\n\n\t\t// Check if target already exists\n\t\tif (existsSync(targetFile) && !options.overwrite) {\n\t\t\tresult.skipped.push(relative(options.targetDir, targetFile));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Dry run - don't actually copy\n\t\tif (options.dryRun) {\n\t\t\tresult.filesCopied.push(relative(options.targetDir, targetFile));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Create target directory if needed\n\t\tconst targetDir = dirname(targetFile);\n\t\tif (!existsSync(targetDir)) {\n\t\t\tmkdirSync(targetDir, { recursive: true });\n\t\t}\n\n\t\t// Copy file - from GitHub or local\n\t\ttry {\n\t\t\tif (useGitHub) {\n\t\t\t\t// Fetch from GitHub\n\t\t\t\tconst githubPath = getComponentGitHubPath(options.platform, componentName, file);\n\t\t\t\tconst success = await fetchAndSaveFile(githubPath, targetFile);\n\n\t\t\t\tif (!success) {\n\t\t\t\t\tresult.errors.push(`Failed to fetch ${file} from GitHub`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Copy from local packages directory (for development)\n\t\t\t\tconst packagesDir = options.packagesDir!;\n\t\t\t\tconst componentSourceDir = getComponentSourceDir(options.platform);\n\t\t\t\tconst sourceDir = join(packagesDir, componentSourceDir);\n\t\t\t\tconst sourceFile = join(sourceDir, file);\n\n\t\t\t\tif (!existsSync(sourceFile)) {\n\t\t\t\t\tresult.errors.push(`Source file not found: ${sourceFile}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcopyFileSync(sourceFile, targetFile);\n\t\t\t}\n\n\t\t\tresult.filesCopied.push(relative(options.targetDir, targetFile));\n\t\t} catch (error) {\n\t\t\tresult.errors.push(\n\t\t\t\t`Failed to copy ${file}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tresult.success = result.errors.length === 0;\n\treturn result;\n}\n\n/**\n * Copy multiple components\n *\n * @param componentNames - Array of component names\n * @param options - Copy options\n * @returns Array of copy results\n */\nexport async function copyComponents(\n\tcomponentNames: string[],\n\toptions: ComponentCopyOptions,\n): Promise<ComponentCopyResult[]> {\n\tconst results: ComponentCopyResult[] = [];\n\n\tfor (const name of componentNames) {\n\t\tconst result = await copyComponent(name, options);\n\t\tresults.push(result);\n\n\t\t// If this component failed, log warning but continue\n\t\tif (!result.success) {\n\t\t\tconsole.warn(`⚠️ Failed to copy component \"${name}\"`);\n\t\t}\n\t}\n\n\treturn results;\n}\n\n/**\n * Get components target directory based on platform\n *\n * @param platform - Target platform\n * @param projectRoot - Project root directory\n * @returns Target directory for components\n */\nfunction getComponentsTargetDir(platform: Platform, projectRoot: string): string {\n\tswitch (platform) {\n\t\tcase 'react-native':\n\t\t\t// React Native: src/components or components\n\t\t\tif (existsSync(join(projectRoot, 'src'))) {\n\t\t\t\treturn join(projectRoot, 'src', 'components');\n\t\t\t}\n\t\t\treturn join(projectRoot, 'components');\n\n\t\tcase 'flutter':\n\t\t\t// Flutter: lib/components\n\t\t\treturn join(projectRoot, 'lib', 'components');\n\n\t\tcase 'vue':\n\t\t\t// Vue: src/components\n\t\t\treturn join(projectRoot, 'src', 'components');\n\n\t\tcase 'react':\n\t\t\t// React: src/components\n\t\t\treturn join(projectRoot, 'src', 'components');\n\n\t\tcase 'angular':\n\t\t\t// Angular: src/components or components\n\t\t\tif (existsSync(join(projectRoot, 'src', 'app'))) {\n\t\t\t\treturn join(projectRoot, 'src', 'app', 'components');\n\t\t\t}\n\t\t\treturn join(projectRoot, 'components');\n\n\t\tdefault:\n\t\t\t// Default: components at root\n\t\t\treturn join(projectRoot, 'components');\n\t}\n}\n\n/**\n * Generate import statement for component\n *\n * @param componentName - Component name\n * @param platform - Target platform\n * @param options - Options\n * @returns Import statement\n */\nexport function generateImportStatement(\n\tcomponentName: string,\n\tplatform: Platform,\n\toptions?: { registryDir?: string },\n): string {\n\tconst component = getComponent(componentName, platform, options?.registryDir);\n\n\tif (!component) {\n\t\treturn `// Component \"${componentName}\" not found`;\n\t}\n\n\tconst exports = component.exports;\n\n\tswitch (platform) {\n\t\tcase 'react-native':\n\t\tcase 'react':\n\t\t\t// TypeScript/JSX import\n\t\t\treturn `import { ${exports.join(', ')} } from './components/${componentName}';`;\n\n\t\tcase 'flutter':\n\t\t\t// Dart import\n\t\t\treturn `import 'package:your_app/components/${componentName}/${componentName.replace(/-/g, '_')}.dart';`;\n\n\t\tcase 'vue':\n\t\t\t// Vue import\n\t\t\treturn `import { ${exports.join(', ')} } from '@/components/${componentName}';`;\n\n\t\tcase 'angular':\n\t\t\t// Angular import\n\t\t\treturn `import { ${exports.join(', ')} } from './components/${componentName}';`;\n\n\t\tdefault:\n\t\t\treturn `// Import for platform \"${platform}\" not supported`;\n\t}\n}\n\n/**\n * Create components.json config file for project\n *\n * @param platform - Target platform\n * @param projectRoot - Project root directory\n * @param options - Additional config options\n */\nexport function createComponentsConfig(\n\tplatform: Platform,\n\tprojectRoot: string,\n\toptions?: {\n\t\tframework?: string;\n\t\ttypescript?: boolean;\n\t\tstyling?: 'tailwind' | 'css' | 'styled-components';\n\t},\n): void {\n\tconst config = {\n\t\t$schema: 'https://galaxy-design.vercel.app/schema.json',\n\t\tplatform: platform,\n\t\tframework: options?.framework || platform,\n\t\ttypescript: options?.typescript !== false,\n\t\tstyling: options?.styling || (isMobilePlatform(platform) ? 'styled-components' : 'tailwind'),\n\t\tcomponents: getComponentsTargetDir(platform, projectRoot),\n\t\tutils: join(projectRoot, isMobilePlatform(platform) ? 'lib' : 'src', 'lib'),\n\t};\n\n\tconst configPath = join(projectRoot, 'components.json');\n\twriteFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');\n}\n\n/**\n * Read components.json config\n *\n * @param projectRoot - Project root directory\n * @returns Config object or null if not found\n */\nexport function readComponentsConfig(projectRoot: string): any | null {\n\tconst configPath = join(projectRoot, 'components.json');\n\n\tif (!existsSync(configPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst content = readFileSync(configPath, 'utf-8');\n\t\treturn JSON.parse(content);\n\t} catch (error) {\n\t\tconsole.error('Failed to read components.json:', error);\n\t\treturn null;\n\t}\n}\n"],"names":["copyFileSync","existsSync","mkdirSync","readFileSync","writeFileSync","dirname","join","relative","getComponentSourceDir","isMobilePlatform","getComponent","validateComponentDependencies","fetchAndSaveFile","getComponentGitHubPath","copyComponent","componentName","options","result","success","filesCopied","errors","skipped","component","platform","registryDir","push","validation","valid","missing","componentsTargetDir","getComponentsTargetDir","targetDir","useGitHub","packagesDir","file","files","targetFile","overwrite","dryRun","recursive","githubPath","componentSourceDir","sourceDir","sourceFile","error","Error","message","length","copyComponents","componentNames","results","name","console","warn","projectRoot","generateImportStatement","exports","replace","createComponentsConfig","config","$schema","framework","typescript","styling","components","utils","configPath","JSON","stringify","readComponentsConfig","content","parse"],"mappings":"AAAA,SAASA,YAAY,EAAEC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,aAAa,QAAQ,KAAK;AACtF,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAE/C,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,sBAAsB;AAC9E,SAASC,YAAY,EAAEC,6BAA6B,QAAQ,oBAAoB;AAChF,SACCC,gBAAgB,EAChBC,sBAAsB,QAEhB,mBAAmB;AA+B1B;;;;;;CAMC,GACD,OAAO,eAAeC,cACrBC,aAAqB,EACrBC,OAA6B;IAE7B,MAAMC,SAA8B;QACnCF;QACAG,SAAS;QACTC,aAAa,EAAE;QACfC,QAAQ,EAAE;QACVC,SAAS,EAAE;IACZ;IAEA,yBAAyB;IACzB,MAAMC,YAAYZ,aAAaK,eAAeC,QAAQO,QAAQ,EAAEP,QAAQQ,WAAW;IAEnF,IAAI,CAACF,WAAW;QACfL,OAAOG,MAAM,CAACK,IAAI,CAAC,CAAC,WAAW,EAAEV,cAAc,uBAAuB,CAAC;QACvE,OAAOE;IACR;IAEA,wBAAwB;IACxB,MAAMS,aAAaf,8BAClBI,eACAC,QAAQO,QAAQ,EAChBP,QAAQQ,WAAW;IAGpB,IAAI,CAACE,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2BAAAA,QAAS6C,SAAS,KAAItC;QACjCuC,YAAY9C,CAAAA,2BAAAA,QAAS8C,UAAU,MAAK;QACpCC,SAAS/C,CAAAA,2BAAAA,QAAS+C,OAAO,KAAKtD,CAAAA,iBAAiBc,YAAY,sBAAsB,UAAS;QAC1FyC,YAAYlC,uBAAuBP,UAAU+B;QAC7CW,OAAO3D,KAAKgD,aAAa7C,iBAAiBc,YAAY,QAAQ,OAAO;IACtE;IAEA,MAAM2C,aAAa5D,KAAKgD,aAAa;IACrClD,cAAc8D,YAAYC,KAAKC,SAAS,CAACT,QAAQ,MAAM,IAAI;AAC5D;AAEA;;;;;CAKC,GACD,OAAO,SAASU,qBAAqBf,WAAmB;IACvD,MAAMY,aAAa5D,KAAKgD,aAAa;IAErC,IAAI,CAACrD,WAAWiE,aAAa;QAC5B,OAAO;IACR;IAEA,IAAI;QACH,MAAMI,UAAUnE,aAAa+D,YAAY;QACzC,OAAOC,KAAKI,KAAK,CAACD;IACnB,EAAE,OAAO1B,OAAO;QACfQ,QAAQR,KAAK,CAAC,mCAAmCA;QACjD,OAAO;IACR;AACD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { validateConfig, getDefaultConfig as getSchemaDefaultConfig } from './config-schema.js';
|
|
5
|
+
/**
|
|
6
|
+
* Load components.json config
|
|
7
|
+
*/ export function loadComponentsConfig(cwd) {
|
|
8
|
+
const configPath = resolve(cwd, 'components.json');
|
|
9
|
+
if (!existsSync(configPath)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
14
|
+
return validateConfig(config);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error('Error loading components.json:', error);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Save components.json config
|
|
22
|
+
*/ export function saveComponentsConfig(cwd, config) {
|
|
23
|
+
const configPath = resolve(cwd, 'components.json');
|
|
24
|
+
const content = JSON.stringify(config, null, 2);
|
|
25
|
+
writeFileSync(configPath, content, 'utf-8');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if components.json exists
|
|
29
|
+
*/ export function hasComponentsConfig(cwd) {
|
|
30
|
+
return existsSync(resolve(cwd, 'components.json'));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create default components.json for a framework
|
|
34
|
+
*/ export function createComponentsConfig(cwd, framework) {
|
|
35
|
+
const config = getSchemaDefaultConfig(framework);
|
|
36
|
+
saveComponentsConfig(cwd, config);
|
|
37
|
+
return config;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get framework from components.json
|
|
41
|
+
*/ export function getFrameworkFromConfig(cwd) {
|
|
42
|
+
const config = loadComponentsConfig(cwd);
|
|
43
|
+
var _config_framework;
|
|
44
|
+
return (_config_framework = config == null ? void 0 : config.framework) != null ? _config_framework : null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Update components.json with partial config
|
|
48
|
+
*/ export function updateComponentsConfig(cwd, updates) {
|
|
49
|
+
const existing = loadComponentsConfig(cwd);
|
|
50
|
+
if (!existing) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const updated = _extends({}, existing, updates);
|
|
54
|
+
saveComponentsConfig(cwd, updated);
|
|
55
|
+
return updated;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=components-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/components-config.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\nimport {\n ComponentsConfig,\n validateConfig,\n getDefaultConfig as getSchemaDefaultConfig,\n type Framework,\n} from './config-schema.js';\n\n/**\n * Load components.json config\n */\nexport function loadComponentsConfig(cwd: string): ComponentsConfig | null {\n const configPath = resolve(cwd, 'components.json');\n\n if (!existsSync(configPath)) {\n return null;\n }\n\n try {\n const config = JSON.parse(readFileSync(configPath, 'utf-8'));\n return validateConfig(config);\n } catch (error) {\n console.error('Error loading components.json:', error);\n return null;\n }\n}\n\n/**\n * Save components.json config\n */\nexport function saveComponentsConfig(cwd: string, config: ComponentsConfig): void {\n const configPath = resolve(cwd, 'components.json');\n const content = JSON.stringify(config, null, 2);\n writeFileSync(configPath, content, 'utf-8');\n}\n\n/**\n * Check if components.json exists\n */\nexport function hasComponentsConfig(cwd: string): boolean {\n return existsSync(resolve(cwd, 'components.json'));\n}\n\n/**\n * Create default components.json for a framework\n */\nexport function createComponentsConfig(cwd: string, framework: Framework): ComponentsConfig {\n const config = getSchemaDefaultConfig(framework);\n saveComponentsConfig(cwd, config);\n return config;\n}\n\n/**\n * Get framework from components.json\n */\nexport function getFrameworkFromConfig(cwd: string): Framework | null {\n const config = loadComponentsConfig(cwd);\n return config?.framework ?? null;\n}\n\n/**\n * Update components.json with partial config\n */\nexport function updateComponentsConfig(\n cwd: string,\n updates: Partial<ComponentsConfig>\n): ComponentsConfig | null {\n const existing = loadComponentsConfig(cwd);\n if (!existing) {\n return null;\n }\n\n const updated = { ...existing, ...updates };\n saveComponentsConfig(cwd, updated);\n return updated;\n}\n"],"names":["existsSync","readFileSync","writeFileSync","resolve","validateConfig","getDefaultConfig","getSchemaDefaultConfig","loadComponentsConfig","cwd","configPath","config","JSON","parse","error","console","saveComponentsConfig","content","stringify","hasComponentsConfig","createComponentsConfig","framework","getFrameworkFromConfig","updateComponentsConfig","updates","existing","updated"],"mappings":";AAAA,SAASA,UAAU,EAAEC,YAAY,EAAEC,aAAa,QAAQ,KAAK;AAC7D,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAEEC,cAAc,EACdC,oBAAoBC,sBAAsB,QAErC,qBAAqB;AAE5B;;CAEC,GACD,OAAO,SAASC,qBAAqBC,GAAW;IAC9C,MAAMC,aAAaN,QAAQK,KAAK;IAEhC,IAAI,CAACR,WAAWS,aAAa;QAC3B,OAAO;IACT;IAEA,IAAI;QACF,MAAMC,SAASC,KAAKC,KAAK,CAACX,aAAaQ,YAAY;QACnD,OAAOL,eAAeM;IACxB,EAAE,OAAOG,OAAO;QACdC,QAAQD,KAAK,CAAC,kCAAkCA;QAChD,OAAO;IACT;AACF;AAEA;;CAEC,GACD,OAAO,SAASE,qBAAqBP,GAAW,EAAEE,MAAwB;IACxE,MAAMD,aAAaN,QAAQK,KAAK;IAChC,MAAMQ,UAAUL,KAAKM,SAAS,CAACP,QAAQ,MAAM;IAC7CR,cAAcO,YAAYO,SAAS;AACrC;AAEA;;CAEC,GACD,OAAO,SAASE,oBAAoBV,GAAW;IAC7C,OAAOR,WAAWG,QAAQK,KAAK;AACjC;AAEA;;CAEC,GACD,OAAO,SAASW,uBAAuBX,GAAW,EAAEY,SAAoB;IACtE,MAAMV,SAASJ,uBAAuBc;IACtCL,qBAAqBP,KAAKE;IAC1B,OAAOA;AACT;AAEA;;CAEC,GACD,OAAO,SAASW,uBAAuBb,GAAW;IAChD,MAAME,SAASH,qBAAqBC;QAC7BE;IAAP,OAAOA,CAAAA,oBAAAA,0BAAAA,OAAQU,SAAS,YAAjBV,oBAAqB;AAC9B;AAEA;;CAEC,GACD,OAAO,SAASY,uBACdd,GAAW,EACXe,OAAkC;IAElC,MAAMC,WAAWjB,qBAAqBC;IACtC,IAAI,CAACgB,UAAU;QACb,OAAO;IACT;IAEA,MAAMC,UAAU,aAAKD,UAAaD;IAClCR,qBAAqBP,KAAKiB;IAC1B,OAAOA;AACT"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Framework types
|
|
4
|
+
export const frameworkSchema = z.enum([
|
|
5
|
+
'vue',
|
|
6
|
+
'react',
|
|
7
|
+
'angular',
|
|
8
|
+
'react-native',
|
|
9
|
+
'flutter'
|
|
10
|
+
]);
|
|
11
|
+
// Base color types
|
|
12
|
+
export const baseColorSchema = z.enum([
|
|
13
|
+
'slate',
|
|
14
|
+
'gray',
|
|
15
|
+
'zinc',
|
|
16
|
+
'neutral',
|
|
17
|
+
'stone'
|
|
18
|
+
]);
|
|
19
|
+
// Icon library types
|
|
20
|
+
export const iconLibrarySchema = z.enum([
|
|
21
|
+
'lucide',
|
|
22
|
+
'heroicons',
|
|
23
|
+
'radix-icons'
|
|
24
|
+
]);
|
|
25
|
+
// Tailwind configuration
|
|
26
|
+
export const tailwindConfigSchema = z.object({
|
|
27
|
+
config: z.string().default('tailwind.config.js'),
|
|
28
|
+
css: z.string(),
|
|
29
|
+
baseColor: baseColorSchema.default('slate'),
|
|
30
|
+
cssVariables: z.boolean().default(true),
|
|
31
|
+
prefix: z.string().optional().default('')
|
|
32
|
+
});
|
|
33
|
+
// Aliases configuration
|
|
34
|
+
export const aliasesSchema = z.object({
|
|
35
|
+
components: z.string(),
|
|
36
|
+
utils: z.string(),
|
|
37
|
+
ui: z.string().optional(),
|
|
38
|
+
lib: z.string().optional()
|
|
39
|
+
});
|
|
40
|
+
// Main components.json schema
|
|
41
|
+
export const componentsConfigSchema = z.object({
|
|
42
|
+
$schema: z.string().optional(),
|
|
43
|
+
framework: frameworkSchema,
|
|
44
|
+
typescript: z.boolean().default(true),
|
|
45
|
+
tailwind: tailwindConfigSchema,
|
|
46
|
+
aliases: aliasesSchema,
|
|
47
|
+
iconLibrary: iconLibrarySchema.default('lucide')
|
|
48
|
+
});
|
|
49
|
+
// Default configurations per framework
|
|
50
|
+
export const defaultConfigs = {
|
|
51
|
+
vue: {
|
|
52
|
+
framework: 'vue',
|
|
53
|
+
typescript: true,
|
|
54
|
+
tailwind: {
|
|
55
|
+
config: 'tailwind.config.js',
|
|
56
|
+
css: 'src/assets/styles/global.css',
|
|
57
|
+
baseColor: 'slate',
|
|
58
|
+
cssVariables: true,
|
|
59
|
+
prefix: ''
|
|
60
|
+
},
|
|
61
|
+
aliases: {
|
|
62
|
+
components: '@/components',
|
|
63
|
+
utils: '@/lib/utils',
|
|
64
|
+
ui: '@/components/ui',
|
|
65
|
+
lib: '@/lib'
|
|
66
|
+
},
|
|
67
|
+
iconLibrary: 'lucide'
|
|
68
|
+
},
|
|
69
|
+
react: {
|
|
70
|
+
framework: 'react',
|
|
71
|
+
typescript: true,
|
|
72
|
+
tailwind: {
|
|
73
|
+
config: 'tailwind.config.js',
|
|
74
|
+
css: 'src/app/globals.css',
|
|
75
|
+
baseColor: 'slate',
|
|
76
|
+
cssVariables: true,
|
|
77
|
+
prefix: ''
|
|
78
|
+
},
|
|
79
|
+
aliases: {
|
|
80
|
+
components: '@/components',
|
|
81
|
+
utils: '@/lib/utils',
|
|
82
|
+
ui: '@/components/ui',
|
|
83
|
+
lib: '@/lib'
|
|
84
|
+
},
|
|
85
|
+
iconLibrary: 'lucide'
|
|
86
|
+
},
|
|
87
|
+
angular: {
|
|
88
|
+
framework: 'angular',
|
|
89
|
+
typescript: true,
|
|
90
|
+
tailwind: {
|
|
91
|
+
config: 'tailwind.config.js',
|
|
92
|
+
css: 'src/styles.css',
|
|
93
|
+
baseColor: 'slate',
|
|
94
|
+
cssVariables: true,
|
|
95
|
+
prefix: ''
|
|
96
|
+
},
|
|
97
|
+
aliases: {
|
|
98
|
+
components: '@/components',
|
|
99
|
+
utils: '@/lib/utils',
|
|
100
|
+
ui: '@/components/ui',
|
|
101
|
+
lib: '@/lib'
|
|
102
|
+
},
|
|
103
|
+
iconLibrary: 'lucide'
|
|
104
|
+
},
|
|
105
|
+
'react-native': {
|
|
106
|
+
framework: 'react-native',
|
|
107
|
+
typescript: true,
|
|
108
|
+
tailwind: {
|
|
109
|
+
config: 'tailwind.config.js',
|
|
110
|
+
css: 'global.css',
|
|
111
|
+
baseColor: 'slate',
|
|
112
|
+
cssVariables: true,
|
|
113
|
+
prefix: ''
|
|
114
|
+
},
|
|
115
|
+
aliases: {
|
|
116
|
+
components: '@/components',
|
|
117
|
+
utils: '@/lib/utils',
|
|
118
|
+
ui: '@/components/ui',
|
|
119
|
+
lib: '@/lib'
|
|
120
|
+
},
|
|
121
|
+
iconLibrary: 'lucide'
|
|
122
|
+
},
|
|
123
|
+
flutter: {
|
|
124
|
+
framework: 'flutter',
|
|
125
|
+
typescript: false,
|
|
126
|
+
tailwind: {
|
|
127
|
+
config: '',
|
|
128
|
+
css: '',
|
|
129
|
+
baseColor: 'slate',
|
|
130
|
+
cssVariables: false,
|
|
131
|
+
prefix: ''
|
|
132
|
+
},
|
|
133
|
+
aliases: {
|
|
134
|
+
components: 'lib/components',
|
|
135
|
+
utils: 'lib/utils',
|
|
136
|
+
ui: 'lib/components/ui',
|
|
137
|
+
lib: 'lib'
|
|
138
|
+
},
|
|
139
|
+
iconLibrary: 'lucide'
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Get default config for a framework
|
|
144
|
+
*/ export function getDefaultConfig(framework) {
|
|
145
|
+
const defaults = defaultConfigs[framework];
|
|
146
|
+
return _extends({
|
|
147
|
+
$schema: 'https://galaxy-design.vercel.app/schema.json'
|
|
148
|
+
}, defaults);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Validate components.json config
|
|
152
|
+
*/ export function validateConfig(config) {
|
|
153
|
+
try {
|
|
154
|
+
return componentsConfigSchema.parse(config);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (error instanceof z.ZodError) {
|
|
157
|
+
throw new Error(`Invalid components.json configuration:\n${error.issues.map((e)=>` - ${e.path.join('.')}: ${e.message}`).join('\n')}`);
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get framework-specific file extensions
|
|
164
|
+
*/ export function getFileExtensions(framework, typescript) {
|
|
165
|
+
const ext = typescript ? 'ts' : 'js';
|
|
166
|
+
switch(framework){
|
|
167
|
+
case 'vue':
|
|
168
|
+
return [
|
|
169
|
+
'.vue',
|
|
170
|
+
`.${ext}`
|
|
171
|
+
];
|
|
172
|
+
case 'react':
|
|
173
|
+
return [
|
|
174
|
+
`.tsx`,
|
|
175
|
+
`.jsx`,
|
|
176
|
+
`.${ext}`
|
|
177
|
+
];
|
|
178
|
+
case 'react-native':
|
|
179
|
+
return [
|
|
180
|
+
`.tsx`,
|
|
181
|
+
`.jsx`,
|
|
182
|
+
`.native.${ext}`,
|
|
183
|
+
`.${ext}`
|
|
184
|
+
];
|
|
185
|
+
case 'angular':
|
|
186
|
+
return [
|
|
187
|
+
`.component.ts`,
|
|
188
|
+
`.service.ts`,
|
|
189
|
+
`.directive.ts`,
|
|
190
|
+
`.${ext}`
|
|
191
|
+
];
|
|
192
|
+
case 'flutter':
|
|
193
|
+
return [
|
|
194
|
+
'.dart'
|
|
195
|
+
];
|
|
196
|
+
default:
|
|
197
|
+
return [
|
|
198
|
+
`.${ext}`
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get framework-specific component path patterns
|
|
204
|
+
*/ export function getComponentPath(framework) {
|
|
205
|
+
switch(framework){
|
|
206
|
+
case 'vue':
|
|
207
|
+
return 'src/components';
|
|
208
|
+
case 'react':
|
|
209
|
+
return 'src/components';
|
|
210
|
+
case 'react-native':
|
|
211
|
+
return 'src/components';
|
|
212
|
+
case 'angular':
|
|
213
|
+
return 'src/app/components';
|
|
214
|
+
case 'flutter':
|
|
215
|
+
return 'lib/components';
|
|
216
|
+
default:
|
|
217
|
+
return 'src/components';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/config-schema.ts"],"sourcesContent":["import { z } from 'zod';\n\n// Framework types\nexport const frameworkSchema = z.enum(['vue', 'react', 'angular', 'react-native', 'flutter']);\nexport type Framework = z.infer<typeof frameworkSchema>;\n\n// Base color types\nexport const baseColorSchema = z.enum(['slate', 'gray', 'zinc', 'neutral', 'stone']);\nexport type BaseColor = z.infer<typeof baseColorSchema>;\n\n// Icon library types\nexport const iconLibrarySchema = z.enum(['lucide', 'heroicons', 'radix-icons']);\nexport type IconLibrary = z.infer<typeof iconLibrarySchema>;\n\n// Tailwind configuration\nexport const tailwindConfigSchema = z.object({\n config: z.string().default('tailwind.config.js'),\n css: z.string(),\n baseColor: baseColorSchema.default('slate'),\n cssVariables: z.boolean().default(true),\n prefix: z.string().optional().default(''),\n});\nexport type TailwindConfig = z.infer<typeof tailwindConfigSchema>;\n\n// Aliases configuration\nexport const aliasesSchema = z.object({\n components: z.string(),\n utils: z.string(),\n ui: z.string().optional(),\n lib: z.string().optional(),\n});\nexport type Aliases = z.infer<typeof aliasesSchema>;\n\n// Main components.json schema\nexport const componentsConfigSchema = z.object({\n $schema: z.string().optional(),\n framework: frameworkSchema,\n typescript: z.boolean().default(true),\n tailwind: tailwindConfigSchema,\n aliases: aliasesSchema,\n iconLibrary: iconLibrarySchema.default('lucide'),\n});\nexport type ComponentsConfig = z.infer<typeof componentsConfigSchema>;\n\n// Default configurations per framework\nexport const defaultConfigs: Record<Framework, Partial<ComponentsConfig>> = {\n vue: {\n framework: 'vue',\n typescript: true,\n tailwind: {\n config: 'tailwind.config.js',\n css: 'src/assets/styles/global.css',\n baseColor: 'slate',\n cssVariables: true,\n prefix: '',\n },\n aliases: {\n components: '@/components',\n utils: '@/lib/utils',\n ui: '@/components/ui',\n lib: '@/lib',\n },\n iconLibrary: 'lucide',\n },\n react: {\n framework: 'react',\n typescript: true,\n tailwind: {\n config: 'tailwind.config.js',\n css: 'src/app/globals.css',\n baseColor: 'slate',\n cssVariables: true,\n prefix: '',\n },\n aliases: {\n components: '@/components',\n utils: '@/lib/utils',\n ui: '@/components/ui',\n lib: '@/lib',\n },\n iconLibrary: 'lucide',\n },\n angular: {\n framework: 'angular',\n typescript: true,\n tailwind: {\n config: 'tailwind.config.js',\n css: 'src/styles.css',\n baseColor: 'slate',\n cssVariables: true,\n prefix: '',\n },\n aliases: {\n components: '@/components',\n utils: '@/lib/utils',\n ui: '@/components/ui',\n lib: '@/lib',\n },\n iconLibrary: 'lucide',\n },\n 'react-native': {\n framework: 'react-native',\n typescript: true,\n tailwind: {\n config: 'tailwind.config.js',\n css: 'global.css',\n baseColor: 'slate',\n cssVariables: true,\n prefix: '',\n },\n aliases: {\n components: '@/components',\n utils: '@/lib/utils',\n ui: '@/components/ui',\n lib: '@/lib',\n },\n iconLibrary: 'lucide',\n },\n flutter: {\n framework: 'flutter',\n typescript: false, // Flutter uses Dart\n tailwind: {\n config: '', // Flutter doesn't use Tailwind\n css: '',\n baseColor: 'slate',\n cssVariables: false,\n prefix: '',\n },\n aliases: {\n components: 'lib/components',\n utils: 'lib/utils',\n ui: 'lib/components/ui',\n lib: 'lib',\n },\n iconLibrary: 'lucide',\n },\n};\n\n/**\n * Get default config for a framework\n */\nexport function getDefaultConfig(framework: Framework): ComponentsConfig {\n const defaults = defaultConfigs[framework];\n return {\n $schema: 'https://galaxy-design.vercel.app/schema.json',\n ...defaults,\n } as ComponentsConfig;\n}\n\n/**\n * Validate components.json config\n */\nexport function validateConfig(config: unknown): ComponentsConfig {\n try {\n return componentsConfigSchema.parse(config);\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw new Error(\n `Invalid components.json configuration:\\n${error.issues\n .map((e: z.ZodIssue) => ` - ${e.path.join('.')}: ${e.message}`)\n .join('\\n')}`\n );\n }\n throw error;\n }\n}\n\n/**\n * Get framework-specific file extensions\n */\nexport function getFileExtensions(framework: Framework, typescript: boolean): string[] {\n const ext = typescript ? 'ts' : 'js';\n\n switch (framework) {\n case 'vue':\n return ['.vue', `.${ext}`];\n case 'react':\n return [`.tsx`, `.jsx`, `.${ext}`];\n case 'react-native':\n return [`.tsx`, `.jsx`, `.native.${ext}`, `.${ext}`];\n case 'angular':\n return [`.component.ts`, `.service.ts`, `.directive.ts`, `.${ext}`];\n case 'flutter':\n return ['.dart'];\n default:\n return [`.${ext}`];\n }\n}\n\n/**\n * Get framework-specific component path patterns\n */\nexport function getComponentPath(framework: Framework): string {\n switch (framework) {\n case 'vue':\n return 'src/components';\n case 'react':\n return 'src/components';\n case 'react-native':\n return 'src/components';\n case 'angular':\n return 'src/app/components';\n case 'flutter':\n return 'lib/components';\n default:\n return 'src/components';\n }\n}\n"],"names":["z","frameworkSchema","enum","baseColorSchema","iconLibrarySchema","tailwindConfigSchema","object","config","string","default","css","baseColor","cssVariables","boolean","prefix","optional","aliasesSchema","components","utils","ui","lib","componentsConfigSchema","$schema","framework","typescript","tailwind","aliases","iconLibrary","defaultConfigs","vue","react","angular","flutter","getDefaultConfig","defaults","validateConfig","parse","error","ZodError","Error","issues","map","e","path","join","message","getFileExtensions","ext","getComponentPath"],"mappings":";AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,kBAAkB;AAClB,OAAO,MAAMC,kBAAkBD,EAAEE,IAAI,CAAC;IAAC;IAAO;IAAS;IAAW;IAAgB;CAAU,EAAE;AAG9F,mBAAmB;AACnB,OAAO,MAAMC,kBAAkBH,EAAEE,IAAI,CAAC;IAAC;IAAS;IAAQ;IAAQ;IAAW;CAAQ,EAAE;AAGrF,qBAAqB;AACrB,OAAO,MAAME,oBAAoBJ,EAAEE,IAAI,CAAC;IAAC;IAAU;IAAa;CAAc,EAAE;AAGhF,yBAAyB;AACzB,OAAO,MAAMG,uBAAuBL,EAAEM,MAAM,CAAC;IAC3CC,QAAQP,EAAEQ,MAAM,GAAGC,OAAO,CAAC;IAC3BC,KAAKV,EAAEQ,MAAM;IACbG,WAAWR,gBAAgBM,OAAO,CAAC;IACnCG,cAAcZ,EAAEa,OAAO,GAAGJ,OAAO,CAAC;IAClCK,QAAQd,EAAEQ,MAAM,GAAGO,QAAQ,GAAGN,OAAO,CAAC;AACxC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gBAAE,CAAC,CAAC,EAAEA,KAAK;aAAC;QACtD,KAAK;YACH,OAAO;gBAAC,CAAC,aAAa,CAAC;gBAAE,CAAC,WAAW,CAAC;gBAAE,CAAC,aAAa,CAAC;gBAAE,CAAC,CAAC,EAAEA,KAAK;aAAC;QACrE,KAAK;YACH,OAAO;gBAAC;aAAQ;QAClB;YACE,OAAO;gBAAC,CAAC,CAAC,EAAEA,KAAK;aAAC;IACtB;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,iBAAiBzB,SAAoB;IACnD,OAAQA;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { cosmiconfig } from 'cosmiconfig';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { writeFile, fileExists } from './files.js';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
const configSchema = z.object({
|
|
7
|
+
framework: z.enum([
|
|
8
|
+
'angular',
|
|
9
|
+
'react',
|
|
10
|
+
'vue'
|
|
11
|
+
]),
|
|
12
|
+
componentsPath: z.string().default('src/components/ui'),
|
|
13
|
+
utilsPath: z.string().default('src/lib/utils.ts'),
|
|
14
|
+
tailwindConfig: z.string().default('tailwind.config.js'),
|
|
15
|
+
aliases: z.object({
|
|
16
|
+
components: z.string().default('@/components'),
|
|
17
|
+
utils: z.string().default('@/lib/utils')
|
|
18
|
+
}).optional()
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Load Galaxy UI configuration
|
|
22
|
+
*/ export async function loadConfig(cwd) {
|
|
23
|
+
const explorer = cosmiconfig('galaxy', {
|
|
24
|
+
searchPlaces: [
|
|
25
|
+
'galaxy.config.json',
|
|
26
|
+
'galaxy.config.js',
|
|
27
|
+
'.galaxyrc.json',
|
|
28
|
+
'.galaxyrc',
|
|
29
|
+
'package.json'
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
try {
|
|
33
|
+
const result = await explorer.search(cwd);
|
|
34
|
+
if (result && result.config) {
|
|
35
|
+
return configSchema.parse(result.config);
|
|
36
|
+
}
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Error loading config:', error);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a new Galaxy UI configuration file
|
|
44
|
+
*/ export async function createConfig(cwd, config) {
|
|
45
|
+
const configPath = resolve(cwd, 'galaxy.config.json');
|
|
46
|
+
const content = JSON.stringify(config, null, 2);
|
|
47
|
+
writeFile(configPath, content);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if a config file exists
|
|
51
|
+
*/ export async function configExists(cwd) {
|
|
52
|
+
const configFiles = [
|
|
53
|
+
'galaxy.config.json',
|
|
54
|
+
'galaxy.config.js',
|
|
55
|
+
'.galaxyrc.json',
|
|
56
|
+
'.galaxyrc'
|
|
57
|
+
];
|
|
58
|
+
for (const file of configFiles){
|
|
59
|
+
if (fileExists(resolve(cwd, file))) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get default config based on framework
|
|
67
|
+
*/ export function getDefaultConfig(framework) {
|
|
68
|
+
const baseConfig = {
|
|
69
|
+
framework,
|
|
70
|
+
componentsPath: 'src/components/ui',
|
|
71
|
+
utilsPath: 'src/lib/utils.ts',
|
|
72
|
+
tailwindConfig: 'tailwind.config.js'
|
|
73
|
+
};
|
|
74
|
+
switch(framework){
|
|
75
|
+
case 'angular':
|
|
76
|
+
return _extends({}, baseConfig, {
|
|
77
|
+
componentsPath: 'src/app/components/ui'
|
|
78
|
+
});
|
|
79
|
+
case 'react':
|
|
80
|
+
return baseConfig;
|
|
81
|
+
case 'vue':
|
|
82
|
+
return baseConfig;
|
|
83
|
+
default:
|
|
84
|
+
return baseConfig;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import { cosmiconfig } from 'cosmiconfig';\nimport { resolve } from 'path';\nimport { writeFile, fileExists } from './files.js';\nimport { z } from 'zod';\n\nconst configSchema = z.object({\n framework: z.enum(['angular', 'react', 'vue']),\n componentsPath: z.string().default('src/components/ui'),\n utilsPath: z.string().default('src/lib/utils.ts'),\n tailwindConfig: z.string().default('tailwind.config.js'),\n aliases: z\n .object({\n components: z.string().default('@/components'),\n utils: z.string().default('@/lib/utils'),\n })\n .optional(),\n});\n\nexport type Config = z.infer<typeof configSchema>;\n\n/**\n * Load Galaxy UI configuration\n */\nexport async function loadConfig(cwd: string): Promise<Config | null> {\n const explorer = cosmiconfig('galaxy', {\n searchPlaces: [\n 'galaxy.config.json',\n 'galaxy.config.js',\n '.galaxyrc.json',\n '.galaxyrc',\n 'package.json',\n ],\n });\n\n try {\n const result = await explorer.search(cwd);\n if (result && result.config) {\n return configSchema.parse(result.config);\n }\n } catch (error) {\n console.error('Error loading config:', error);\n }\n\n return null;\n}\n\n/**\n * Create a new Galaxy UI configuration file\n */\nexport async function createConfig(cwd: string, config: Config): Promise<void> {\n const configPath = resolve(cwd, 'galaxy.config.json');\n const content = JSON.stringify(config, null, 2);\n writeFile(configPath, content);\n}\n\n/**\n * Check if a config file exists\n */\nexport async function configExists(cwd: string): Promise<boolean> {\n const configFiles = [\n 'galaxy.config.json',\n 'galaxy.config.js',\n '.galaxyrc.json',\n '.galaxyrc',\n ];\n\n for (const file of configFiles) {\n if (fileExists(resolve(cwd, file))) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Get default config based on framework\n */\nexport function getDefaultConfig(framework: 'angular' | 'react' | 'vue'): Config {\n const baseConfig = {\n framework,\n componentsPath: 'src/components/ui',\n utilsPath: 'src/lib/utils.ts',\n tailwindConfig: 'tailwind.config.js',\n };\n\n switch (framework) {\n case 'angular':\n return {\n ...baseConfig,\n componentsPath: 'src/app/components/ui',\n };\n case 'react':\n return baseConfig;\n case 'vue':\n return baseConfig;\n default:\n return baseConfig;\n }\n}\n"],"names":["cosmiconfig","resolve","writeFile","fileExists","z","configSchema","object","framework","enum","componentsPath","string","default","utilsPath","tailwindConfig","aliases","components","utils","optional","loadConfig","cwd","explorer","searchPlaces","result","search","config","parse","error","console","createConfig","configPath","content","JSON","stringify","configExists","configFiles","file","getDefaultConfig","baseConfig"],"mappings":";AAAA,SAASA,WAAW,QAAQ,cAAc;AAC1C,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,SAAS,EAAEC,UAAU,QAAQ,aAAa;AACnD,SAASC,CAAC,QAAQ,MAAM;AAExB,MAAMC,eAAeD,EAAEE,MAAM,CAAC;IAC5BC,WAAWH,EAAEI,IAAI,CAAC;QAAC;QAAW;QAAS;KAAM;IAC7CC,gBAAgBL,EAAEM,MAAM,GAAGC,OAAO,CAAC;IACnCC,WAAWR,EAAEM,MAAM,GAAGC,OAAO,CAAC;IAC9BE,gBAAgBT,EAAEM,MAAM,GAAGC,OAAO,CAAC;IACnCG,SAASV,EACNE,MAAM,CAAC;QACNS,YAAYX,EAAEM,MAAM,GAAGC,OAAO,CAAC;QAC/BK,OAAOZ,EAAEM,MAAM,GAAGC,OAAO,CAAC;IAC5B,GACCM,QAAQ;AACb;AAIA;;CAEC,GACD,OAAO,eAAeC,WAAWC,GAAW;IAC1C,MAAMC,WAAWpB,YAAY,UAAU;QACrCqB,cAAc;YACZ;YACA;YACA;YACA;YACA;SACD;IACH;IAEA,IAAI;QACF,MAAMC,SAAS,MAAMF,SAASG,MAAM,CAACJ;QACrC,IAAIG,UAAUA,OAAOE,MAAM,EAAE;YAC3B,OAAOnB,aAAaoB,KAAK,CAACH,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