create-asterui 0.1.2 → 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.
Files changed (2) hide show
  1. package/dist/index.js +49 -5
  2. 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 = {};
@@ -140,6 +148,20 @@ async function main() {
140
148
  .map((pm) => ({ value: pm, label: pm })),
141
149
  ],
142
150
  }),
151
+ optionalDeps: () => p.multiselect({
152
+ message: 'Optional components (require extra dependencies)',
153
+ options: [
154
+ { value: 'chart', label: 'Chart', hint: 'apexcharts' },
155
+ { value: 'qrcode', label: 'QRCode', hint: 'qrcode' },
156
+ { value: 'virtuallist', label: 'VirtualList', hint: '@tanstack/react-virtual' },
157
+ ],
158
+ required: false,
159
+ }),
160
+ iconLibrary: () => p.select({
161
+ message: 'Icon library',
162
+ initialValue: '@aster-ui/icons',
163
+ options: ICON_LIBRARIES,
164
+ }),
143
165
  }, {
144
166
  onCancel: () => {
145
167
  p.cancel('Operation cancelled.');
@@ -156,7 +178,7 @@ async function main() {
156
178
  // Copy template files
157
179
  copyDir(templateDir, projectDir);
158
180
  // Generate package.json
159
- const packageJson = generatePackageJson(options.projectName, options.language);
181
+ const packageJson = generatePackageJson(options.projectName, options.language, options.optionalDeps, options.iconLibrary);
160
182
  fs.writeFileSync(path.join(projectDir, 'package.json'), JSON.stringify(packageJson, null, 2));
161
183
  // Generate index.css with theme config
162
184
  const themes = getThemes(options.themePreset, options.customThemes);
@@ -199,7 +221,7 @@ function copyDir(src, dest) {
199
221
  }
200
222
  }
201
223
  }
202
- function generatePackageJson(name, language) {
224
+ function generatePackageJson(name, language, optionalDeps = [], iconLibrary = 'none') {
203
225
  const isTs = language === 'ts';
204
226
  const pkg = {
205
227
  name,
@@ -225,10 +247,32 @@ function generatePackageJson(name, language) {
225
247
  vite: '^7.0.0',
226
248
  },
227
249
  };
250
+ // Add icon library
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
259
+ if (optionalDeps.includes('chart')) {
260
+ deps['apexcharts'] = '^5.0.0';
261
+ }
262
+ if (optionalDeps.includes('qrcode')) {
263
+ deps['qrcode'] = '^1.5.0';
264
+ }
265
+ if (optionalDeps.includes('virtuallist')) {
266
+ deps['@tanstack/react-virtual'] = '^3.0.0';
267
+ }
228
268
  if (isTs) {
229
- pkg.devDependencies['typescript'] = '^5.6.0';
230
- pkg.devDependencies['@types/react'] = '^19.0.0';
231
- pkg.devDependencies['@types/react-dom'] = '^19.0.0';
269
+ const devDeps = pkg.devDependencies;
270
+ devDeps['typescript'] = '^5.6.0';
271
+ devDeps['@types/react'] = '^19.0.0';
272
+ devDeps['@types/react-dom'] = '^19.0.0';
273
+ if (optionalDeps.includes('qrcode')) {
274
+ devDeps['@types/qrcode'] = '^1.5.0';
275
+ }
232
276
  }
233
277
  return pkg;
234
278
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-asterui",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Create a new AsterUI project",
5
5
  "type": "module",
6
6
  "bin": {