create-asterui 0.1.3 → 0.1.4
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/dist/index.js +23 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,6 +14,14 @@ const DAISYUI_THEMES = [
|
|
|
14
14
|
'night', 'coffee', 'winter', 'dim', 'nord', 'sunset'
|
|
15
15
|
];
|
|
16
16
|
const THEME_PRESETS = ['light-dark', 'business', 'all'];
|
|
17
|
+
const ICON_LIBRARIES = [
|
|
18
|
+
{ value: '@aster-ui/icons', label: '@aster-ui/icons', hint: 'Heroicons with size tokens', version: '^0.1.0' },
|
|
19
|
+
{ value: '@heroicons/react', label: 'Heroicons', hint: '300+ icons, outline/solid', version: '^2.2.0' },
|
|
20
|
+
{ value: 'lucide-react', label: 'Lucide', hint: 'popular, 1400+ icons', version: '^0.500.0' },
|
|
21
|
+
{ value: 'react-icons', label: 'React Icons', hint: 'multiple icon sets', version: '^5.4.0' },
|
|
22
|
+
{ value: '@phosphor-icons/react', label: 'Phosphor', hint: '9000+ icons, 6 weights', version: '^2.1.0' },
|
|
23
|
+
{ value: 'none', label: 'None', hint: 'skip icon library' },
|
|
24
|
+
];
|
|
17
25
|
function parseArgs() {
|
|
18
26
|
const args = process.argv.slice(2);
|
|
19
27
|
const result = {};
|
|
@@ -149,6 +157,11 @@ async function main() {
|
|
|
149
157
|
],
|
|
150
158
|
required: false,
|
|
151
159
|
}),
|
|
160
|
+
iconLibrary: () => p.select({
|
|
161
|
+
message: 'Icon library',
|
|
162
|
+
initialValue: '@aster-ui/icons',
|
|
163
|
+
options: ICON_LIBRARIES,
|
|
164
|
+
}),
|
|
152
165
|
}, {
|
|
153
166
|
onCancel: () => {
|
|
154
167
|
p.cancel('Operation cancelled.');
|
|
@@ -165,7 +178,7 @@ async function main() {
|
|
|
165
178
|
// Copy template files
|
|
166
179
|
copyDir(templateDir, projectDir);
|
|
167
180
|
// Generate package.json
|
|
168
|
-
const packageJson = generatePackageJson(options.projectName, options.language, options.optionalDeps);
|
|
181
|
+
const packageJson = generatePackageJson(options.projectName, options.language, options.optionalDeps, options.iconLibrary);
|
|
169
182
|
fs.writeFileSync(path.join(projectDir, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
170
183
|
// Generate index.css with theme config
|
|
171
184
|
const themes = getThemes(options.themePreset, options.customThemes);
|
|
@@ -208,7 +221,7 @@ function copyDir(src, dest) {
|
|
|
208
221
|
}
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
|
-
function generatePackageJson(name, language, optionalDeps = []) {
|
|
224
|
+
function generatePackageJson(name, language, optionalDeps = [], iconLibrary = 'none') {
|
|
212
225
|
const isTs = language === 'ts';
|
|
213
226
|
const pkg = {
|
|
214
227
|
name,
|
|
@@ -234,8 +247,15 @@ function generatePackageJson(name, language, optionalDeps = []) {
|
|
|
234
247
|
vite: '^7.0.0',
|
|
235
248
|
},
|
|
236
249
|
};
|
|
237
|
-
// Add
|
|
250
|
+
// Add icon library
|
|
238
251
|
const deps = pkg.dependencies;
|
|
252
|
+
if (iconLibrary !== 'none') {
|
|
253
|
+
const iconLib = ICON_LIBRARIES.find(lib => lib.value === iconLibrary);
|
|
254
|
+
if (iconLib && iconLib.version) {
|
|
255
|
+
deps[iconLibrary] = iconLib.version;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Add optional dependencies
|
|
239
259
|
if (optionalDeps.includes('chart')) {
|
|
240
260
|
deps['apexcharts'] = '^5.0.0';
|
|
241
261
|
}
|