create-renoun 2.0.2 → 2.0.3

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.mjs +16 -5
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -263,6 +263,20 @@ const downloadFile = async (url, filePath)=>{
263
263
  writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');
264
264
  }
265
265
 
266
+ /** Derive the examples list from the GitHub repository at runtime. */ async function getExampleOptions() {
267
+ const response = await fetch('https://api.github.com/repos/souporserious/renoun/contents/examples?ref=main');
268
+ if (!response.ok) {
269
+ throw new Error(`Failed to list examples: ${response.status} ${response.statusText}`);
270
+ }
271
+ const items = await response.json();
272
+ const slugs = items.filter((item)=>item.type === 'dir').map((item)=>item.name);
273
+ const toTitle = (slug)=>slug.split('-').map((string)=>string ? string[0].toUpperCase() + string.slice(1) : string).join(' ');
274
+ return slugs.map((slug)=>({
275
+ value: slug,
276
+ label: toTitle(slug)
277
+ }));
278
+ }
279
+
266
280
  const __filename = __node_cjsUrl.fileURLToPath(import.meta.url);
267
281
  const __dirname = __node_cjsPath.dirname(__filename);
268
282
 
@@ -366,13 +380,10 @@ async function start() {
366
380
  * - After fetching, go directly to SUCCESS_STATE.
367
381
  */
368
382
  case states.PICK_EXAMPLE: {
383
+ const exampleOptions = await getExampleOptions();
369
384
  const example = await select({
370
385
  message: 'Choose an example below to get started:',
371
- options: [
372
- { value: 'blog', label: 'Blog' },
373
- { value: 'docs', label: 'Documentation' },
374
- { value: 'design-system', label: 'Design System' },
375
- ],
386
+ options: exampleOptions,
376
387
  });
377
388
 
378
389
  if (isCancel(example)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-renoun",
3
3
  "type": "module",
4
- "version": "2.0.2",
4
+ "version": "2.0.3",
5
5
  "author": {
6
6
  "name": "souporserious",
7
7
  "email": "support@souporserious.com"
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "bin": "./dist/index.mjs",
21
21
  "devDependencies": {
22
- "bunchee": "6.6.0"
22
+ "bunchee": "6.6.2"
23
23
  },
24
24
  "dependencies": {
25
25
  "@antfu/install-pkg": "1.1.0",